mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 11:59:58 +03:00
Fix MODE_STRING blank value output and improve validation messages
Emptry MODE_STRING paramaters would produce CLI output that would then generate errors if reapplied using a `diff` or `dump`. Fixed the output for blank values to be compatible with setting an empty string (clearing a previous value). Also improve the length validation to report the allowed character range.
This commit is contained in:
parent
1cbff2b9aa
commit
f5722273aa
1 changed files with 3 additions and 1 deletions
|
@ -542,7 +542,7 @@ static void printValuePointer(const clivalue_t *var, const void *valuePointer, b
|
|||
}
|
||||
break;
|
||||
case MODE_STRING:
|
||||
cliPrintf("%s", (char *)valuePointer);
|
||||
cliPrintf("%s", (strlen((char *)valuePointer) == 0) ? "-" : (char *)valuePointer);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4162,6 +4162,8 @@ STATIC_UNIT_TESTED void cliSet(char *cmdline)
|
|||
strncpy((char *)cliGetValuePointer(val), valPtr, len);
|
||||
}
|
||||
valueChanged = true;
|
||||
} else {
|
||||
cliPrintErrorLinef("STRING MUST BE 1-%d CHARACTERS OR '-' FOR EMPTY", max);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue