diff --git a/cube/User/Src/configCmds.c b/cube/User/Src/configCmds.c index 08fa8b7..e2e15cd 100644 --- a/cube/User/Src/configCmds.c +++ b/cube/User/Src/configCmds.c @@ -55,14 +55,14 @@ static bool showConfigCmd(uint8_t argc, char **args) { static bool setDeviceNameCmd(uint8_t argc, char **args) { bool retCode = true; + t_configBlock configBlock; 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"); retCode = false; } else { sendFormatString("set device name to %s\n\r", newDeviceName); - t_configBlock configBlock; eepromReadConfigBlock(&configBlock); strcpy(configBlock.deviceName, newDeviceName); eepromWriteConfigBlock(&configBlock); @@ -71,21 +71,24 @@ static bool setDeviceNameCmd(uint8_t argc, char **args) { return retCode; } -const cmd_t SET_COMMANDS[] = { +const static cmd_t SET_COMMANDS[] = { { .name = "devicename", .cmdFunc = setDeviceNameCmd, .help = \ "devicename ........................... Name of this device\n\r" }, { .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) { bool retCode = false; uint8_t *messageToSend = NULL; + char *cmd = args[1]; if (argc >= 2) { - if (0 == strcmp("?", args[1])) { + if (0 == strcmp("?", cmd)) { sendString("You can set the following parameters:\n\r"); retCode = true; } else {