mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
add strict argument checking for the "defaults" cli command
This commit is contained in:
parent
004e98457f
commit
96c7ef22c8
1 changed files with 11 additions and 1 deletions
|
@ -2762,9 +2762,19 @@ static void cliSave(char *cmdline)
|
||||||
|
|
||||||
static void cliDefaults(char *cmdline)
|
static void cliDefaults(char *cmdline)
|
||||||
{
|
{
|
||||||
|
bool saveConfigs;
|
||||||
|
|
||||||
|
if (isEmpty(cmdline)) {
|
||||||
|
saveConfigs = true;
|
||||||
|
} else if (strncasecmp(cmdline, "nosave", 6) == 0) {
|
||||||
|
saveConfigs = false;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cliPrintHashLine("resetting to defaults");
|
cliPrintHashLine("resetting to defaults");
|
||||||
resetConfigs();
|
resetConfigs();
|
||||||
if (isEmpty(cmdline)) {
|
if (saveConfigs) {
|
||||||
cliSave(NULL);
|
cliSave(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue