|
|
@@ -14,16 +14,14 @@ namespace config { |
|
|
|
|
|
|
|
void read() {
|
|
|
|
#define CURRENT_LOGGER_FUNCTION "read"
|
|
|
|
VERBOSE;
|
|
|
|
NOTICE;
|
|
|
|
|
|
|
|
hardware::i2c::powerOn();
|
|
|
|
hardware::i2c::eeprom.readBlock(CONFIG_ADDR, value);
|
|
|
|
if (CONFIG_SEED != value.seed) reset(); //todo : reset network if seed for network is not right
|
|
|
|
hardware::i2c::powerOff();
|
|
|
|
|
|
|
|
NOTICE_FORMAT("%d, %s, %d, %d, %d, %d, %d, %B, %s", value.seed, value.version, value.firstEntry, value.lastEntry, value.alertBatteryLevel1, value.alertBatteryLevel2, value.alertBatteryLevelClear, value.activeAlerts, value.contactPhone);
|
|
|
|
#if BACKUP_ENABLE_NETWORK
|
|
|
|
NOTICE_FORMAT("%d, %d, %s, %s", value.network.saveThreshold, value.network.lastSavedEntry, value.network.apn, value.network.url);
|
|
|
|
//networkConfig_t c = {
|
|
|
|
// POSITIONS_CONFIG_NET_DEFAULT_SAVE_THRESHOLD,
|
|
|
|
// 0xFFFF,
|
|
|
@@ -42,11 +40,9 @@ namespace config { |
|
|
|
|
|
|
|
void write() {
|
|
|
|
#define CURRENT_LOGGER_FUNCTION "write"
|
|
|
|
NOTICE;
|
|
|
|
|
|
|
|
NOTICE_FORMAT("%d, %s, %d, %d, %d, %d, %d, %B, %s", value.seed, value.version, value.firstEntry, value.lastEntry, value.alertBatteryLevel1, value.alertBatteryLevel2, value.alertBatteryLevelClear, value.activeAlerts, value.contactPhone);
|
|
|
|
#if BACKUP_ENABLE_NETWORK
|
|
|
|
NOTICE_FORMAT("%d, %d, %s, %s", value.network.saveThreshold, value.network.lastSavedEntry, value.network.apn, value.network.url);
|
|
|
|
#endif
|
|
|
|
print();
|
|
|
|
hardware::i2c::powerOn();
|
|
|
|
int written = hardware::i2c::eeprom.writeBlock(CONFIG_ADDR, value);
|
|
|
|
hardware::i2c::powerOff();
|
|
|
@@ -91,5 +87,14 @@ namespace config { |
|
|
|
save();
|
|
|
|
}
|
|
|
|
|
|
|
|
void print() {
|
|
|
|
#define CURRENT_LOGGER_FUNCTION "print"
|
|
|
|
|
|
|
|
NOTICE_FORMAT("%d, %s, %d, %d, %d, %d, %d, %B, %s", value.seed, value.version, value.firstEntry, value.lastEntry, value.alertBatteryLevel1, value.alertBatteryLevel2, value.alertBatteryLevelClear, value.activeAlerts, value.contactPhone);
|
|
|
|
#if BACKUP_ENABLE_NETWORK
|
|
|
|
NOTICE_FORMAT("%d, %d, %s, %s", value.network.saveThreshold, value.network.lastSavedEntry, value.network.apn, value.network.url);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} |