incomplete change
This commit is contained in:
parent
66395f4d15
commit
2ee6360820
@ -52,25 +52,31 @@ static bool showConfigCmd(uint8_t argc, char **args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool setDeviceNameCmd(uint8_t argc, char **args) {
|
static bool setDeviceNameCmd(uint8_t argc, char **args) {
|
||||||
|
return setStringParameterCmd(argc, args, )
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool setStringParameterCmd(uint8_t argc, char **args) {
|
||||||
bool retCode = true;
|
bool retCode = true;
|
||||||
|
|
||||||
t_configBlock configBlock;
|
t_configBlock configBlock;
|
||||||
char *newDeviceName = args[2];
|
char *parameterName = args[1];
|
||||||
if (strlen(newDeviceName) >= sizeof(configBlock.deviceName)) {
|
char *newParameterValue = args[2];
|
||||||
sendString("given new device name is too long\n\r");
|
if (strlen(newParameterValue) >= sizeof(configBlock.deviceName)) {
|
||||||
|
sendFormatString("given new value for %s is too long\n\r", parameterMeter);
|
||||||
retCode = false;
|
retCode = false;
|
||||||
} else {
|
} else {
|
||||||
sendFormatString("set device name to %s\n\r", newDeviceName);
|
sendFormatString("set %s to %s\n\r", parameterName, newParameterValue);
|
||||||
|
|
||||||
eepromReadConfigBlock(&configBlock);
|
eepromReadConfigBlock(&configBlock);
|
||||||
strcpy(configBlock.deviceName, newDeviceName);
|
strcpy(configBlock.deviceName, newParameterValue);
|
||||||
eepromWriteConfigBlock(&configBlock);
|
eepromWriteConfigBlock(&configBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retCode;
|
return retCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const static cmd_t SET_COMMANDS[] = {
|
const static cmd_t SET_COMMANDS[] = {
|
||||||
{ .name = "devicename", .cmdFunc = setDeviceNameCmd,
|
{ .name = "devicename", .cmdFunc = setDeviceNameCmd,
|
||||||
.help = \
|
.help = \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user