From cb5b3584d0563e086b09fa5f37ce64f034ce3df7 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Wed, 22 Sep 2021 13:50:18 +0200 Subject: [PATCH] fix temp/hum empty check in sync with recent updates --- RX_FSK/RX_FSK.ino | 8 ++++---- RX_FSK/src/Sonde.cpp | 2 ++ RX_FSK/version.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index e55559f..84312d1 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -3717,14 +3717,14 @@ void sondehub_send_data(WiFiClient * client, SondeInfo * s, struct st_sondehub * } // Only send temp if provided - if ((int)s->d.temperature != 0) { - sprintf(w, "\"temp\": %.1f,", float(s->d.temperature)); + if (!isnan(s->d.temperature)) { + sprintf(w, "\"temp\": %.1f,", s->d.temperature); w += strlen(w); } // Only send humidity if provided - if ((int)s->d.relativeHumidity != 0) { - sprintf(w, "\"humidity\": %.1f,", float(s->d.relativeHumidity)); + if (!isnan(s->d.relativeHumidity)) { + sprintf(w, "\"humidity\": %.1f,", s->d.relativeHumidity); w += strlen(w); } diff --git a/RX_FSK/src/Sonde.cpp b/RX_FSK/src/Sonde.cpp index 0598ba5..ed4f3f7 100644 --- a/RX_FSK/src/Sonde.cpp +++ b/RX_FSK/src/Sonde.cpp @@ -79,10 +79,12 @@ void Sonde::defaultConfig() { Serial.printf("Board fingerprint is %d\n", fingerprint); sondeList = (SondeInfo *)malloc((MAXSONDE+1)*sizeof(SondeInfo)); + // addSonde should initialize everything anyway, so this should not strictly be necessary, but does no harm either memset(sondeList, 0, (MAXSONDE+1)*sizeof(SondeInfo)); for(int i=0; i<(MAXSONDE+1); i++) { sondeList[i].freq=400; sondeList[i].type=STYPE_RS41; + clearAllData(&sondeList[i]); } config.touch_thresh = 70; config.led_pout = -1; diff --git a/RX_FSK/version.h b/RX_FSK/version.h index 9bd5aa5..4fa1af3 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20210921"; +const char *version_id = "devel20210922"; const int SPIFFS_MAJOR=2; const int SPIFFS_MINOR=16;