device configuration prepared

This commit is contained in:
2020-11-30 18:48:48 +01:00
parent f22c821ca3
commit 98c0a9d7a2
3 changed files with 39 additions and 9 deletions

View File

@ -4,6 +4,8 @@
#include <config.h>
#include <eeprom.h>
#include <logger.h>
#include <mbusComm.h>
t_configBlock defaultConfigBlock = {
.configMagic = CONFIG_MAGIC,
@ -85,13 +87,18 @@ void configInit() {
for (uint8_t i = 0; i < mainConfigBlock.numOfDeviceBlocks; i++) {
t_deviceBlock tmpDeviceBlock;
eepromReadDeviceBlock(i, &tmpDeviceBlock);
coloredMsg(LOG_BLUE, false, "cfg ci device %d: ", i);
coloredMsg(LOG_BLUE, false, " Name: %s, Address: %d, Period: %d",
tmpDeviceBlock.deviceName, tmpDeviceBlock.address, tmpDeviceBlock.period);
coloredMsg(LOG_BLUE, false, " Considered Fields: %d %d %d %d",
tmpDeviceBlock.consideredField[0],
tmpDeviceBlock.consideredField[1],
tmpDeviceBlock.consideredField[2],
tmpDeviceBlock.consideredField[3]);
if (tmpDeviceBlock.deviceMagic == DEVICE_MAGIC) {
coloredMsg(LOG_BLUE, false, "cfg ci device %d: ", i);
coloredMsg(LOG_BLUE, false, " Name: %s, Address: %d, Period: %d",
tmpDeviceBlock.deviceName, tmpDeviceBlock.address, tmpDeviceBlock.period);
coloredMsg(LOG_BLUE, false, " Considered Fields: %d %d %d %d",
tmpDeviceBlock.consideredField[0],
tmpDeviceBlock.consideredField[1],
tmpDeviceBlock.consideredField[2],
tmpDeviceBlock.consideredField[3]);
mbusCommAddDevice(&tmpDeviceBlock);
} else {
coloredMsg(LOG_BLUE, false, " magic does not match, ignored");
}
}
}