Browse Source

sanitize sensor values

main
Hendrik Langer 7 years ago
parent
commit
0a8a918d1b
  1. 4
      src/main.cpp

4
src/main.cpp

@ -227,15 +227,19 @@ void ICACHE_FLASH_ATTR sendValues() {
root["radioactivity"] = sd.radioactivity; root["radioactivity"] = sd.radioactivity;
} }
if (sd.voltage > 2.5 ) {
JsonObject& voltageObject = array.createNestedObject(); JsonObject& voltageObject = array.createNestedObject();
voltageObject["sensor"] = SENSOR7_ID; voltageObject["sensor"] = SENSOR7_ID;
voltageObject["value"] = sd.voltage; voltageObject["value"] = sd.voltage;
root["voltage"] = sd.voltage; root["voltage"] = sd.voltage;
}
if (sd.rssi != 0) {
JsonObject& rssiObject = array.createNestedObject(); JsonObject& rssiObject = array.createNestedObject();
rssiObject["sensor"] = SENSOR8_ID; rssiObject["sensor"] = SENSOR8_ID;
rssiObject["value"] = sd.rssi; rssiObject["value"] = sd.rssi;
root["rssi"] = sd.rssi; root["rssi"] = sd.rssi;
}
root["millis"] = millis(); root["millis"] = millis();
root["heap"] = ESP.getFreeHeap(); root["heap"] = ESP.getFreeHeap();

Loading…
Cancel
Save