configuration
This commit is contained in:
parent
f409d3fb22
commit
d2c5943014
@ -1,4 +1,5 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <eeprom.h>
|
#include <eeprom.h>
|
||||||
@ -29,13 +30,18 @@ t_configBlock* getConfig() {
|
|||||||
|
|
||||||
|
|
||||||
void configInit() {
|
void configInit() {
|
||||||
|
bool configIsInvalid = false;
|
||||||
|
do {
|
||||||
coloredMsg(LOG_BLUE, false, "cfg ci Reading configuration block from eeprom");
|
coloredMsg(LOG_BLUE, false, "cfg ci Reading configuration block from eeprom");
|
||||||
eepromReadConfigBlock(0, &mainConfigBlock);
|
eepromReadConfigBlock(0, &mainConfigBlock);
|
||||||
|
|
||||||
if (mainConfigBlock.configMagic != CONFIG_MAGIC) {
|
if (mainConfigBlock.configMagic != CONFIG_MAGIC) {
|
||||||
|
configIsValid = true;
|
||||||
|
|
||||||
coloredMsg(LOG_BLUE, false, "cfg ci Invalid configuration block read from eeprom");
|
coloredMsg(LOG_BLUE, false, "cfg ci Invalid configuration block read from eeprom");
|
||||||
|
|
||||||
eepromWriteConfigBlock(0, &defaultConfigBlock);
|
eepromWriteConfigBlock(0, &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");
|
||||||
}
|
}
|
||||||
|
} while (configIsInvalid);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user