mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 00:05:28 +03:00
Ignore leading whitespace when setting values by name,
Previously this didn't work: `set blackbox_device = SPIFLASH` Users had to type in: `set blackbox_device =SPIFLASH`
This commit is contained in:
parent
2d73a74802
commit
df7d4be263
1 changed files with 7 additions and 2 deletions
|
@ -2165,15 +2165,20 @@ static void cliSet(char *cmdline)
|
|||
cliPrint("\r\n");
|
||||
}
|
||||
} else if ((eqptr = strstr(cmdline, "=")) != NULL) {
|
||||
// has equal, set var
|
||||
// has equals
|
||||
|
||||
char *lastNonSpaceCharacter = eqptr;
|
||||
while (*(lastNonSpaceCharacter - 1) == ' ') {
|
||||
lastNonSpaceCharacter--;
|
||||
}
|
||||
uint8_t variableNameLength = lastNonSpaceCharacter - cmdline;
|
||||
|
||||
// skip the '=' and any ' ' characters
|
||||
eqptr++;
|
||||
len--;
|
||||
while (*(eqptr) == ' ') {
|
||||
eqptr++;
|
||||
}
|
||||
|
||||
for (i = 0; i < VALUE_COUNT; i++) {
|
||||
val = &valueTable[i];
|
||||
// ensure exact match when setting to prevent setting variables with shorter names
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue