From 5987c92fab269019971490ddbd99f9a01dfe6951 Mon Sep 17 00:00:00 2001 From: Luke Prior <22492406+LukePrior@users.noreply.github.com> Date: Tue, 27 Jul 2021 05:11:33 +1000 Subject: [PATCH] SondeHub Fix Chase Cars (#104) * fix chase cars * update version ID * fix version Co-authored-by: Uskompuf <22492406+Uskompuf@users.noreply.github.com> Co-authored-by: dl9rdz --- RX_FSK/RX_FSK.ino | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index adb8e6c..679d6fa 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -2221,22 +2221,10 @@ void loopDecoder() { } #if FEATURE_SONDEHUB if (sonde.config.sondehub.active) { - unsigned long time_now = millis(); - // time_delta will be correct, even if time_now overflows - unsigned long time_delta = time_now - time_last_update; - if ((sonde.config.sondehub.chase == 0) && (time_delta >= SONDEHUB_STATION_UPDATE_TIME)) { // 60 min - sondehub_station_update(&shclient, &sonde.config.sondehub); - time_last_update = time_now; - } - else if ((sonde.config.sondehub.chase == 1) && (time_delta >= SONDEHUB_MOBILE_STATION_UPDATE_TIME)) { // 30 sec - sondehub_station_update(&shclient, &sonde.config.sondehub); - time_last_update = time_now; - } sondehub_send_data(&shclient, s, &sonde.config.sondehub); } #endif - #if FEATURE_MQTT // send to MQTT if enabled if (connected && mqttEnabled) { @@ -3010,6 +2998,22 @@ void loop() { lastMqttUptime = now; } #endif + +#if FEATURE_SONDEHUB + if (sonde.config.sondehub.active) { + unsigned long time_now = millis(); + // time_delta will be correct, even if time_now overflows + unsigned long time_delta = time_now - time_last_update; + if ((sonde.config.sondehub.chase == 0) && (time_delta >= SONDEHUB_STATION_UPDATE_TIME) && (wifi_state != WIFI_APMODE)) { // 60 min + sondehub_station_update(&shclient, &sonde.config.sondehub); + time_last_update = time_now; + } + else if ((sonde.config.sondehub.chase == 1) && (time_delta >= SONDEHUB_MOBILE_STATION_UPDATE_TIME) && (wifi_state != WIFI_APMODE)) { // 30 sec + sondehub_station_update(&shclient, &sonde.config.sondehub); + time_last_update = time_now; + } + } +#endif } #if FEATURE_SONDEHUB @@ -3052,7 +3056,7 @@ void sondehub_station_update(WiFiClient *client, struct st_sondehub *conf) { else if (gpsPos.valid && gpsPos.lat != 0 && gpsPos.lon != 0) { sprintf(w, "\"uploader_position\": [%.6f, %.6f, %d]," - "\"uploader_antenna\": \"%s\"" + "\"uploader_antenna\": \"%s\"," "\"mobile\": \"true\"" "}", gpsPos.lat, gpsPos.lon, gpsPos.alt, conf->antenna);