Browse Source

sml_data_received() only returned false with empty rtc data area.

Thomas Buck 5 months ago
parent
commit
476f8db02f
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      src/smart_meter.cpp

+ 4
- 1
src/smart_meter.cpp View File

@@ -29,12 +29,13 @@
29 29
 
30 30
 static EspSoftwareSerial::UART port;
31 31
 RTC_DATA_ATTR static unsigned long counter = 0;
32
+bool got_data = false;
32 33
 
33 34
 static double SumWh = NAN, T1Wh = NAN, T2Wh = NAN;
34 35
 static double SumW = NAN, L1W = NAN, L2W = NAN, L3W = NAN;
35 36
 
36 37
 bool sml_data_received(void) {
37
-    return counter > 0;
38
+    return got_data;
38 39
 }
39 40
 
40 41
 static void EnergySum(void) {
@@ -164,6 +165,8 @@ void sml_run(void) {
164 165
 
165 166
         debug.println();
166 167
 
168
+        got_data = true;
169
+
167 170
 #ifdef FEATURE_LORA
168 171
         // the power readings (Watt) are just sent as is, if available.
169 172
         // the energy readings are consolidated if possible, to avoid

Loading…
Cancel
Save