From 5b1aff5141841ab601eea7219ab3cefb6fe66804 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 14 Nov 2022 17:11:38 +0100 Subject: [PATCH] Add RTC logging to energy --- tasmota/tasmota.ino | 4 ++-- tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 4681a56ef..a9c6f6ba9 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -127,7 +127,7 @@ typedef struct { } TRtcReboot; TRtcReboot RtcReboot; #ifdef ESP32 -RTC_NOINIT_ATTR TRtcReboot RtcDataReboot; +static RTC_NOINIT_ATTR TRtcReboot RtcDataReboot; #endif // ESP32 typedef struct { @@ -154,7 +154,7 @@ typedef struct { } TRtcSettings; TRtcSettings RtcSettings; #ifdef ESP32 -RTC_NOINIT_ATTR TRtcSettings RtcDataSettings; +static RTC_NOINIT_ATTR TRtcSettings RtcDataSettings; #endif // ESP32 struct TIME_T { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino index 27b941ac2..ba8ca1c53 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino @@ -347,6 +347,7 @@ void Energy200ms(void) if (!Energy.kWhtoday_offset_init && (RtcTime.day_of_year == Settings->energy_kWhdoy)) { for (uint32_t i = 0; i < 3; i++) { Energy.kWhtoday_offset[i] = Settings->energy_kWhtoday_ph[i]; +// RtcSettings.energy_kWhtoday_ph[i] = 0; } Energy.kWhtoday_offset_init = true; } @@ -1107,6 +1108,13 @@ void EnergySnsInit(void) XnrgCall(FUNC_INIT); if (TasmotaGlobal.energy_driver) { + + AddLog(LOG_LEVEL_DEBUG, PSTR("NRG: Rtc valid %d, kWhtoday_ph Rtc %d/%d/%d, Set %d/%d/%d"), + RtcSettingsValid(), + RtcSettings.energy_kWhtoday_ph[0],RtcSettings.energy_kWhtoday_ph[1],RtcSettings.energy_kWhtoday_ph[2], + Settings->energy_kWhtoday_ph[0],Settings->energy_kWhtoday_ph[1],Settings->energy_kWhtoday_ph[2] + ); + for (uint32_t i = 0; i < 3; i++) { // Energy.kWhtoday_offset[i] = 0; // Reset by EnergyDrvInit() // 20220805 - Change from https://github.com/arendst/Tasmota/issues/16118