mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 11:59:58 +03:00
Cleaned up CLI 'resource' implementation.
This commit is contained in:
parent
18c485707e
commit
3142d5ad70
1 changed files with 4 additions and 5 deletions
|
@ -5850,9 +5850,8 @@ static void cliResource(char *cmdline)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t resourceIndex = 0;
|
unsigned resourceIndex = 0;
|
||||||
int index = 0;
|
for (; ; resourceIndex++) {
|
||||||
for (resourceIndex = 0; ; resourceIndex++) {
|
|
||||||
if (resourceIndex >= ARRAYLEN(resourceTable)) {
|
if (resourceIndex >= ARRAYLEN(resourceTable)) {
|
||||||
cliPrintErrorLinef("INVALID RESOURCE NAME: '%s'", pch);
|
cliPrintErrorLinef("INVALID RESOURCE NAME: '%s'", pch);
|
||||||
return;
|
return;
|
||||||
|
@ -5865,7 +5864,7 @@ static void cliResource(char *cmdline)
|
||||||
}
|
}
|
||||||
|
|
||||||
pch = strtok_r(NULL, " ", &saveptr);
|
pch = strtok_r(NULL, " ", &saveptr);
|
||||||
index = atoi(pch);
|
int index = atoi(pch);
|
||||||
|
|
||||||
if (resourceTable[resourceIndex].maxIndex > 0 || index > 0) {
|
if (resourceTable[resourceIndex].maxIndex > 0 || index > 0) {
|
||||||
if (index <= 0 || index > MAX_RESOURCE_INDEX(resourceTable[resourceIndex].maxIndex)) {
|
if (index <= 0 || index > MAX_RESOURCE_INDEX(resourceTable[resourceIndex].maxIndex)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue