mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-02-10 18:31:01 +00:00
Some changes after testing
This commit is contained in:
@@ -441,6 +441,15 @@ bool AmsConfiguration::getEntsoeConfig(EntsoeConfig& config) {
|
||||
}
|
||||
|
||||
bool AmsConfiguration::setEntsoeConfig(EntsoeConfig& config) {
|
||||
EntsoeConfig existing;
|
||||
if(getEntsoeConfig(existing)) {
|
||||
entsoeChanged |= strcmp(config.token, existing.token) != 0;
|
||||
entsoeChanged |= strcmp(config.area, existing.area) != 0;
|
||||
entsoeChanged |= strcmp(config.currency, existing.currency) != 0;
|
||||
entsoeChanged |= config.multiplier != existing.multiplier;
|
||||
} else {
|
||||
entsoeChanged = true;
|
||||
}
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
EEPROM.put(CONFIG_ENTSOE_START, config);
|
||||
bool ret = EEPROM.commit();
|
||||
@@ -448,6 +457,21 @@ bool AmsConfiguration::setEntsoeConfig(EntsoeConfig& config) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AmsConfiguration::clearEntsoe(EntsoeConfig& config) {
|
||||
strcpy(config.token, "");
|
||||
strcpy(config.area, "");
|
||||
strcpy(config.currency, "");
|
||||
config.multiplier = 1000;
|
||||
}
|
||||
|
||||
bool AmsConfiguration::isEntsoeChanged() {
|
||||
return entsoeChanged;
|
||||
}
|
||||
|
||||
void AmsConfiguration::ackEntsoeChange() {
|
||||
entsoeChanged = false;
|
||||
}
|
||||
|
||||
void AmsConfiguration::clear() {
|
||||
MeterConfig meter;
|
||||
clearMeter(meter);
|
||||
@@ -473,6 +497,10 @@ void AmsConfiguration::clear() {
|
||||
clearNtp(ntp);
|
||||
setNtpConfig(ntp);
|
||||
|
||||
EntsoeConfig entsoe;
|
||||
clearEntsoe(entsoe);
|
||||
setEntsoeConfig(entsoe);
|
||||
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
EEPROM.put(EEPROM_CONFIG_ADDRESS, -1);
|
||||
EEPROM.commit();
|
||||
|
||||
Reference in New Issue
Block a user