From 45edf2ffa3b4a6f6df34df94a1e5fa984a02f50e Mon Sep 17 00:00:00 2001 From: richonguzman Date: Mon, 24 Feb 2025 16:10:02 -0300 Subject: [PATCH] gps satelites indicator --- src/LoRa_APRS_iGate.cpp | 25 +++++++++++++++++++++++-- src/station_utils.cpp | 5 +---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 9fba14e..7bace5b 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -48,12 +48,14 @@ ___________________________________________________________________*/ #include "A7670_utils.h" #endif -String versionDate = "2025.02.12"; +String versionDate = "2025.02.24"; Configuration Config; WiFiClient espClient; #ifdef HAS_GPS HardwareSerial gpsSerial(1); TinyGPSPlus gps; + uint32_t gpsSatelliteTime = 0; + bool gpsInfoToggle = false; #endif uint8_t myWiFiAPIndex = 0; @@ -152,7 +154,26 @@ void loop() { BATTERY_Utils::checkIfShouldSleep(); } - thirdLine = Utils::getLocalIP(); + #ifdef HAS_GPS + if (Config.beacon.gpsActive) { + if (millis() - gpsSatelliteTime > 5000) { + gpsInfoToggle = !gpsInfoToggle; + gpsSatelliteTime = millis(); + } + if (gpsInfoToggle) { + thirdLine = "Satellite(s): "; + String gpsData = String(gps.satellites.value()); + if (gpsData.length() < 2) gpsData = "0" + gpsData; // Ensure two-digit formatting + thirdLine += gpsData; + } else { + thirdLine = Utils::getLocalIP(); + } + } else { + thirdLine = Utils::getLocalIP(); + } + #else + thirdLine = Utils::getLocalIP(); + #endif #ifdef HAS_A7670 if (Config.aprs_is.active && !modemLoggedToAPRSIS) A7670_Utils::APRS_IS_connect(); diff --git a/src/station_utils.cpp b/src/station_utils.cpp index e992cbc..4608ea4 100644 --- a/src/station_utils.cpp +++ b/src/station_utils.cpp @@ -80,10 +80,7 @@ namespace STATION_Utils { lastStation.station = station; lastHeardStations.push_back(lastStation); } - - char buffer[30]; // Adjust size as needed - sprintf(buffer, "Stations (%dmin) = %2d", Config.rememberStationTime, lastHeardStations.size()); - fourthLine = buffer; + Utils::activeStations(); } bool wasHeard(const String& station) {