From 9b1f957e723b1819327210a1f217634728189732 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Mon, 3 Oct 2022 00:32:45 +0000 Subject: [PATCH] gps from apk: 0/0 as invalid pos --- RX_FSK/RX_FSK.ino | 8 +++++--- RX_FSK/src/mqtt.cpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index 641c624..b6122cb 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -1499,6 +1499,7 @@ void gpsTask(void *parameter) { gpsPos.course = lastCourse; } } + if(gpsPos.lon == 0 && gpsPos.lat == 0) gpsPos.valid = false; } gpsPos.hdop = nmea.getHDOP(); gpsPos.sat = nmea.getNumSatellites(); @@ -2247,6 +2248,7 @@ void parseGpsJson(char *data) { value = NULL; } } + if(gpsPos.lat == 0 && gpsPos.lon == 0) gpsPos.valid = false; Serial.printf("Parse result: lat=%f, lon=%f, alt=%d, valid=%d\n", gpsPos.lat, gpsPos.lon, gpsPos.alt, gpsPos.valid); } @@ -3276,7 +3278,7 @@ void aprs_station_update() { lon = sonde.config.rxlon; if (isnan(lat) || isnan(lon)) return; } else { - if (gpsPos.valid && gpsPos.lat != 0 && gpsPos.lon != 0) { + if (gpsPos.valid) { lat = gpsPos.lat; lon = gpsPos.lon; } else { @@ -3362,7 +3364,7 @@ void sondehub_station_update(WiFiClient * client, struct st_sondehub * conf) { // We send GPS position: (a) in CHASE mode, (b) in AUTO mode if no fixed location has been specified in config if (chase == SH_LOC_CHASE) { - if (gpsPos.valid && gpsPos.lat != 0 && gpsPos.lon != 0) { + if (gpsPos.valid) { sprintf(w, "\"uploader_position\": [%.6f,%.6f,%d]," "\"mobile\": true", @@ -3689,7 +3691,7 @@ void sondehub_send_data(WiFiClient * client, SondeInfo * s, struct st_sondehub * // We send GPS position: (a) in CHASE mode, (b) in AUTO mode if no fixed location has been specified in config if (chase == SH_LOC_CHASE) { - if (gpsPos.valid && gpsPos.lat != 0 && gpsPos.lon != 0) { + if (gpsPos.valid) { sprintf(w, "\"uploader_position\": [%.6f,%.6f,%d]", gpsPos.lat, gpsPos.lon, gpsPos.alt); } else { sprintf(w, "\"uploader_position\": [null,null,null]"); diff --git a/RX_FSK/src/mqtt.cpp b/RX_FSK/src/mqtt.cpp index b5a7cda..61e0995 100644 --- a/RX_FSK/src/mqtt.cpp +++ b/RX_FSK/src/mqtt.cpp @@ -58,7 +58,7 @@ void MQTT::publishUptime() if( !isnan(sonde.config.rxlat) && !isnan(sonde.config.rxlon) ) { snprintf(payload, 256, "%s\"rxlat\": %.5f, \"rxlon\": %.5f, ", payload, sonde.config.rxlat, sonde.config.rxlon); } - snprintf(payload, 256, "%s\"sw\": \"%s\", \"ver\": \"%s\"}", payload, version_name, version_id); + snprintf(payload, 256, "%s\"SW\": \"%s\", \"VER\": \"%s\"}", payload, version_name, version_id); Serial.println(payload); char topic[128]; snprintf(topic, 128, "%s%s", this->prefix, "uptime");