V1.8.28 - For payloads combined in one packet send all to JSON client

pull/55/merge
Dave Akerman 2019-05-09 11:16:20 +00:00
rodzic 23a3fe1778
commit cfd29f0589
3 zmienionych plików z 13 dodań i 6 usunięć

Wyświetl plik

@ -229,6 +229,11 @@ Many thanks to David Brooke for coding this feature and the AFC.
Change History Change History
============== ==============
09/05/2019 - V1.8.28
--------------------
Store all payloads from combined packet for JSON transmission to client.
09/05/2019 - V1.8.27 09/05/2019 - V1.8.27
-------------------- --------------------

Wyświetl plik

@ -45,7 +45,7 @@
#include "udpclient.h" #include "udpclient.h"
#include "lifo_buffer.h" #include "lifo_buffer.h"
#define VERSION "V1.8.27" #define VERSION "V1.8.28"
bool run = TRUE; bool run = TRUE;
// RFM98 // RFM98
@ -811,9 +811,8 @@ void RemoveOldPayloads(void)
if ((time(NULL) - Config.Payloads[i].LastPacketAt) > 10800) if ((time(NULL) - Config.Payloads[i].LastPacketAt) > 10800)
{ {
// More than 3 hours old, so remove it // More than 3 hours old, so remove it
Config.Payloads[i].InUse = 0;
} }
Config.Payloads[i].InUse = 0;
} }
} }
} }
@ -857,7 +856,7 @@ int FindFreePayload(char *Payload)
strcpy(Config.Payloads[Oldest].Payload, Payload); strcpy(Config.Payloads[Oldest].Payload, Payload);
return i; return Oldest;
} }
void DoPositionCalcs(int PayloadIndex) void DoPositionCalcs(int PayloadIndex)
@ -1039,6 +1038,8 @@ int ProcessTelemetryMessage(int Channel, received_t *Received)
*endmessage = '\0'; *endmessage = '\0';
LogTelemetryPacket(startmessage); LogTelemetryPacket(startmessage);
ProcessLineUKHAS(Channel, startmessage);
if ((Repeated = (*startmessage == '%'))) if ((Repeated = (*startmessage == '%')))
{ {
@ -1565,7 +1566,7 @@ void DIO0_Interrupt( int Channel )
strncpy(Received.UKHASstring, Received.Message, Received.Bytes); strncpy(Received.UKHASstring, Received.Message, Received.Bytes);
UDPSend(Received.UKHASstring, Config.UDPPort); UDPSend(Received.UKHASstring, Config.UDPPort);
Repeated = ProcessTelemetryMessage(Channel, &Received); Repeated = ProcessTelemetryMessage(Channel, &Received);
ProcessLineUKHAS(Channel, Config.LoRaDevices[Channel].Telemetry); // ProcessLineUKHAS(Channel, Config.LoRaDevices[Channel].Telemetry);
TestMessageForSMSAcknowledgement( Channel, Received.UKHASstring); TestMessageForSMSAcknowledgement( Channel, Received.UKHASstring);
CheckForChatContent(Channel, Repeated, Config.LoRaDevices[Channel].Telemetry); CheckForChatContent(Channel, Repeated, Config.LoRaDevices[Channel].Telemetry);
strcpy(Config.LoRaDevices[Channel].LocalDataBuffer, Received.UKHASstring); strcpy(Config.LoRaDevices[Channel].LocalDataBuffer, Received.UKHASstring);

Wyświetl plik

@ -196,9 +196,10 @@ int SendJSON(int connfd)
// Send any packets that we've not sent yet // Send any packets that we've not sent yet
for (PayloadIndex=0; PayloadIndex<MAX_PAYLOADS; PayloadIndex++) for (PayloadIndex=0; PayloadIndex<MAX_PAYLOADS; PayloadIndex++)
{ {
if (Config.Payloads[PayloadIndex].InUse && Config.Payloads[PayloadIndex].SendToClients) if (Config.Payloads[PayloadIndex].InUse && Config.Payloads[PayloadIndex].SendToClients)
{ {
Channel = Config.Payloads[PayloadIndex].Channel; Channel = Config.Payloads[PayloadIndex].Channel;
sprintf(line, "{\"class\":\"POSN\",\"index\":%d,\"channel\":%d,\"payload\":\"%s\",\"time\":\"%s\",\"lat\":%.5lf,\"lon\":%.5lf,\"alt\":%d,\"rate\":%.1lf,\"snr\":%d,\"rssi\":%d,\"ferr\":%.1lf,\"sentence\":\"%s\"}\r\n", sprintf(line, "{\"class\":\"POSN\",\"index\":%d,\"channel\":%d,\"payload\":\"%s\",\"time\":\"%s\",\"lat\":%.5lf,\"lon\":%.5lf,\"alt\":%d,\"rate\":%.1lf,\"snr\":%d,\"rssi\":%d,\"ferr\":%.1lf,\"sentence\":\"%s\"}\r\n",