From d3de8ff0effe2616e837adc1ca4586ed91f2d085 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sat, 3 Sep 2011 23:57:51 -0500 Subject: [PATCH] OP-559: Process the arm status when disconnect and allow it to timeout and disarm --- flight/Modules/ManualControl/manualcontrol.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/flight/Modules/ManualControl/manualcontrol.c b/flight/Modules/ManualControl/manualcontrol.c index 3e2662bce..db9e75dc4 100644 --- a/flight/Modules/ManualControl/manualcontrol.c +++ b/flight/Modules/ManualControl/manualcontrol.c @@ -278,7 +278,6 @@ static void manualControlTask(void *parameters) // Important: Throttle < 0 will reset Stabilization coefficients among other things. Either change this, // or leave throttle at IDLE speed or above when going into AUTO-failsafe. AlarmsSet(SYSTEMALARMS_ALARM_MANUALCONTROL, SYSTEMALARMS_ALARM_WARNING); - ManualControlCommandSet(&cmd); } else { AlarmsClear(SYSTEMALARMS_ALARM_MANUALCONTROL); @@ -314,13 +313,15 @@ static void manualControlTask(void *parameters) processFlightMode(&settings, flightMode); - processArm(&cmd, &settings); - - // Update cmd object - ManualControlCommandSet(&cmd); } + // Process arming outside conditional so system will disarm when disconnected + processArm(&cmd, &settings); + + // Update cmd object + ManualControlCommandSet(&cmd); + } else { ManualControlCommandGet(&cmd); /* Under GCS control */ } @@ -645,7 +646,7 @@ static void processArm(ManualControlCommandData * cmd, ManualControlSettingsData } else { // Not really needed since this function not called when disconnected if (cmd->Connected == MANUALCONTROLCOMMAND_CONNECTED_FALSE) - return; + lowThrottle = true; // The throttle is not low, in case we where arming or disarming, abort if (!lowThrottle) {