diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 8bd3056..e02091d 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -40,7 +40,7 @@ ________________________________________________________________________________ #include "A7670_utils.h" #endif -String versionDate = "2024.10.15"; +String versionDate = "2024.10.21"; Configuration Config; WiFiClient espClient; #ifdef HAS_GPS diff --git a/src/utils.cpp b/src/utils.cpp index 77ba1dd..cc00891 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -45,6 +45,8 @@ bool sendStartTelemetry = true; bool beaconUpdate = true; uint32_t lastBeaconTx = 0; uint32_t lastScreenOn = millis(); +String beaconPacket; +String secondaryBeaconPacket; namespace Utils { @@ -109,7 +111,6 @@ namespace Utils { fourthLine.concat(String(lastHeardStations.size())); } - void sendInitialTelemetryPackets() { String sender = Config.callsign; for (int i = sender.length(); i < 9; i++) { @@ -178,13 +179,19 @@ namespace Utils { sendStartTelemetry = false; } - void checkBeaconInterval() { uint32_t lastTx = millis() - lastBeaconTx; if (lastBeaconTx == 0 || lastTx >= Config.beacon.interval * 60 * 1000) { beaconUpdate = true; } + #ifdef HAS_GPS + if (Config.beacon.gpsActive && gps.location.lat() == 0.0 && gps.location.lng() == 0.0) { + GPS_Utils::getData(); + beaconUpdate = false; + } + #endif + if (beaconUpdate) { if (!Config.display.alwaysOn && Config.display.timeout != 0) { displayToggle(true); @@ -198,19 +205,19 @@ namespace Utils { activeStations(); - String beaconPacket = iGateBeaconPacket; - String secondaryBeaconPacket = iGateLoRaBeaconPacket; + beaconPacket = iGateBeaconPacket; + secondaryBeaconPacket = iGateLoRaBeaconPacket; #ifdef HAS_GPS if (Config.beacon.gpsActive && !Config.digi.ecoMode) { GPS_Utils::getData(); - if (gps.location.isUpdated()) { + if (gps.location.isUpdated() && gps.location.lat() != 0.0 && gps.location.lng() != 0.0) { GPS_Utils::generateBeaconFirstPart(); String encodedGPS = GPS_Utils::encodeGPS(gps.location.lat(), gps.location.lng(), Config.beacon.overlay, Config.beacon.symbol); beaconPacket = iGateBeaconPacket + encodedGPS; secondaryBeaconPacket = iGateLoRaBeaconPacket + encodedGPS; } - } - #endif + } + #endif if (Config.wxsensor.active && wxModuleType != 0) { String sensorData = WX_Utils::readDataSensor();