From e341a37bd1a20932f9df48ee8fc89260eb158076 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sun, 3 Jun 2012 17:26:10 -0500 Subject: [PATCH] Need to add a small delay after save for the load to work correctly. Odd. --- flight/Modules/System/systemmod.c | 5 ++++- flight/UAVObjects/uavobjectmanager.c | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/flight/Modules/System/systemmod.c b/flight/Modules/System/systemmod.c index e332843a8..1217ea99f 100644 --- a/flight/Modules/System/systemmod.c +++ b/flight/Modules/System/systemmod.c @@ -242,7 +242,10 @@ static void objectUpdatedCb(UAVObjEvent * ev) } // Save selected instance retval = UAVObjSave(obj, objper.InstanceID); - + + // Not sure why this is needed + vTaskDelay(10); + // Verify saving worked if (retval == 0) retval = UAVObjLoad(obj, objper.InstanceID); diff --git a/flight/UAVObjects/uavobjectmanager.c b/flight/UAVObjects/uavobjectmanager.c index d37b00312..8dc077967 100644 --- a/flight/UAVObjects/uavobjectmanager.c +++ b/flight/UAVObjects/uavobjectmanager.c @@ -721,10 +721,11 @@ int32_t UAVObjLoad(UAVObjHandle obj, uint16_t instId) return -1; // Fire event on success - if (PIOS_FLASHFS_ObjLoad(obj, instId, instEntry->data) == 0) + int32_t retval; + if ((retval = PIOS_FLASHFS_ObjLoad(obj, instId, instEntry->data)) == 0) sendEvent(objEntry, instId, EV_UNPACKED); else - return -1; + return retval; #endif #if defined(PIOS_INCLUDE_SDCARD)