From 71c5e608b68e15c93584260861cbebca7fc924c1 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Sun, 5 May 2024 08:16:15 -0400 Subject: [PATCH] better heared station function --- src/LoRa_APRS_iGate.cpp | 3 +-- src/aprs_is_utils.cpp | 7 ++----- src/query_utils.cpp | 1 - src/station_utils.cpp | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index cb29a93..28dfb04 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -53,7 +53,6 @@ uint32_t bmeLastReading = -60000; String batteryVoltage; std::vector lastHeardStation; -std::vector lastHeardStation_temp; std::vector outputPacketBuffer; uint32_t lastTxTime = millis(); uint32_t lastRxTime = millis(); @@ -172,7 +171,7 @@ void loop() { #ifdef ESP32_DIY_LoRa_A7670 if (Config.aprs_is.active && !modemLoggedToAPRSIS) { A7670_Utils::APRS_IS_connect(); - } + } #else if (Config.aprs_is.active && !espClient.connected()) { APRS_IS_Utils::connect(); diff --git a/src/aprs_is_utils.cpp b/src/aprs_is_utils.cpp index db4b845..c43ab92 100644 --- a/src/aprs_is_utils.cpp +++ b/src/aprs_is_utils.cpp @@ -158,13 +158,12 @@ namespace APRS_IS_Utils { if (packet != "") { if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("TCPIP") == -1) && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) { Sender = packet.substring(3, packet.indexOf(">")); - STATION_Utils::updateLastHeard(Sender); - Utils::typeOfPacket(aprsPacket, "LoRa-APRS"); if (Sender != Config.callsign) { // avoid listening yourself by digirepeating + STATION_Utils::updateLastHeard(Sender); + Utils::typeOfPacket(aprsPacket, "LoRa-APRS"); AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2); Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":")); Addressee.trim(); - if (packet.indexOf("::") > 10 && Addressee == Config.callsign) { // its a message for me! queryMessage = processReceivedLoRaMessage(Sender, AddresseeAndMessage); } @@ -182,8 +181,6 @@ namespace APRS_IS_Utils { upload(aprsPacket); #endif Utils::println("---> Uploaded to APRS-IS"); - STATION_Utils::updateLastHeard(Sender); - Utils::typeOfPacket(aprsPacket, "LoRa-APRS"); show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0); } } diff --git a/src/query_utils.cpp b/src/query_utils.cpp index 334c72b..48c3a54 100644 --- a/src/query_utils.cpp +++ b/src/query_utils.cpp @@ -3,7 +3,6 @@ extern Configuration Config; extern std::vector lastHeardStation; -extern std::vector lastHeardStation_temp; extern String versionDate; diff --git a/src/station_utils.cpp b/src/station_utils.cpp index dbbbaa2..b10c82f 100644 --- a/src/station_utils.cpp +++ b/src/station_utils.cpp @@ -7,7 +7,6 @@ extern Configuration Config; extern std::vector lastHeardStation; -extern std::vector lastHeardStation_temp; extern std::vector outputPacketBuffer; extern uint32_t lastTxTime; extern uint32_t lastRxTime; @@ -17,6 +16,7 @@ extern String fourthLine; namespace STATION_Utils { void deleteNotHeard() { + std::vector lastHeardStation_temp; for (int i = 0; i < lastHeardStation.size(); i++) { String deltaTimeString = lastHeardStation[i].substring(lastHeardStation[i].indexOf(",") + 1); uint32_t deltaTime = deltaTimeString.toInt();