Sub: Refactor notify update after flight mode change

This commit is contained in:
Jacob Walser 2017-04-14 13:13:18 -04:00
parent b28c3584d4
commit a83e1ad971
1 changed files with 3 additions and 5 deletions

View File

@ -80,6 +80,9 @@ bool Sub::set_mode(control_mode_t mode, mode_reason_t reason)
control_mode_reason = reason;
DataFlash.Log_Write_Mode(control_mode, control_mode_reason);
// update notify object
notify_flight_mode(control_mode);
#if AC_FENCE == ENABLED
// pilot requested flight mode change during a fence breach indicates pilot is attempting to manually recover
// this flight mode change could be automatic (i.e. fence, battery, GPS or GCS failsafe)
@ -91,11 +94,6 @@ bool Sub::set_mode(control_mode_t mode, mode_reason_t reason)
Log_Write_Error(ERROR_SUBSYSTEM_FLIGHT_MODE,mode);
}
// update notify object
if (success) {
notify_flight_mode(control_mode);
}
// return success or failure
return success;
}