1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Ignore CLI commands that are prefixed with # (comments)

This commit is contained in:
Dominic Clifton 2014-09-18 00:46:42 +01:00
parent e51cb447c4
commit d9d5227af9

View file

@ -1189,14 +1189,16 @@ void cliProcess(void)
cliPrint("\r\n"); cliPrint("\r\n");
cliBuffer[bufferIndex] = 0; // null terminate cliBuffer[bufferIndex] = 0; // null terminate
target.name = cliBuffer; if (cliBuffer[0] != '#') {
target.param = NULL; target.name = cliBuffer;
target.param = NULL;
cmd = bsearch(&target, cmdTable, CMD_COUNT, sizeof cmdTable[0], cliCompare); cmd = bsearch(&target, cmdTable, CMD_COUNT, sizeof cmdTable[0], cliCompare);
if (cmd) if (cmd)
cmd->func(cliBuffer + strlen(cmd->name) + 1); cmd->func(cliBuffer + strlen(cmd->name) + 1);
else else
cliPrint("Unknown command, try 'help'"); cliPrint("Unknown command, try 'help'");
}
memset(cliBuffer, 0, sizeof(cliBuffer)); memset(cliBuffer, 0, sizeof(cliBuffer));
bufferIndex = 0; bufferIndex = 0;
@ -1204,6 +1206,7 @@ void cliProcess(void)
// 'exit' will reset this flag, so we don't need to print prompt again // 'exit' will reset this flag, so we don't need to print prompt again
if (!cliMode) if (!cliMode)
return; return;
cliPrompt(); cliPrompt();
} else if (c == 127) { } else if (c == 127) {
// backspace // backspace