diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-01 13:43:56 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-01 13:43:56 +0200 |
commit | 545e207d13541c1f36325fcfa0f847d5f78ff4e3 (patch) | |
tree | b744850f175315d0cf3c92f5979c1ffbd505038e | |
parent | 6042999aab26276ff87e7274b97b69200919b86f (diff) | |
parent | d0b78aa8a09cd4259258ab10b77c98e907c3b460 (diff) | |
download | px4-firmware-545e207d13541c1f36325fcfa0f847d5f78ff4e3.tar.gz px4-firmware-545e207d13541c1f36325fcfa0f847d5f78ff4e3.tar.bz2 px4-firmware-545e207d13541c1f36325fcfa0f847d5f78ff4e3.zip |
Merge pull request #1106 from PX4/reconfig_fix
Reconfig fix
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rcS | 4 | ||||
-rw-r--r-- | src/systemcmds/param/param.c | 28 |
2 files changed, 32 insertions, 0 deletions
diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index f70e0ed77..1c9ded6a8 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -132,6 +132,10 @@ then # if param compare SYS_AUTOCONFIG 1 then + # We can't be sure the defaults haven't changed, so + # if someone requests a re-configuration, we do it + # cleanly from scratch (except autostart / autoconfig) + param reset_nostart set DO_AUTOCONFIG yes else set DO_AUTOCONFIG no diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index 328205e29..f8bff2f6f 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -64,6 +64,7 @@ static void do_show_print(void *arg, param_t param); static void do_set(const char* name, const char* val, bool fail_on_not_found); static void do_compare(const char* name, const char* vals[], unsigned comparisons); static void do_reset(void); +static void do_reset_nostart(void); int param_main(int argc, char *argv[]) @@ -142,6 +143,10 @@ param_main(int argc, char *argv[]) if (!strcmp(argv[1], "reset")) { do_reset(); } + + if (!strcmp(argv[1], "reset_nostart")) { + do_reset_nostart(); + } } errx(1, "expected a command, try 'load', 'import', 'show', 'set', 'compare', 'select' or 'save'"); @@ -427,3 +432,26 @@ do_reset(void) exit(0); } } + +static void +do_reset_nostart(void) +{ + + int32_t autostart; + int32_t autoconfig; + + (void)param_get(param_find("SYS_AUTOSTART"), &autostart); + (void)param_get(param_find("SYS_AUTOCONFIG"), &autoconfig); + + param_reset_all(); + + (void)param_set(param_find("SYS_AUTOSTART"), &autostart); + (void)param_set(param_find("SYS_AUTOCONFIG"), &autoconfig); + + if (param_save_default()) { + warnx("Param export failed."); + exit(1); + } else { + exit(0); + } +} |