Adjusted examples to not send error codes (e.g. -1) to server

This commit is contained in:
Achim committed 2022-11-01 14:04:41 +07:00
1 parent 84fe9c2575
commit dc1a070ee3
6 files changed
+264 -192

No files matched your search

+5 -3
View File
@@ -182,13 +182,15 @@ void showTextRectangle(String ln1, String ln2, boolean small) {
void sendToServer() {
if (currentMillis - previoussendToServer >= sendToServerInterval) {
previoussendToServer += sendToServerInterval;
String payload = "{\"wifi\":" + String(WiFi.RSSI())
+ ", \"rco2\":" + String(Co2)
+ ", \"pm02\":" + String(pm25)
+ (Co2 < 0 ? "" : ", \"rco2\":" + String(Co2))
+ (pm25 < 0 ? "" : ", \"pm02\":" + String(pm25))
+ ", \"atmp\":" + String(temp)
+ ", \"rhum\":" + String(hum)
+ (hum < 0 ? "" : ", \"rhum\":" + String(hum))
+ "}";
if(WiFi.status()== WL_CONNECTED){
Serial.println(payload);
String POSTURL = APIROOT + "sensors/airgradient:" + String(ESP.getChipId(), HEX) + "/measures";