Advertisement
Guest User

baseflight failsafe, tehty oikein

a guest
Jan 30th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. // Failsafe routine
  2. if (feature(FEATURE_FAILSAFE) || feature(FEATURE_FW_FAILSAFE_RTH)) {
  3. if (failsafeCnt > (5 * cfg.failsafe_delay) && f.ARMED) { // Stabilize, and set Throttle to specified level
  4. for (i = 0; i < 3; i++)
  5. rcData[i] = mcfg.midrc; // after specified guard time after RC signal is lost (in 0.1sec)
  6. rcData[THROTTLE] = cfg.failsafe_throttle;
  7. buzzer(BUZZER_TX_LOST_ARMED);
  8. if ((failsafeCnt > 5 * (cfg.failsafe_delay + cfg.failsafe_off_delay)) && !f.FW_FAILSAFE_RTH_ENABLE) { // Turn OFF motors after specified Time (in 0.1sec)
  9. mwDisarm(); // This will prevent the copter to automatically rearm if failsafe shuts it down and prevents
  10. f.OK_TO_ARM = 0; // to restart accidentely by just reconnect to the tx - you will have to switch off first to rearm
  11. buzzer(BUZZER_TX_LOST);
  12. }
  13. failsafeEvents++;
  14. }
  15. if (failsafeCnt > (5 * cfg.failsafe_delay) && !f.ARMED) { // Turn off "Ok To arm to prevent the motors from spinning after repowering the RX with low throttle and aux to arm
  16. mwDisarm(); // This will prevent the copter to automatically rearm if failsafe shuts it down and prevents
  17. f.OK_TO_ARM = 0; // to restart accidentely by just reconnect to the tx - you will have to switch off first to rearm
  18. buzzer(BUZZER_TX_LOST);
  19. }
  20. failsafeCnt++;
  21. }
  22. // end of failsafe routine - next change is made with RcOptions setting
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement