From a7f6d6bb7bba0d1b4fccacbdb15e13211d2b67b5 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Fri, 24 Sep 2021 10:31:58 +0200 Subject: [PATCH] meteo in aprs frames --- RX_FSK/RX_FSK.ino | 1 - RX_FSK/src/aprs.cpp | 30 +++++++++++++++++++++--------- RX_FSK/version.h | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index 68f2bd7..f264594 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -2530,7 +2530,6 @@ void loopDecoder() { } if(sonde.config.tcpfeed.active) { static unsigned long lasttcp = 0; - static bool loginok = false; if( tcpclient.disconnected()) { tcpclient.connect(sonde.config.tcpfeed.host, sonde.config.tcpfeed.port); } diff --git a/RX_FSK/src/aprs.cpp b/RX_FSK/src/aprs.cpp index 913a1a5..6c0f95a 100644 --- a/RX_FSK/src/aprs.cpp +++ b/RX_FSK/src/aprs.cpp @@ -17,6 +17,7 @@ #include #include "aprs.h" +extern const char *version_name; #if 0 int openudp(const char *ip, int port, struct sockaddr_in *si) { int fd; @@ -255,11 +256,10 @@ static uint32_t dao91(double x) } /* end dao91() */ -char b[201]; +char b[251]; //char raw[201]; char *aprs_senddata(SondeInfo *si, const char *usercall, const char *sym) { -// float lat, float lon, float alt, float speed, float dir, float climb, const char *type, const char *objname, const char *usercall, const char *sym, const char *comm) SondeData *s = &(si->d); *b=0; aprsstr_append(b, usercall); @@ -288,7 +288,7 @@ char *aprs_senddata(SondeInfo *si, const char *usercall, const char *sym) { snprintf(b+i, APRS_MAXLEN-i, "%03d%02d.%02d%c%c", loni, lonm/100, lonm%100, s->lon<0?'W':'E', sym[1]); if(s->hs>0.5) { i=strlen(b); - snprintf(b+i, APRS_MAXLEN-i, "%03d/%03d", realcard(s->dir+1.5), realcard(s->hs*1.0/KNOTS+0.5)); + snprintf(b+i, APRS_MAXLEN-i, "%03d/%03d", realcard(s->dir+1.5), realcard(s->hs*3.6/KNOTS+0.5)); } if(s->alt>0.5) { i=strlen(b); @@ -299,13 +299,25 @@ char *aprs_senddata(SondeInfo *si, const char *usercall, const char *sym) { snprintf(b+i, APRS_MAXLEN-i, "!w%c%c!", 33+dao91(s->lat), 33+dao91(s->lon)); // ??? strcat(b, "&"); - char comm[100]; - snprintf(comm, 100, "Clb=%.1fm/s %.3fMHz Type=%s", s->vs, si->freq, sondeTypeStr[si->type]); - strcat(b, comm); - if( TYPE_IS_DFM(si->type) || TYPE_IS_METEO(si->type) ) { - snprintf(comm, 100, " ser=%s", s->ser); - strcat(b, comm); + i=strlen(b); + i += snprintf(b+i, APRS_MAXLEN-i, "Clb=%.1fm/s ", s->vs ); + if( !isnan(s->pressure) ) { + sprintf(b+strlen(b), "p=%.1fhPa ", s->pressure); } + if( !isnan(s->temperature) ) { + sprintf(b+strlen(b), "t=%.1fC ", s->temperature); + } + if( !isnan(s->relativeHumidity) ) { + sprintf(b+strlen(b), "h=%.1f%% ", s->relativeHumidity); + } + sprintf(b+strlen(b), "%.3fMHz Type=%s ", si->freq, sondeTypeStr[si->type]); + if( s->countKT != 0xffff && s->vframe - s->crefKT < 51 ) { + sprintf(b+strlen(b), "TxOff=%dh%dm ", s->countKT/3600, (s->countKT-s->countKT/3600*3600)/60); + } + if( TYPE_IS_DFM(si->type) || TYPE_IS_METEO(si->type) ) { + sprintf(b + strlen(b), "ser=%s ", s->ser); + } + sprintf(b + strlen(b), "%s", version_name); return b; } diff --git a/RX_FSK/version.h b/RX_FSK/version.h index 9107600..49d9c59 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20210923"; +const char *version_id = "devel20210924"; const int SPIFFS_MAJOR=2; const int SPIFFS_MINOR=16;