Added name command to CLI
This commit is contained in:
parent
e4f9118e82
commit
d3cfc5f1cb
|
@ -441,6 +441,7 @@ static void resetConf(void)
|
||||||
featureSet(FEATURE_VBAT);
|
featureSet(FEATURE_VBAT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
masterConfig.version = EEPROM_CONF_VERSION;
|
masterConfig.version = EEPROM_CONF_VERSION;
|
||||||
masterConfig.mixerMode = MIXER_QUADX;
|
masterConfig.mixerMode = MIXER_QUADX;
|
||||||
|
|
||||||
|
@ -657,6 +658,7 @@ static void resetConf(void)
|
||||||
targetConfiguration();
|
targetConfiguration();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// copy first profile into remaining profile
|
// copy first profile into remaining profile
|
||||||
for (int i = 1; i < MAX_PROFILE_COUNT; i++) {
|
for (int i = 1; i < MAX_PROFILE_COUNT; i++) {
|
||||||
memcpy(&masterConfig.profile[i], currentProfile, sizeof(profile_t));
|
memcpy(&masterConfig.profile[i], currentProfile, sizeof(profile_t));
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#endif
|
#endif
|
||||||
#define MAX_RATEPROFILES 3
|
#define MAX_RATEPROFILES 3
|
||||||
#define ONESHOT_FEATURE_CHANGED_DELAY_ON_BOOT_MS 1500
|
#define ONESHOT_FEATURE_CHANGED_DELAY_ON_BOOT_MS 1500
|
||||||
|
#define MAX_NAME_LENGTH 32
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FEATURE_RX_PPM = 1 << 0,
|
FEATURE_RX_PPM = 1 << 0,
|
||||||
|
|
|
@ -161,6 +161,9 @@ typedef struct master_t {
|
||||||
|
|
||||||
uint8_t magic_ef; // magic number, should be 0xEF
|
uint8_t magic_ef; // magic number, should be 0xEF
|
||||||
uint8_t chk; // XOR checksum
|
uint8_t chk; // XOR checksum
|
||||||
|
|
||||||
|
char name[MAX_NAME_LENGTH];
|
||||||
|
|
||||||
} master_t;
|
} master_t;
|
||||||
|
|
||||||
extern master_t masterConfig;
|
extern master_t masterConfig;
|
||||||
|
|
|
@ -119,6 +119,7 @@ void cliDumpRateProfile(uint8_t rateProfileIndex) ;
|
||||||
static void cliExit(char *cmdline);
|
static void cliExit(char *cmdline);
|
||||||
static void cliFeature(char *cmdline);
|
static void cliFeature(char *cmdline);
|
||||||
static void cliMotor(char *cmdline);
|
static void cliMotor(char *cmdline);
|
||||||
|
static void cliName(char *cmdline);
|
||||||
static void cliPlaySound(char *cmdline);
|
static void cliPlaySound(char *cmdline);
|
||||||
static void cliProfile(char *cmdline);
|
static void cliProfile(char *cmdline);
|
||||||
static void cliRateProfile(char *cmdline);
|
static void cliRateProfile(char *cmdline);
|
||||||
|
@ -340,6 +341,7 @@ const clicmd_t cmdTable[] = {
|
||||||
#ifdef VTX
|
#ifdef VTX
|
||||||
CLI_COMMAND_DEF("vtx", "vtx channels on switch", NULL, cliVtx),
|
CLI_COMMAND_DEF("vtx", "vtx channels on switch", NULL, cliVtx),
|
||||||
#endif
|
#endif
|
||||||
|
CLI_COMMAND_DEF("name", "Name of vessel", NULL, cliName),
|
||||||
};
|
};
|
||||||
#define CMD_COUNT (sizeof(cmdTable) / sizeof(clicmd_t))
|
#define CMD_COUNT (sizeof(cmdTable) / sizeof(clicmd_t))
|
||||||
|
|
||||||
|
@ -1953,6 +1955,7 @@ static void cliDump(char *cmdline)
|
||||||
cliPrint("\r\n# version\r\n");
|
cliPrint("\r\n# version\r\n");
|
||||||
cliVersion(NULL);
|
cliVersion(NULL);
|
||||||
|
|
||||||
|
cliName("");
|
||||||
cliPrint("\r\n# dump master\r\n");
|
cliPrint("\r\n# dump master\r\n");
|
||||||
cliPrint("\r\n# mixer\r\n");
|
cliPrint("\r\n# mixer\r\n");
|
||||||
|
|
||||||
|
@ -2494,6 +2497,22 @@ static void cliMotor(char *cmdline)
|
||||||
cliPrintf("motor %d: %d\r\n", motor_index, motor_disarmed[motor_index]);
|
cliPrintf("motor %d: %d\r\n", motor_index, motor_disarmed[motor_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cliName(char *cmdline)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint32_t len = strlen(cmdline);
|
||||||
|
if (isEmpty(cmdline)) {
|
||||||
|
cliPrintf("name %s\r\n", masterConfig.name);
|
||||||
|
} else if (len <= MAX_NAME_LENGTH) {
|
||||||
|
strcpy(masterConfig.name, cmdline);
|
||||||
|
cliPrintf("name %s\r\n", masterConfig.name);
|
||||||
|
} else {
|
||||||
|
cliPrintf("Max allowed name size is %d\r\n", MAX_NAME_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static void cliPlaySound(char *cmdline)
|
static void cliPlaySound(char *cmdline)
|
||||||
{
|
{
|
||||||
#if FLASH_SIZE <= 64
|
#if FLASH_SIZE <= 64
|
||||||
|
|
Loading…
Reference in New Issue