device configuration prepared
This commit is contained in:
parent
b4170ec6dc
commit
77141319ea
@ -5,7 +5,7 @@
|
|||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define CONFIG_MAGIC 0xdead0007
|
#define CONFIG_MAGIC 0xdead0008
|
||||||
#define DEVICE_MAGIC 0xaffe0000
|
#define DEVICE_MAGIC 0xaffe0000
|
||||||
|
|
||||||
typedef struct __attribute__((__packed__)) s_configBlock {
|
typedef struct __attribute__((__packed__)) s_configBlock {
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define NUM_OF_DEFAULT_DEVICES 8
|
||||||
t_deviceBlock defaultDeviceBlock[] = {
|
t_deviceBlock defaultDeviceBlock[] = {
|
||||||
{
|
{
|
||||||
.deviceMagic = DEVICE_MAGIC,
|
.deviceMagic = DEVICE_MAGIC,
|
||||||
@ -87,7 +88,7 @@ t_configBlock defaultConfigBlock = {
|
|||||||
.statusTopic = "IoT/MBGW3/Status",
|
.statusTopic = "IoT/MBGW3/Status",
|
||||||
.mbusDataTopic = "IoT/MBGW3/Measurement",
|
.mbusDataTopic = "IoT/MBGW3/Measurement",
|
||||||
.syslogServerName = "syslogserver",
|
.syslogServerName = "syslogserver",
|
||||||
.numOfDeviceBlocks = sizeof(defaultConfigBlock) / sizeof(t_deviceBlock),
|
.numOfDeviceBlocks = NUM_OF_DEFAULT_DEVICES,
|
||||||
.filler = { 0 }
|
.filler = { 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ void configInit() {
|
|||||||
eepromWriteConfigBlock(&defaultConfigBlock);
|
eepromWriteConfigBlock(&defaultConfigBlock);
|
||||||
coloredMsg(LOG_BLUE, false, "cfg ci Default configuration block written to eeprom");
|
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]);
|
eepromWriteDeviceBlock(i, &defaultDeviceBlock[i]);
|
||||||
}
|
}
|
||||||
coloredMsg(LOG_BLUE, false, "cfg ci Default device blocks written to eeprom");
|
coloredMsg(LOG_BLUE, false, "cfg ci Default device blocks written to eeprom");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user