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

Minor updates to naming the craft

This commit is contained in:
blckmn 2016-07-16 12:38:06 +10:00
parent 2fb3ee0192
commit d65f7a0383
3 changed files with 5 additions and 13 deletions

View file

@ -2500,18 +2500,12 @@ static void cliMotor(char *cmdline)
static void cliName(char *cmdline)
{
uint32_t len = strlen(cmdline);
if (len == 0) {
cliPrintf("name %s\r\n", masterConfig.name);
} else if ('-' == cmdline[0]) {
memset(masterConfig.name, '\0', MAX_NAME_LENGTH);
cliPrintf("name removed\r\n");
} else {
memset(masterConfig.name, '\0', MAX_NAME_LENGTH);
if (len > 0) {
memset(masterConfig.name, 0, ARRAYLEN(masterConfig.name));
strncpy(masterConfig.name, cmdline, MIN(len, MAX_NAME_LENGTH));
cliPrintf("name %s\r\n", masterConfig.name);
}
cliPrintf("name %s\r\n", strlen(masterConfig.name) > 0 ? masterConfig.name : "-");
return;
}