This commit is contained in:
Wolfgang Hottgenroth 2021-02-08 11:38:56 +01:00
parent f990625a91
commit 3e82defcef
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
2 changed files with 45 additions and 1 deletions

View File

@ -24,6 +24,10 @@ static bool showConfigCmd(uint8_t argc, char **args) {
configBlock.macAddress[3], configBlock.macAddress[3],
configBlock.macAddress[4], configBlock.macAddress[4],
configBlock.macAddress[5]); configBlock.macAddress[5]);
sendFormatString("NTP Server: %s\n\r", configBlock.ntpServer);
sendFormatString("deviceId: %s\n\r", configBlock.deviceId);
sendFormatString("sharedSecret: (will not be displayed)\n\r");
sendFormatString("Location: %s\n\r", configBlock.location);
return retCode; return retCode;
} }
@ -80,6 +84,30 @@ static bool setDeviceNameCmd(uint8_t argc, char **args) {
sizeof(((t_configBlock*)0)->deviceName)); sizeof(((t_configBlock*)0)->deviceName));
} }
static bool setNtpServerCmd(uint8_t argc, char **args) {
return setStringParameterCmd(argc, args,
offsetof(t_configBlock, ntpServer),
sizeof(((t_configBlock*)0)->ntpServer));
}
static bool setDeviceIdCmd(uint8_t argc, char **args) {
return setStringParameterCmd(argc, args,
offsetof(t_configBlock, deviceId),
sizeof(((t_configBlock*)0)->deviceId));
}
static bool setSharedSecretCmd(uint8_t argc, char **args) {
return setStringParameterCmd(argc, args,
offsetof(t_configBlock, sharedSecret),
sizeof(((t_configBlock*)0)->sharedSecret));
}
static bool setLocationCmd(uint8_t argc, char **args) {
return setStringParameterCmd(argc, args,
offsetof(t_configBlock, location),
sizeof(((t_configBlock*)0)->location));
}
@ -88,6 +116,22 @@ const static cmd_t SET_COMMANDS[] = {
.help = \ .help = \
"devicename ........................... Name of this device\n\r" "devicename ........................... Name of this device\n\r"
}, },
{ .name = "ntp server", .cmdFunc = setNtpServerCmd,
.help = \
"ntp server ........................... Name of the NTP server\n\r"
},
{ .name = "deviceid", .cmdFunc = setDeviceIdCmd,
.help = \
"deviceid ............................. ID of this device\n\r"
},
{ .name = "sharedSecret", .cmdFunc = setSharedSecretCmd,
.help = \
"sharedsecret ......................... Shared secret\n\r"
},
{ .name = "location", .cmdFunc = setLocationCmd,
.help = \
"location ............................. Location of this device\n\r"
},
{ .name = "END_OF_CMDS", .help = "",.cmdFunc = NULL } { .name = "END_OF_CMDS", .help = "",.cmdFunc = NULL }
}; };

View File

@ -40,7 +40,7 @@ void my_setup_2() {
wizInit(); wizInit();
// cmdHandlerInit(); cmdHandlerInit();
counterInit(); counterInit();