Merge 0bddd3ef9d into 38e15c15e5
This commit is contained in:
commit
90fb2bd882
|
|
@ -808,6 +808,7 @@ struct st_configitems config_list[] = {
|
|||
{"sondehub.callsign", 63, &sonde.config.sondehub.callsign},
|
||||
{"sondehub.antenna", 63, &sonde.config.sondehub.antenna},
|
||||
{"sondehub.email", 63, &sonde.config.sondehub.email},
|
||||
{"sondehub.maxage", 0, &sonde.config.sondehub.maxage},
|
||||
{"sondehub.fiactive", 0, &sonde.config.sondehub.fiactive},
|
||||
{"sondehub.fiinterval", 0, &sonde.config.sondehub.fiinterval},
|
||||
{"sondehub.fimaxdist", 0, &sonde.config.sondehub.fimaxdist},
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ var cfgs = [
|
|||
[ "sondehub.callsign", "Callsign"],
|
||||
[ "sondehub.antenna", "Antenna (optional, visisble on SondeHub tracker)"],
|
||||
[ "sondehub.email", "SondeHub email (optional, only used to contact in case of upload errors)"],
|
||||
[ "sondehub.maxage", "SondeHub max age of packets before submitting (seconds, ≥ 15)"],
|
||||
[ "", "SondeHub frequency import", "https://github.com/dl9rdz/rdz_ttgo_sonde/wiki/SondeHub-import" ],
|
||||
[ "sondehub.fiactive", "SondeHub frequency import active (0=disabled, 1=active)" ],
|
||||
[ "sondehub.fiinterval", "Import frequency (minutes, ≥ 5)" ],
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ sondehub.host=api.v2.sondehub.org
|
|||
sondehub.callsign=CHANGEME_RDZTTGO
|
||||
sondehub.antenna=
|
||||
sondehub.email=
|
||||
sondehub.maxage=15
|
||||
#-------------------------------#
|
||||
# Sondehub freq import settings
|
||||
#-------------------------------#
|
||||
|
|
|
|||
|
|
@ -350,6 +350,7 @@ extern const int N_CONFIG;
|
|||
|
||||
void Sonde::checkConfig() {
|
||||
if(config.maxsonde > MAXSONDE) config.maxsonde = MAXSONDE;
|
||||
if(config.sondehub.maxage<15) config.sondehub.maxage = 15;
|
||||
if(config.sondehub.fiinterval<5) config.sondehub.fiinterval = 5;
|
||||
if(config.sondehub.fimaxdist>700) config.sondehub.fimaxdist = 700;
|
||||
if(config.sondehub.fimaxage>48) config.sondehub.fimaxage = 48;
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ struct st_sondehub {
|
|||
char callsign[64];
|
||||
char antenna[64];
|
||||
char email[64];
|
||||
int maxage;
|
||||
int fiactive;
|
||||
int fiinterval;
|
||||
int fimaxdist;
|
||||
|
|
|
|||
|
|
@ -516,9 +516,6 @@ void ConnSondehub::sondehub_send_data(SondeInfo * s) {
|
|||
return;
|
||||
}
|
||||
|
||||
// max age of data in JSON request (in seconds)
|
||||
#define SONDEHUB_MAXAGE 15
|
||||
|
||||
char rs_msg[MSG_SIZE];
|
||||
char *w;
|
||||
struct tm ts;
|
||||
|
|
@ -692,7 +689,7 @@ void ConnSondehub::sondehub_send_data(SondeInfo * s) {
|
|||
} else {
|
||||
sondehub_send_next(s, rs_msg, strlen(rs_msg), 0);
|
||||
}
|
||||
if (now - shStart > SONDEHUB_MAXAGE) { // after MAXAGE seconds
|
||||
if (now - shStart > sonde.config.sondehub.maxage) { // after MAXAGE seconds
|
||||
sondehub_send_last();
|
||||
shclient_state = SH_CONN_WAITACK;
|
||||
rs_msg_len = 0; // wait for new msg:
|
||||
|
|
@ -705,7 +702,7 @@ void ConnSondehub::sondehub_finish_data() {
|
|||
if (shclient_state == SH_CONN_APPENDING) {
|
||||
time_t now;
|
||||
time(&now);
|
||||
if (now - shStart > SONDEHUB_MAXAGE + 3) { // after MAXAGE seconds
|
||||
if (now - shStart > sonde.config.sondehub.maxage + 3) { // after MAXAGE seconds
|
||||
sondehub_send_last();
|
||||
shclient_state = SH_CONN_WAITACK;
|
||||
rs_msg_len = 0; // wait for new msg:
|
||||
|
|
|
|||
Loading…
Reference in New Issue