From 61ed812fc40fe0e1f31acc98a1df687fac4f9e65 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Fri, 6 Mar 2015 15:33:25 +0900 Subject: [PATCH] Copter: set Notify's autopilot_mode flag --- ArduCopter/flight_mode.pde | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ArduCopter/flight_mode.pde b/ArduCopter/flight_mode.pde index 81c6f608dc..01ae80fb5c 100644 --- a/ArduCopter/flight_mode.pde +++ b/ArduCopter/flight_mode.pde @@ -112,6 +112,11 @@ static bool set_mode(uint8_t mode) Log_Write_Error(ERROR_SUBSYSTEM_FLIGHT_MODE,mode); } + // update notify object + if (success) { + notify_flight_mode(control_mode); + } + // return success or failure return success; } @@ -268,6 +273,24 @@ static bool mode_allows_arming(uint8_t mode, bool arming_from_gcs) { return false; } +// notify_flight_mode - sets notify object based on flight mode. Only used for OreoLED notify device +static void notify_flight_mode(uint8_t mode) { + switch(mode) { + case AUTO: + case GUIDED: + case RTL: + case CIRCLE: + case LAND: + // autopilot modes + AP_Notify::flags.autopilot_mode = true; + break; + default: + // all other are manual flight modes + AP_Notify::flags.autopilot_mode = false; + break; + } +} + // // print_flight_mode - prints flight mode to serial port. //