mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 18:06:39 +08:00
Add param command which does not reset the autostart params to not hamper auto-config
This commit is contained in:
@@ -134,8 +134,8 @@ then
|
|||||||
then
|
then
|
||||||
# We can't be sure the defaults haven't changed, so
|
# We can't be sure the defaults haven't changed, so
|
||||||
# if someone requests a re-configuration, we do it
|
# if someone requests a re-configuration, we do it
|
||||||
# cleanly from scratch
|
# cleanly from scratch (except autostart / autoconfig)
|
||||||
param reset
|
param reset_nostart
|
||||||
set DO_AUTOCONFIG yes
|
set DO_AUTOCONFIG yes
|
||||||
else
|
else
|
||||||
set DO_AUTOCONFIG no
|
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_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_compare(const char* name, const char* vals[], unsigned comparisons);
|
||||||
static void do_reset(void);
|
static void do_reset(void);
|
||||||
|
static void do_reset_nostart(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
param_main(int argc, char *argv[])
|
param_main(int argc, char *argv[])
|
||||||
@@ -142,6 +143,10 @@ param_main(int argc, char *argv[])
|
|||||||
if (!strcmp(argv[1], "reset")) {
|
if (!strcmp(argv[1], "reset")) {
|
||||||
do_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'");
|
errx(1, "expected a command, try 'load', 'import', 'show', 'set', 'compare', 'select' or 'save'");
|
||||||
@@ -427,3 +432,26 @@ do_reset(void)
|
|||||||
exit(0);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user