Merge pull request #762 from blckmn/craft_name
Minor updates to naming the craft
This commit is contained in:
commit
3762238540
|
@ -1140,6 +1140,7 @@ static bool blackboxWriteSysinfo()
|
|||
BLACKBOX_PRINT_HEADER_LINE("Firmware type:%s", "Cleanflight");
|
||||
BLACKBOX_PRINT_HEADER_LINE("Firmware revision:Betaflight %s (%s) %s", FC_VERSION_STRING, shortGitRevision, targetName);
|
||||
BLACKBOX_PRINT_HEADER_LINE("Firmware date:%s %s", buildDate, buildTime);
|
||||
BLACKBOX_PRINT_HEADER_LINE("Craft name:%s", masterConfig.name);
|
||||
BLACKBOX_PRINT_HEADER_LINE("P interval:%d/%d", masterConfig.blackbox_rate_num, masterConfig.blackbox_rate_denom);
|
||||
BLACKBOX_PRINT_HEADER_LINE("minthrottle:%d", masterConfig.escAndServoConfig.minthrottle);
|
||||
BLACKBOX_PRINT_HEADER_LINE("maxthrottle:%d", masterConfig.escAndServoConfig.maxthrottle);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1878,13 +1878,10 @@ static bool processInCommand(void)
|
|||
break;
|
||||
|
||||
case MSP_SET_NAME:
|
||||
memset(masterConfig.name, 0, MAX_NAME_LENGTH+1);
|
||||
memset(masterConfig.name, 0, ARRAYLEN(masterConfig.name));
|
||||
for (i = 0; i < MIN(MAX_NAME_LENGTH, currentPort->dataSize); i++) {
|
||||
masterConfig.name[i] = read8();
|
||||
}
|
||||
if (masterConfig.name[0] == '-') {
|
||||
memset(masterConfig.name, '\0', MAX_NAME_LENGTH);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// we do not know how to handle the (valid) message, indicate error MSP $M!
|
||||
|
|
Loading…
Reference in New Issue