From 27ad0fcf6f95b4c15bad3bed7ec324c6d0be6c4a Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 19 Jul 2012 21:51:31 -0500 Subject: [PATCH 1/2] Don't allow the system to save while armed --- flight/Modules/System/systemmod.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/flight/Modules/System/systemmod.c b/flight/Modules/System/systemmod.c index 827b264d2..879c4ac86 100644 --- a/flight/Modules/System/systemmod.c +++ b/flight/Modules/System/systemmod.c @@ -216,8 +216,13 @@ static void objectUpdatedCb(UAVObjEvent * ev) ObjectPersistenceGet(&objper); int retval = 1; - // Execute action - if (objper.Operation == OBJECTPERSISTENCE_OPERATION_LOAD) { + FlightStatusData flightStatus; + FlightStatusGet(&flightStatus); + + // Execute action if disarmed + if(flightStatus.Armed != FLIGHTSTATUS_ARMED_DISARMED) { + retval = -1; + } else if (objper.Operation == OBJECTPERSISTENCE_OPERATION_LOAD) { if (objper.Selection == OBJECTPERSISTENCE_SELECTION_SINGLEOBJECT) { // Get selected object obj = UAVObjGetByID(objper.ObjectID); From 3eb41d3ef254db5db7db322f1a279f6ccfa50b35 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 19 Jul 2012 22:18:36 -0500 Subject: [PATCH 2/2] When the systemmod callback happens exit if the operation is error or completed --- flight/Modules/System/systemmod.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flight/Modules/System/systemmod.c b/flight/Modules/System/systemmod.c index 879c4ac86..56f4b7820 100644 --- a/flight/Modules/System/systemmod.c +++ b/flight/Modules/System/systemmod.c @@ -219,6 +219,12 @@ static void objectUpdatedCb(UAVObjEvent * ev) FlightStatusData flightStatus; FlightStatusGet(&flightStatus); + // When this is called because of this method don't do anything + if (objper.Operation == OBJECTPERSISTENCE_OPERATION_ERROR || + objper.Operation == OBJECTPERSISTENCE_OPERATION_COMPLETED) { + return; + } + // Execute action if disarmed if(flightStatus.Armed != FLIGHTSTATUS_ARMED_DISARMED) { retval = -1;