Kaynağa Gözat

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

Thomas Buck 4 ay önce
ebeveyn
işleme
476f8db02f
1 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  1. 4
    1
      src/smart_meter.cpp

+ 4
- 1
src/smart_meter.cpp Dosyayı Görüntüle

@@ -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…
İptal
Kaydet