@@ -19,6 +19,7 @@ namespace config { | |||||
hardware::i2c::powerOn(); | hardware::i2c::powerOn(); | ||||
hardware::i2c::eeprom.readBlock(CONFIG_ADDR, value); | hardware::i2c::eeprom.readBlock(CONFIG_ADDR, value); | ||||
print(); | |||||
if (CONFIG_SEED != value.seed) reset(); //todo : reset network if seed for network is not right | if (CONFIG_SEED != value.seed) reset(); //todo : reset network if seed for network is not right | ||||
hardware::i2c::powerOff(); | hardware::i2c::powerOff(); | ||||
@@ -42,7 +42,7 @@ namespace mainunit { | |||||
void deepSleep(uint16_t seconds) { | void deepSleep(uint16_t seconds) { | ||||
#define CURRENT_LOGGER_FUNCTION "deepSleep" | #define CURRENT_LOGGER_FUNCTION "deepSleep" | ||||
NOTICE_FORMAT("%d seconds", seconds); | |||||
NOTICE_FORMAT("%ds", seconds); | |||||
interruptIn(seconds); | interruptIn(seconds); | ||||
details::prepareSleep(); | details::prepareSleep(); | ||||
@@ -112,12 +112,12 @@ namespace positions { | |||||
entryIndex = config->lastEntry + 1; | entryIndex = config->lastEntry + 1; | ||||
entryAddress = details::getEntryAddress(entryIndex); | entryAddress = details::getEntryAddress(entryIndex); | ||||
print(entryIndex, entry); | |||||
hardware::i2c::powerOn(); | hardware::i2c::powerOn(); | ||||
hardware::i2c::eeprom.writeBlock(entryAddress, entry); | hardware::i2c::eeprom.writeBlock(entryAddress, entry); | ||||
NOTICE_MSG("Saved"); | NOTICE_MSG("Saved"); | ||||
print(entryIndex, entry); | |||||
config->lastEntry++; | config->lastEntry++; | ||||
if (config->lastEntry > details::maxEntryIndex) config->lastEntry = 0; | if (config->lastEntry > details::maxEntryIndex) config->lastEntry = 0; | ||||