mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 16:30:34 +08:00
Fix a param save issue where a state variable might preven the parameters from being saved (identified and fixed by ultrasystem)
This commit is contained in:
@@ -63,6 +63,7 @@ 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);
|
||||
static void do_compare(const char* name, const char* vals[], unsigned comparisons);
|
||||
static void do_reset();
|
||||
|
||||
int
|
||||
param_main(int argc, char *argv[])
|
||||
@@ -130,6 +131,10 @@ param_main(int argc, char *argv[])
|
||||
errx(1, "not enough arguments.\nTry 'param compare PARAM_NAME 3'");
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "reset")) {
|
||||
do_reset();
|
||||
}
|
||||
}
|
||||
|
||||
errx(1, "expected a command, try 'load', 'import', 'show', 'set', 'compare', 'select' or 'save'");
|
||||
@@ -402,3 +407,16 @@ do_compare(const char* name, const char* vals[], unsigned comparisons)
|
||||
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
static void
|
||||
do_reset()
|
||||
{
|
||||
param_reset_all();
|
||||
|
||||
if (param_save_default()) {
|
||||
warnx("Param export failed.");
|
||||
exit(1);
|
||||
} else {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user