mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
Change CLI "get" to be case-insensitive (#5382)
Matches the behavior of the "set" command.
This commit is contained in:
parent
4d3666b77b
commit
f97df6827e
1 changed files with 11 additions and 1 deletions
|
@ -208,6 +208,16 @@ static const char * const *sensorHardwareNames[] = {
|
||||||
};
|
};
|
||||||
#endif // USE_SENSOR_NAMES
|
#endif // USE_SENSOR_NAMES
|
||||||
|
|
||||||
|
static char *cliStringToLowercase(char *str)
|
||||||
|
{
|
||||||
|
char *s = str;
|
||||||
|
while (*s) {
|
||||||
|
*s = tolower((unsigned char)*s);
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
static void cliPrint(const char *str)
|
static void cliPrint(const char *str)
|
||||||
{
|
{
|
||||||
while (*str) {
|
while (*str) {
|
||||||
|
@ -2828,7 +2838,7 @@ STATIC_UNIT_TESTED void cliGet(char *cmdline)
|
||||||
int matchedCommands = 0;
|
int matchedCommands = 0;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < valueTableEntryCount; i++) {
|
for (uint32_t i = 0; i < valueTableEntryCount; i++) {
|
||||||
if (strstr(valueTable[i].name, cmdline)) {
|
if (strstr(valueTable[i].name, cliStringToLowercase(cmdline))) {
|
||||||
val = &valueTable[i];
|
val = &valueTable[i];
|
||||||
cliPrintf("%s = ", valueTable[i].name);
|
cliPrintf("%s = ", valueTable[i].name);
|
||||||
cliPrintVar(val, 0);
|
cliPrintVar(val, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue