device configuration prepared

This commit is contained in:
Wolfgang Hottgenroth 2020-11-30 19:01:53 +01:00
parent b4170ec6dc
commit 77141319ea
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
2 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@
#include <spi.h>
#include <assert.h>
#define CONFIG_MAGIC 0xdead0007
#define CONFIG_MAGIC 0xdead0008
#define DEVICE_MAGIC 0xaffe0000
typedef struct __attribute__((__packed__)) s_configBlock {

View File

@ -8,6 +8,7 @@
#define NUM_OF_DEFAULT_DEVICES 8
t_deviceBlock defaultDeviceBlock[] = {
{
.deviceMagic = DEVICE_MAGIC,
@ -87,7 +88,7 @@ t_configBlock defaultConfigBlock = {
.statusTopic = "IoT/MBGW3/Status",
.mbusDataTopic = "IoT/MBGW3/Measurement",
.syslogServerName = "syslogserver",
.numOfDeviceBlocks = sizeof(defaultConfigBlock) / sizeof(t_deviceBlock),
.numOfDeviceBlocks = NUM_OF_DEFAULT_DEVICES,
.filler = { 0 }
};
@ -112,7 +113,7 @@ void configInit() {
eepromWriteConfigBlock(&defaultConfigBlock);
coloredMsg(LOG_BLUE, false, "cfg ci Default configuration block written to eeprom");
for (uint8_t i = 0; i < sizeof(defaultConfigBlock) / sizeof(t_deviceBlock); i++) {
for (uint8_t i = 0; i < NUM_OF_DEFAULT_DEVICES; i++) {
eepromWriteDeviceBlock(i, &defaultDeviceBlock[i]);
}
coloredMsg(LOG_BLUE, false, "cfg ci Default device blocks written to eeprom");