diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index d012ce5..1163af5 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -64,8 +64,6 @@ uint32_t lastBatteryCheck = 0; String batteryVoltage; -std::vector lastHeardStation; -std::vector outputPacketBuffer; uint32_t lastTxTime = millis(); uint32_t lastRxTime = millis(); diff --git a/src/aprs_is_utils.cpp b/src/aprs_is_utils.cpp index 91c5883..a1f9109 100644 --- a/src/aprs_is_utils.cpp +++ b/src/aprs_is_utils.cpp @@ -159,29 +159,31 @@ namespace APRS_IS_Utils { 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(">")); if (Sender != Config.callsign) { // avoid listening yourself by digirepeating - STATION_Utils::updateLastHeard(Sender); - Utils::typeOfPacket(packet.substring(3), "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); - } - if (!queryMessage) { - aprsPacket = buildPacketToUpload(packet); - if (!Config.display.alwaysOn && Config.display.timeout != 0) { - display_toggle(true); + if (STATION_Utils::check25SegBuffer(Sender, packet.substring(packet.indexOf(":")+2))) { + STATION_Utils::updateLastHeard(Sender); + Utils::typeOfPacket(packet.substring(3), "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); + } + if (!queryMessage) { + aprsPacket = buildPacketToUpload(packet); + if (!Config.display.alwaysOn && Config.display.timeout != 0) { + display_toggle(true); + } + lastScreenOn = millis(); + #ifdef ESP32_DIY_LoRa_A7670 + stationBeacon = true; + A7670_Utils::uploadToAPRSIS(aprsPacket); + stationBeacon = false; + #else + upload(aprsPacket); + #endif + Utils::println("---> Uploaded to APRS-IS"); + show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0); } - lastScreenOn = millis(); - #ifdef ESP32_DIY_LoRa_A7670 - stationBeacon = true; - A7670_Utils::uploadToAPRSIS(aprsPacket); - stationBeacon = false; - #else - upload(aprsPacket); - #endif - Utils::println("---> Uploaded to APRS-IS"); - show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0); } } } diff --git a/src/station_utils.cpp b/src/station_utils.cpp index 373a26d..b65c8ed 100644 --- a/src/station_utils.cpp +++ b/src/station_utils.cpp @@ -6,12 +6,12 @@ #include extern Configuration Config; -extern std::vector lastHeardStation; -extern std::vector outputPacketBuffer; extern uint32_t lastTxTime; extern uint32_t lastRxTime; extern String fourthLine; +std::vector lastHeardStation; +std::vector outputPacketBuffer; std::vector packet25SegBuffer; std::vector packet25SegTimeBuffer; @@ -69,6 +69,7 @@ namespace STATION_Utils { void clean25SegBuffer() { if (!packet25SegTimeBuffer.empty()) { if (millis() - packet25SegTimeBuffer[0] > 25 * 1000) { + Serial.print("Borrando : "); Serial.println(packet25SegBuffer[0]); packet25SegTimeBuffer.erase(packet25SegTimeBuffer.begin()); packet25SegBuffer.erase(packet25SegBuffer.begin()); }