forked from Archive/PX4-Autopilot
Add param command which does not reset the autostart params to not hamper auto-config
This commit is contained in:
parent
29cd95ebad
commit
d0b78aa8a0
|
@ -134,8 +134,8 @@ then
|
|||
then
|
||||
# We can't be sure the defaults haven't changed, so
|
||||
# if someone requests a re-configuration, we do it
|
||||
# cleanly from scratch
|
||||
param reset
|
||||
# cleanly from scratch (except autostart / autoconfig)
|
||||
param reset_nostart
|
||||
set DO_AUTOCONFIG yes
|
||||
else
|
||||
set DO_AUTOCONFIG no
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue