Copter: fix arming tone to sound before arming

Also fixed bug in which vehicle could appear to be armed (according to
LEDs) but is not.  This could occur if pilot had raised the throttle
very high during the calibration that happens just before arming.
This commit is contained in:
Randy Mackay 2014-07-25 13:07:49 +09:00
parent 46e5fa2c0b
commit 71cbcacf50

View File

@ -130,6 +130,13 @@ static void init_arm_motors()
// disable inertial nav errors temporarily // disable inertial nav errors temporarily
inertial_nav.ignore_next_error(); inertial_nav.ignore_next_error();
// notify that arming will occur (we do this early to give plenty of warning)
AP_Notify::flags.armed = true;
// call update_notify a few times to ensure the message gets out
for (uint8_t i=0; i<=10; i++) {
update_notify();
}
#if LOGGING_ENABLED == ENABLED #if LOGGING_ENABLED == ENABLED
// start dataflash // start dataflash
start_logging(); start_logging();
@ -178,6 +185,8 @@ static void init_arm_motors()
if (g.rc_3.control_in > g.throttle_cruise && g.throttle_cruise > 100) { if (g.rc_3.control_in > g.throttle_cruise && g.throttle_cruise > 100) {
motors.output_min(); motors.output_min();
failsafe_enable(); failsafe_enable();
AP_Notify::flags.armed = false;
AP_Notify::flags.arming_failed = false;
return; return;
} }