Max hour average from more than one hour. Plus a fix for real time cost calculation

This commit is contained in:
Gunnar Skjold
2022-07-05 20:34:48 +02:00
parent aaa318e511
commit 32ba6c31f0
8 changed files with 181 additions and 53 deletions

View File

@@ -657,6 +657,14 @@ bool AmsConfiguration::hasConfig() {
configVersion = 0;
return false;
}
case 94:
configVersion = -1; // Prevent loop
if(relocateConfig94()) {
configVersion = 95;
} else {
configVersion = 0;
return false;
}
case EEPROM_CHECK_SUM:
return true;
default:
@@ -822,6 +830,18 @@ bool AmsConfiguration::relocateConfig93() {
return ret;
}
bool AmsConfiguration::relocateConfig94() {
EnergyAccountingConfig eac;
EEPROM.begin(EEPROM_SIZE);
EEPROM.get(CONFIG_ENERGYACCOUNTING_START, eac);
eac.hours = 1;
EEPROM.put(CONFIG_ENERGYACCOUNTING_START, eac);
EEPROM.put(EEPROM_CONFIG_ADDRESS, 95);
bool ret = EEPROM.commit();
EEPROM.end();
return ret;
}
bool AmsConfiguration::save() {
EEPROM.begin(EEPROM_SIZE);
EEPROM.put(EEPROM_CONFIG_ADDRESS, EEPROM_CHECK_SUM);