diff --git a/README.md b/README.md index 9a5b7df..e67a2a3 100644 --- a/README.md +++ b/README.md @@ -296,6 +296,12 @@ Many thanks to David Brooke for coding this feature and the AFC. Change History ============== +## 14/9/2023 - V1.10.4 + Clear InUse flag in SH upload so new telemetry is only uploaded once + +## 2/9/2023 - V1.10.3 + Limit to 5 retries on SH upload + ## 24/8/2023 - V1.10.2 UKHAS Telemetry is CRC16 checked before being used/uploaded, in addition to the existing LoRa CRC check diff --git a/gateway.c b/gateway.c index c7e9b33..4e6f12a 100644 --- a/gateway.c +++ b/gateway.c @@ -45,7 +45,7 @@ #include "udpclient.h" #include "lifo_buffer.h" -#define VERSION "V1.10.3" +#define VERSION "V1.10.4" bool run = TRUE; // RFM98 diff --git a/sondehub.c b/sondehub.c index efa7551..bf3c57f 100755 --- a/sondehub.c +++ b/sondehub.c @@ -392,28 +392,38 @@ void *SondehubLoop( void *vars ) static long ListenerCountdown = 0; int Channel; + // Copy from incoming to active + pthread_mutex_lock(&crit); // lock the critical section for (Channel=0; Channel<=1; Channel++) { // Copy new incoming payload, if there is one if (IncomingSondehubPayloads[Channel].InUse) { - pthread_mutex_lock(&crit); // lock the critical section - // copy from incoming to active memcpy(&ActiveSondehubPayloads[Channel], &IncomingSondehubPayloads[Channel], sizeof(struct TPayload)); - pthread_mutex_unlock(&crit); // unlock once you are done + IncomingSondehubPayloads[Channel].InUse = 0; } + } + pthread_mutex_unlock(&crit); // unlock once you are done + // Upload from active section + for (Channel=0; Channel<=1; Channel++) + { // Try to upload active payload, if there is one if (ActiveSondehubPayloads[Channel].InUse) { - UploadSondehubPosition(Channel); // Upload, with limited retries ifd needed + ChannelPrintf(Channel, 6, 1, "SH"); + + UploadSondehubPosition(Channel); // Upload, with limited retries if needed ActiveSondehubPayloads[Channel].InUse = 0; + + ChannelPrintf(Channel, 6, 1, " "); } } + // Listener position uploads if ((Config.latitude >= -90) && (Config.latitude <= 90) && (Config.longitude >= -180) && (Config.longitude <= 180)) { if (--ListenerCountdown <= 0)