This commit is contained in:
2020-12-11 12:45:06 +01:00
parent 8843791fc9
commit 36becf0e5c

View File

@ -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 {