kopia lustrzana https://github.com/PiInTheSky/lora-gateway
V1.9.2 - Fixes to Sondehub uploader see readme
rodzic
f1a6f1b004
commit
b5e44644e8
|
@ -295,6 +295,12 @@ Many thanks to David Brooke for coding this feature and the AFC.
|
|||
Change History
|
||||
==============
|
||||
|
||||
## 10/09/2022 - V1.9.2
|
||||
|
||||
Fixed code that uploads to Sondehub so that a zero altitude doesn't result in a 400 response from the server
|
||||
Any 400 responses are now logged to errors.txt along with the JSON that triggered them
|
||||
A 400 response is no longer retried
|
||||
|
||||
## 05/09/2022 - V1.9.1
|
||||
|
||||
Only upload to Sondehub if telemetry has non-zero latitude or longitude
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
09:08:52: 400 response to: [{"software_name": "LoRa Gateway","software_version": "V1.9.1","uploader_callsign": "M0RPI/5","time_received": "2022-09-18T08:08:50Z","payload_callsign": "PITS","datetime":"2022-09-18T08:08:50Z","lat": 51.95018,"lon": -2.54439,"alt": ,"frequency": 434.2250,"modulation": "LoRa","uploader_position": [ 51.950, -2.545, 145],"uploader_antenna": "Collinear"}]
|
||||
09:08:54: 400 response to: [{"software_name": "LoRa Gateway","software_version": "V1.9.1","uploader_callsign": "M0RPI/5","time_received": "2022-09-18T08:08:53Z","payload_callsign": "PITS","datetime":"2022-09-18T08:08:53Z","lat": 51.95017,"lon": -2.54439,"alt": ,"frequency": 434.2250,"modulation": "LoRa","uploader_position": [ 51.950, -2.545, 145],"uploader_antenna": "Collinear"}]
|
||||
09:08:57: 400 response to: [{"software_name": "LoRa Gateway","software_version": "V1.9.1","uploader_callsign": "M0RPI/5","time_received": "2022-09-18T08:08:56Z","payload_callsign": "PITS","datetime":"2022-09-18T08:08:56Z","lat": 51.95017,"lon": -2.54439,"alt": ,"frequency": 434.2250,"modulation": "LoRa","uploader_position": [ 51.950, -2.545, 145],"uploader_antenna": "Collinear"}]
|
23
gateway.c
23
gateway.c
|
@ -48,7 +48,7 @@
|
|||
#include "udpclient.h"
|
||||
#include "lifo_buffer.h"
|
||||
|
||||
#define VERSION "V1.9.1"
|
||||
#define VERSION "V1.9.2"
|
||||
bool run = TRUE;
|
||||
|
||||
// RFM98
|
||||
|
@ -359,6 +359,27 @@ void LogTelemetryPacket(int Channel, char *Telemetry)
|
|||
}
|
||||
}
|
||||
|
||||
void LogError(char *Message1, char *Message2)
|
||||
{
|
||||
// if (Config.EnableTelemetryLogging)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if ( ( fp = fopen( "errors.txt", "at" ) ) != NULL )
|
||||
{
|
||||
time_t now;
|
||||
struct tm *tm;
|
||||
|
||||
now = time( 0 );
|
||||
tm = localtime( &now );
|
||||
|
||||
fprintf( fp, "%02d:%02d:%02d: %s %s\n", tm->tm_hour, tm->tm_min, tm->tm_sec, Message1, Message2);
|
||||
|
||||
fclose( fp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogMessage( const char *format, ... )
|
||||
{
|
||||
static WINDOW *Window = NULL;
|
||||
|
|
|
@ -8,6 +8,7 @@ void hexdump_buffer( const char *title, const char *buffer,
|
|||
const int len_buffer );
|
||||
void LogPacket( rx_metadata_t *Metadata, int Bytes, unsigned char MessageType );
|
||||
void LogTelemetryPacket(int Channel, char *Telemetry);
|
||||
void LogError(char *Message1, char *Message2);
|
||||
void LogMessage( const char *format, ... );
|
||||
void ChannelPrintf( int Channel, int row, int column, const char *format,
|
||||
... );
|
||||
|
|
10
sondehub.c
10
sondehub.c
|
@ -106,7 +106,13 @@ int UploadJSONToServer(char *url, char *json)
|
|||
// Everything performing nominally (even if we didn't successfully insert this time)
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
else if (http_resp == 400)
|
||||
{
|
||||
LogMessage("400 response to %s\n", json);
|
||||
LogError("400 response to:", json);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("Unexpected HTTP response %ld for URL '%s'\n", http_resp, url);
|
||||
result = false;
|
||||
|
@ -162,7 +168,7 @@ int UploadSondehubPosition(int Channel)
|
|||
"\"datetime\":\"%s\"," // UTC from payload
|
||||
"\"lat\": %.5lf," // Latitude
|
||||
"\"lon\": %.5lf," // Longitude
|
||||
"\"alt\": %.d," // Altitude
|
||||
"\"alt\": %d," // Altitude
|
||||
"\"frequency\": %.4lf," // Frequency
|
||||
"\"modulation\": \"LoRa\"," // Modulation
|
||||
// DoubleToString('snr', SNR, HasSNR) +
|
||||
|
|
Ładowanie…
Reference in New Issue