diff --git a/src/AgValue.cpp b/src/AgValue.cpp index fac99f3..cef79b9 100644 --- a/src/AgValue.cpp +++ b/src/AgValue.cpp @@ -27,6 +27,12 @@ #define json_prop_noxRaw "noxRaw" #define json_prop_co2 "rco2" +Measurements::Measurements() { +#ifndef ESP8266 + _resetReason = (int)ESP_RST_UNKNOWN; +#endif +} + void Measurements::maxPeriod(MeasurementType type, int max) { switch (type) { case Temperature: @@ -604,8 +610,6 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi, root["boot"] = _bootCount; root["bootCount"] = _bootCount; root["wifi"] = rssi; - root["resetReason"] = _resetReason; - root["freeHeap"] = ESP.getFreeHeap(); if (localServer) { if (ag.isOne()) { @@ -614,6 +618,11 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi, root["serialno"] = ag.deviceId(); root["firmware"] = ag.getVersion(); root["model"] = AgFirmwareModeName(fwMode); + } else { +#ifndef ESP8266 + root["resetReason"] = _resetReason; + root["freeHeap"] = ESP.getFreeHeap(); +#endif } String result = JSON.stringify(root); @@ -1073,6 +1082,7 @@ int Measurements::bootCount() { return _bootCount; } void Measurements::setBootCount(int bootCount) { _bootCount = bootCount; } +#ifndef ESP8266 void Measurements::setResetReason(esp_reset_reason_t reason) { switch (reason) { case ESP_RST_UNKNOWN: @@ -1111,4 +1121,5 @@ void Measurements::setResetReason(esp_reset_reason_t reason) { } _resetReason = (int)reason; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/AgValue.h b/src/AgValue.h index f74018e..6cc7a05 100644 --- a/src/AgValue.h +++ b/src/AgValue.h @@ -34,7 +34,7 @@ private: }; public: - Measurements() {} + Measurements(); ~Measurements() {} // Enumeration for every AG measurements @@ -150,7 +150,9 @@ public: int bootCount(); void setBootCount(int bootCount); +#ifndef ESP8266 void setResetReason(esp_reset_reason_t reason); +#endif private: // Some declared as an array (channel), because FW_MODE_O_1PPx has two PMS5003T