1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00

Added # to versionstring and strip comments

Prepended the version string with a # to avoid the CLI from interpreting
the version string as a command when pasting a dump file back (restore
in CLI).

Strip comments starting with `# comment` from lines. This is to allow
adding comments to CLI dumped backup files. For this i have an automated
addition of comments and/or manual comments by the user in mind.
This commit is contained in:
ProDrone 2015-05-13 21:16:42 +02:00
parent b739a57ea2
commit 1df9097e32

View file

@ -1644,7 +1644,7 @@ static void cliVersion(char *cmdline)
{
UNUSED(cmdline);
printf("Cleanflight/%s %s %s / %s (%s)",
printf("# Cleanflight/%s %s %s / %s (%s)",
targetName,
FC_VERSION_STRING,
buildDate,
@ -1710,6 +1710,13 @@ void cliProcess(void)
clicmd_t target;
cliPrint("\r\n");
// Strip comment starting with # from line
char *p = cliBuffer;
p = strchr(++p, '#');
if (NULL != p) {
bufferIndex = (uint32_t)(p - cliBuffer);
}
// Strip trailing whitespace
while (bufferIndex > 0 && cliBuffer[bufferIndex - 1] == ' ') {
bufferIndex--;