From ee957cff721eecb1562aff8ac03ec3e23d6ab343 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Fri, 13 Sep 2024 11:12:53 +0000 Subject: [PATCH] upd ratelimit, ILI9342 (M5Stack) font fix --- RX_FSK/src/Display.cpp | 4 ++++ RX_FSK/src/conn-aprs.cpp | 24 ++++++++++++++++-------- RX_FSK/src/conn-sdcard.cpp | 2 +- RX_FSK/version.h | 2 +- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/RX_FSK/src/Display.cpp b/RX_FSK/src/Display.cpp index 653e89a..38b6ce0 100644 --- a/RX_FSK/src/Display.cpp +++ b/RX_FSK/src/Display.cpp @@ -482,6 +482,7 @@ struct gfxoffset_t gfxoffsets[MAXFONT]; void calc_gfx_offsets() { for(int i=0; iglyph; @@ -496,6 +497,9 @@ void calc_gfx_offsets() { if(h>hgt) hgt=h; } gfxoffsets[i].yclear = hgt; +///// The GFX library does things differently, and if we end up with a smaller baseline then positions might be out of bounds +///// causing a lack of background on ILI9342. Make sure that we use a large enough baseline! + gfxoffsets[i].yofs = gfl[i]->yAdvance * 2 / 3; printf("Font %d: yofs=%d, yclear=%d\n", i, gfxoffsets[i].yofs, gfxoffsets[i].yclear); } } diff --git a/RX_FSK/src/conn-aprs.cpp b/RX_FSK/src/conn-aprs.cpp index 635d9bc..6259740 100644 --- a/RX_FSK/src/conn-aprs.cpp +++ b/RX_FSK/src/conn-aprs.cpp @@ -73,15 +73,24 @@ void ConnAPRS::updateSonde( SondeInfo *si ) { char *str = aprs_senddata(si, sonde.config.call, sonde.config.objcall, sonde.config.tcpfeed.symbol); Serial.printf("udpfedd active: %d tcpfeed active: %d\n", sonde.config.udpfeed.active, sonde.config.tcpfeed.active); + unsigned long now = millis(); // Output via AXUDP if(sonde.config.udpfeed.active) { - char raw[201]; - int rawlen = aprsstr_mon2raw(str, raw, APRS_MAXLEN); - Serial.println("Sending AXUDP"); - //Serial.println(raw); - udp.beginPacket(udphost, udpport); - udp.write((const uint8_t *)raw, rawlen); - udp.endPacket(); + static unsigned long lastudp = 0; + long tts = sonde.config.udpfeed.ratelimit * 1000L - (now - lastudp); + Serial.printf("aprs-udp: now-last = %ld\n", (now - lastudp)); + if ( tts < 0 ) { + char raw[201]; + int rawlen = aprsstr_mon2raw(str, raw, APRS_MAXLEN); + Serial.println("Sending AXUDP"); + //Serial.println(raw); + udp.beginPacket(udphost, udpport); + udp.write((const uint8_t *)raw, rawlen); + udp.endPacket(); + lastudp = now; + } else { + Serial.printf("Sending APRS-UDP in %d s\n", (int)(tts/1000)); + } } // KISS via TCP (incoming connection, e.g. from APRSdroid if (tncclient.connected()) { @@ -96,7 +105,6 @@ void ConnAPRS::updateSonde( SondeInfo *si ) { static unsigned long lasttcp = 0; tcpclient_fsm(); if(aprs[0].tcpclient_state == TCS_CONNECTED || aprs[1].tcpclient_state == TCS_CONNECTED) { - unsigned long now = millis(); long tts = sonde.config.tcpfeed.highrate * 1000L - (now-lasttcp); Serial.printf("aprs: now-last = %ld\n", (now - lasttcp)); if ( tts < 0 ) { diff --git a/RX_FSK/src/conn-sdcard.cpp b/RX_FSK/src/conn-sdcard.cpp index d8346fe..fa7da4c 100644 --- a/RX_FSK/src/conn-sdcard.cpp +++ b/RX_FSK/src/conn-sdcard.cpp @@ -41,6 +41,7 @@ void ConnSDCard::init() { uint32_t totalSize = SD.totalBytes() / (1024 * 1024); Serial.printf("SD Card used/total: %lu/%lu MB\n", usedSize, totalSize); +#if 0 file = SD.open("/data.csv", FILE_APPEND); if (!file) { Serial.println("Cannot open file"); @@ -51,7 +52,6 @@ void ConnSDCard::init() { //sdf = SD.open("/data.csv", FILE_READ); -#if 0 // Just testcode DIR *dir = opendir("/sd/"); struct dirent *dent; diff --git a/RX_FSK/version.h b/RX_FSK/version.h index 6b878e1..ca43814 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "dev20240905b"; +const char *version_id = "dev20240912"; const int SPIFFS_MAJOR=3; const int SPIFFS_MINOR=3;