mirror of https://github.com/arendst/Tasmota.git
Fix initial ESP32 Energy kWh total time
This commit is contained in:
parent
bf2982854b
commit
07b7a7ee9a
|
@ -131,6 +131,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
|||
|
||||
### Breaking Changed
|
||||
- Change command ``FileUpload`` index binary data detection from >199 to >299
|
||||
- Matter relay number starts at 1 instead of 0 to match Tasmota numbering
|
||||
|
||||
### Changed
|
||||
- AdafruitFingerprint library from v2.0.4 to v2.1.0
|
||||
|
|
|
@ -442,17 +442,15 @@ void RtcSecond(void) {
|
|||
last_sync = Rtc.utc_time;
|
||||
}
|
||||
|
||||
Rtc.local_time = Rtc.utc_time;
|
||||
if (Rtc.local_time > START_VALID_TIME) { // 2016-01-01
|
||||
if (Rtc.utc_time > START_VALID_TIME) { // 2016-01-01
|
||||
Rtc.time_timezone = RtcTimeZoneOffset(Rtc.utc_time);
|
||||
Rtc.local_time += Rtc.time_timezone;
|
||||
Rtc.local_time = Rtc.utc_time + Rtc.time_timezone;
|
||||
Rtc.time_timezone /= 60;
|
||||
if (!Settings->energy_kWhtotal_time) {
|
||||
Settings->energy_kWhtotal_time = Rtc.local_time;
|
||||
}
|
||||
if (Settings->bootcount_reset_time < START_VALID_TIME) {
|
||||
Settings->bootcount_reset_time = Rtc.local_time;
|
||||
}
|
||||
} else {
|
||||
Rtc.local_time = Rtc.utc_time;
|
||||
}
|
||||
|
||||
BreakNanoTime(Rtc.local_time, Rtc.nanos, RtcTime);
|
||||
|
|
|
@ -389,6 +389,9 @@ void Energy200ms(void) {
|
|||
XnrgCall(FUNC_ENERGY_EVERY_SECOND);
|
||||
|
||||
if (RtcTime.valid) {
|
||||
if (!Settings->energy_kWhtotal_time) {
|
||||
Settings->energy_kWhtotal_time = LocalTime();
|
||||
}
|
||||
|
||||
if (!Energy->kWhtoday_offset_init && (RtcTime.day_of_year == Settings->energy_kWhdoy)) {
|
||||
Energy->kWhtoday_offset_init = true;
|
||||
|
|
|
@ -309,6 +309,7 @@ void EnergySettingsLoad(bool erase) {
|
|||
// Settings->energy_kWhtoday_ph[i], &Energy->Settings.energy_today_kWh[i],
|
||||
// Settings->energy_kWhyesterday_ph[i], &Energy->Settings.energy_yesterday_kWh[i]);
|
||||
}
|
||||
Energy->Settings.energy_kWhtotal_time = Settings->energy_kWhtotal_time;
|
||||
|
||||
// v0102 additions
|
||||
Energy->Settings.gui_display = ENERGY_GUI_DISPLAY_MODE;
|
||||
|
@ -609,6 +610,9 @@ void Energy200ms(void) {
|
|||
XnrgCall(FUNC_ENERGY_EVERY_SECOND);
|
||||
|
||||
if (RtcTime.valid) {
|
||||
if (!Energy->Settings.energy_kWhtotal_time) {
|
||||
Energy->Settings.energy_kWhtotal_time = LocalTime();
|
||||
}
|
||||
|
||||
if (!Energy->kWhtoday_offset_init && (RtcTime.day_of_year == Energy->Settings.energy_kWhdoy)) {
|
||||
Energy->kWhtoday_offset_init = true;
|
||||
|
|
Loading…
Reference in New Issue