From 85c49ff64251c67879f4a9bfa1cedc71d8d65a77 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 22 Jan 2016 11:33:40 +0100 Subject: [PATCH] Commander: Do not save params on already saved param update --- msg/parameter_update.msg | 1 + src/modules/commander/commander.cpp | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/msg/parameter_update.msg b/msg/parameter_update.msg index 39dc336e05..78cebf7f4f 100644 --- a/msg/parameter_update.msg +++ b/msg/parameter_update.msg @@ -1 +1,2 @@ uint64 timestamp # time at which the latest parameter was updated +bool saved # wether the change has already been saved to disk diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 45b43b3d9a..767b13367e 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1509,12 +1509,12 @@ int commander_thread_main(int argc, char *argv[]) /* EPH / EPV */ param_get(_param_eph, &eph_threshold); param_get(_param_epv, &epv_threshold); - } - /* Set flag to autosave parameters if necessary */ - if (updated && autosave_params != 0) { - /* trigger an autosave */ - need_param_autosave = true; + /* Set flag to autosave parameters if necessary */ + if (updated && autosave_params != 0 && param_changed.saved == false) { + /* trigger an autosave */ + need_param_autosave = true; + } } orb_check(sp_man_sub, &updated); @@ -1570,11 +1570,12 @@ int commander_thread_main(int argc, char *argv[]) /* and the system is not already armed (and potentially flying) */ !armed.armed) { - bool chAirspeed = false; - bool hotplug_timeout = hrt_elapsed_time(&commander_boot_timestamp) > HOTPLUG_SENS_TIMEOUT; - + bool chAirspeed = false; + bool hotplug_timeout = hrt_elapsed_time(&commander_boot_timestamp) > HOTPLUG_SENS_TIMEOUT; + /* Perform airspeed check only if circuit breaker is not - * engaged and it's not a rotary wing */ + * engaged and it's not a rotary wing + */ if (!status.circuit_breaker_engaged_airspd_check && !status.is_rotary_wing) { chAirspeed = true; }