From c69c4157f1fab9da1671bd99901baa8d951c213f Mon Sep 17 00:00:00 2001 From: peabody124 Date: Thu, 4 Nov 2010 02:30:47 +0000 Subject: [PATCH] Flight/Actuator: Add failsafe for when flying via GCS to disarm at lost connection git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2067 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/OpenPilot/Modules/Actuator/actuator.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flight/OpenPilot/Modules/Actuator/actuator.c b/flight/OpenPilot/Modules/Actuator/actuator.c index 39e286f9a..b23118a4b 100644 --- a/flight/OpenPilot/Modules/Actuator/actuator.c +++ b/flight/OpenPilot/Modules/Actuator/actuator.c @@ -36,6 +36,7 @@ //#include "vtolsettings.h" #include "systemsettings.h" #include "actuatordesired.h" +#include "flighttelemetrystats.h" #include "actuatorcommand.h" #include "manualcontrolcommand.h" #include "mixersettings.h" @@ -179,6 +180,14 @@ static void actuatorTask(void* parameters) AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR); bool armed = manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_TRUE; + if(ManualControlCommandReadOnly(&manualControl)) { + /* when being controlled by GCS check for connection still intact */ + /* eventually this lost connection (like lost RX) will trigger */ + /* a failsafe flight pattern */ + FlightTelemetryStatsData flightStats; + FlightTelemetryStatsGet(&flightStats); + armed &= (flightStats.Status == FLIGHTTELEMETRYSTATS_STATUS_CONNECTED); + } armed &= desired.Throttle > 0.05; //zero throttle stops the motors float curve1 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve1);