More v2.2

This commit is contained in:
Gunnar Skjold
2022-11-25 19:18:32 +01:00
parent d4d9d2224f
commit 2dcc874592
47 changed files with 2205 additions and 746 deletions

View File

@@ -261,8 +261,8 @@ float EnergyAccounting::getMonthMax() {
return maxHour > 0 ? maxHour / count / 100.0 : 0.0;
}
float EnergyAccounting::getPeak(uint8_t num) {
if(num < 1 || num > 5) return 0.0;
EnergyAccountingPeak EnergyAccounting::getPeak(uint8_t num) {
if(num < 1 || num > 5) return EnergyAccountingPeak({0,0});
uint8_t count = 0;
bool included[5] = { false, false, false, false, false };
@@ -288,10 +288,10 @@ float EnergyAccounting::getPeak(uint8_t num) {
if(!included[i]) continue;
pos++;
if(pos == num) {
return data.peaks[i].value / 100.0;
return data.peaks[i];
}
}
return 0.0;
return EnergyAccountingPeak({0,0});
}
bool EnergyAccounting::load() {