Fix energy total non-monotonicity. (#24184)

This commit is contained in:
AndrolGenhald 2025-12-02 02:09:38 -06:00 committed by GitHub
parent 7036057dd0
commit f216590a78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -422,9 +422,9 @@ void Energy200ms(void) {
Settings->energy_kWhexport_ph[i] = RtcSettings.energy_kWhexport_ph[i]; Settings->energy_kWhexport_ph[i] = RtcSettings.energy_kWhexport_ph[i];
Energy->period[i] -= RtcSettings.energy_kWhtoday_ph[i]; // this becomes a large unsigned, effectively a negative for EnergyShow calculation Energy->period[i] -= RtcSettings.energy_kWhtoday_ph[i]; // this becomes a large unsigned, effectively a negative for EnergyShow calculation
Energy->kWhtoday[i] = 0; Energy->kWhtoday[i] = Energy->kWhtoday[i] % 100; // Roll fractional watt-hours into the next day since kWhtotal truncates to watt-hours.
Energy->kWhtoday_offset[i] = 0; Energy->kWhtoday_offset[i] = 0;
RtcSettings.energy_kWhtoday_ph[i] = 0; RtcSettings.energy_kWhtoday_ph[i] = Energy->kWhtoday[i];
Settings->energy_kWhtoday_ph[i] = 0; Settings->energy_kWhtoday_ph[i] = 0;
Energy->start_energy[i] = 0; Energy->start_energy[i] = 0;