diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-03 13:26:59 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-03 13:26:59 +0200 |
commit | 73d7c8e3833211d49ecec0ae9e9fd4d0307d5184 (patch) | |
tree | 1cc84659bb2265d6df338ecf325e7c0892dae60b /src/systemcmds/param/param.c | |
parent | 628477ee2c75d16758688f53c0f8d9f29457f831 (diff) | |
parent | 2a7954b6cf068e36c16dc9170a86970ed46856a9 (diff) | |
download | px4-firmware-73d7c8e3833211d49ecec0ae9e9fd4d0307d5184.tar.gz px4-firmware-73d7c8e3833211d49ecec0ae9e9fd4d0307d5184.tar.bz2 px4-firmware-73d7c8e3833211d49ecec0ae9e9fd4d0307d5184.zip |
Merge branch 'master' of github.com:PX4/Firmware into simon_test
Diffstat (limited to 'src/systemcmds/param/param.c')
-rw-r--r-- | src/systemcmds/param/param.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index d92ee88ef..f8bff2f6f 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -63,7 +63,8 @@ static void do_show(const char* search_string); 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(); +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'"); @@ -416,10 +421,33 @@ do_compare(const char* name, const char* vals[], unsigned comparisons) } static void -do_reset() +do_reset(void) +{ + param_reset_all(); + + if (param_save_default()) { + warnx("Param export failed."); + exit(1); + } else { + 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); |