listDevices
This commit is contained in:
parent
3bd5e59786
commit
560b08e56c
@ -261,6 +261,24 @@ static bool changeDeviceCmd(uint8_t argc, char **args) {
|
||||
return retCode;
|
||||
}
|
||||
|
||||
static bool listDevicesCmd(uint8_t argc, char **args) {
|
||||
for (uint8_t i = 0; i < getConfig()->numOfDeviceBlocks; i++) {
|
||||
t_deviceBlock deviceBlock;
|
||||
eepromReadDeviceBlock(i, &deviceBlock);
|
||||
sendFormatString(" Index: %d\n\r", i);
|
||||
sendFormatString(" Name: %s, Address: %d, Period: %d\n\r",
|
||||
deviceBlock.deviceName, deviceBlock.address, deviceBlock.period);
|
||||
for (uint8_t i = 0; i < MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS; i++) {
|
||||
sendFormatString(" Considered field: %d\n\r", deviceBlock.consideredField[i]);
|
||||
}
|
||||
if (deviceBlock.period == 0) {
|
||||
sendString(" Device is marked as inactive\n\r");
|
||||
} else if (deviceBlock.period == -1) {
|
||||
sendString(" Device is marked as deleted\n\r");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const static cmd_t SET_COMMANDS[] = {
|
||||
@ -371,6 +389,10 @@ const cmd_t CONFIG_COMMANDS[] = {
|
||||
.help = \
|
||||
"changeDevice ......................... Change a new device by index\n\r"
|
||||
},
|
||||
{ .name = "listDevices", .cmdFunc = listDevicesCmd,
|
||||
.help = \
|
||||
"listDevices .......................... List the configured devices\n\r"
|
||||
},
|
||||
{ .name = "restart", .cmdFunc = restartCmd,
|
||||
.help = \
|
||||
"restart .............................. Restart the system,\n\r" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user