From fdd591b7000c96cd40ad197f0eb192e0c88b22b4 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Tue, 10 May 2011 14:40:21 -0500 Subject: [PATCH] OP-488: If the FirmwareIAP receives a halt signal but system is not disarmed abort the halt. --- flight/Modules/FirmwareIAP/firmwareiap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flight/Modules/FirmwareIAP/firmwareiap.c b/flight/Modules/FirmwareIAP/firmwareiap.c index 71de8c390..11e8721fd 100644 --- a/flight/Modules/FirmwareIAP/firmwareiap.c +++ b/flight/Modules/FirmwareIAP/firmwareiap.c @@ -30,6 +30,7 @@ #include "openpilot.h" #include "firmwareiap.h" #include "firmwareiapobj.h" +#include "flightstatus.h" // Private constants #define IAP_CMD_STEP_1 1122 @@ -156,6 +157,16 @@ static void FirmwareIAPCallback(UAVObjEvent* ev) case IAP_STATE_STEP_2: if( data.Command == IAP_CMD_STEP_3 ) { if( delta > iap_time_3_low_end && delta < iap_time_3_high_end ) { + + FlightStatusData flightStatus; + FlightStatusGet(&flightStatus); + + if(flightStatus.Armed != FLIGHTSTATUS_ARMED_DISARMED) { + // Abort any attempts if not disarmed + iap_state = IAP_STATE_READY; + break; + } + // we've met the three sequence of command numbers // we've met the time requirements. PIOS_IAP_SetRequest1();