fix
This commit is contained in:
@ -55,14 +55,14 @@ static bool showConfigCmd(uint8_t argc, char **args) {
|
|||||||
static bool setDeviceNameCmd(uint8_t argc, char **args) {
|
static bool setDeviceNameCmd(uint8_t argc, char **args) {
|
||||||
bool retCode = true;
|
bool retCode = true;
|
||||||
|
|
||||||
|
t_configBlock configBlock;
|
||||||
char *newDeviceName = args[2];
|
char *newDeviceName = args[2];
|
||||||
if (strlen(newDeviceName) >= sizeof(t_configBlock.deviceName)) {
|
if (strlen(newDeviceName) >= sizeof(configBlock.deviceName)) {
|
||||||
sendString("given new device name is too long\n\r");
|
sendString("given new device name is too long\n\r");
|
||||||
retCode = false;
|
retCode = false;
|
||||||
} else {
|
} else {
|
||||||
sendFormatString("set device name to %s\n\r", newDeviceName);
|
sendFormatString("set device name to %s\n\r", newDeviceName);
|
||||||
|
|
||||||
t_configBlock configBlock;
|
|
||||||
eepromReadConfigBlock(&configBlock);
|
eepromReadConfigBlock(&configBlock);
|
||||||
strcpy(configBlock.deviceName, newDeviceName);
|
strcpy(configBlock.deviceName, newDeviceName);
|
||||||
eepromWriteConfigBlock(&configBlock);
|
eepromWriteConfigBlock(&configBlock);
|
||||||
@ -71,21 +71,24 @@ static bool setDeviceNameCmd(uint8_t argc, char **args) {
|
|||||||
return retCode;
|
return retCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmd_t SET_COMMANDS[] = {
|
const static cmd_t SET_COMMANDS[] = {
|
||||||
{ .name = "devicename", .cmdFunc = setDeviceNameCmd,
|
{ .name = "devicename", .cmdFunc = setDeviceNameCmd,
|
||||||
.help = \
|
.help = \
|
||||||
"devicename ........................... Name of this device\n\r"
|
"devicename ........................... Name of this device\n\r"
|
||||||
},
|
},
|
||||||
{ .name = "END_OF_CMDS", .help = "",.cmdFunc = NULL }
|
{ .name = "END_OF_CMDS", .help = "",.cmdFunc = NULL }
|
||||||
};
|
};
|
||||||
const char[] UNKNOWN_PARAMETER = "unknown parameter";
|
const static char UNKNOWN_PARAMETER[] = "unknown parameter";
|
||||||
|
const static char OK_MSG[] = "OK\n\r";
|
||||||
|
const static char FAILED_MSG[] = "Failed\n\r";
|
||||||
|
|
||||||
static bool setCmd(uint8_t argc, char **args) {
|
static bool setCmd(uint8_t argc, char **args) {
|
||||||
bool retCode = false;
|
bool retCode = false;
|
||||||
uint8_t *messageToSend = NULL;
|
uint8_t *messageToSend = NULL;
|
||||||
|
|
||||||
|
char *cmd = args[1];
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
if (0 == strcmp("?", args[1])) {
|
if (0 == strcmp("?", cmd)) {
|
||||||
sendString("You can set the following parameters:\n\r");
|
sendString("You can set the following parameters:\n\r");
|
||||||
retCode = true;
|
retCode = true;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user