device configuration prepared

This commit is contained in:
Wolfgang Hottgenroth 2020-12-01 12:05:35 +01:00
parent 78d32a7cc9
commit 24f2d0a01d
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -14,7 +14,8 @@
#include <wizHelper.h>
#include <mbusComm.h>
#include <loopCtrl.h>
#include <config.h>
#include <eeprom.h>
extern const uint8_t CMD_SOCK;
@ -122,7 +123,42 @@ static bool loopEnableCmd(uint8_t argc, char **args) {
static bool showConfigCmd(uint8_t argc, char **args) {
bool retCode = true;
sendString("This is the configuration output");
t_configBlock configBlock;
eepromReadConfigBlock(&configBlock);
sendFormatString("configMagic: %lx\n\r", configBlock.configMagic);
sendFormatString("deviceName: %s\n\r", configBlock.deviceName);
sendFormatString("MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n\r", configBlock.macAddress[0],
configBlock.macAddress[1],
configBlock.macAddress[2],
configBlock.macAddress[3],
configBlock.macAddress[4],
configBlock.macAddress[5]);
sendFormatString("frontend threshold: %ld\n\r", configBlock.frontendThreshold);
sendFormatString("broker: %s\n\r", configBlock.brokerName);
sendFormatString("watchdogTopic: %s\n\r", configBlock.watchdogTopic);
sendFormatString("startupTopic: %s\n\r", configBlock.startupTopic);
sendFormatString("statusTopic: %s\n\r", configBlock.statusTopic);
sendFormatString("mbusDataTopic: %s\n\r", configBlock.mbusDataTopic);
sendFormatString("syslog server: %s\n\r", configBlock.syslogServerName);
sendFormatString("device block cnt: %d\n\r", configBlock.numOfDeviceBlocks);
for (uint8_t i = 0; i < configBlock.numOfDeviceBlocks; i++) {
t_deviceBlock tmpDeviceBlock;
eepromReadDeviceBlock(i, &tmpDeviceBlock);
if (tmpDeviceBlock.deviceMagic == DEVICE_MAGIC) {
sendFormatString("device %d: \n\r", i);
sendFormatString(" Name: %s, Address: %d, Period: %d\n\r",
tmpDeviceBlock.deviceName, tmpDeviceBlock.address, tmpDeviceBlock.period);
sendFormatString(" Considered Fields: %d %d %d %d\n\r",
tmpDeviceBlock.consideredField[0],
tmpDeviceBlock.consideredField[1],
tmpDeviceBlock.consideredField[2],
tmpDeviceBlock.consideredField[3]);
if (tmpDeviceBlock.deviceMagic != DEVICE_MAGIC) {
sendString(" DEVICE MAGIC DOES NOT MATCH\n\r");
}
}
}
return retCode;
}