From 9e7756f6bcb2ea29e0ae34e1d086f87a0c8bfb6b Mon Sep 17 00:00:00 2001 From: richonguzman Date: Sat, 20 May 2023 01:03:14 -0400 Subject: [PATCH] casi listo para testeo inicial --- src/LoRa_APRS_iGate.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 1374a00..592d6dc 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -112,6 +112,15 @@ String createAPRSPacket(String unprocessedPacket) { return processedPacket; } +bool checkValidHeardStation(String station) { + for (int i=0; i LoRa Packet Tx"); + Serial.println(" ---> LoRa Packet Tx\n"); } void setup() { @@ -359,19 +368,27 @@ void loop() { if (espClient.available()) { String aprsisData, aprsisPacket, newLoraMessage, Sender, AddresseAndMessage, Addressee, Message; + bool validHeardStation = false; aprsisData = espClient.readStringUntil('\r'); // or '\n' aprsisPacket.concat(aprsisData); if (!aprsisPacket.startsWith("#")){ if (aprsisPacket.indexOf("::")>0) { newLoraMessage = process_aprsisPacket(aprsisPacket); - sendNewLoraPacket("APRS", newLoraMessage); - display_toggle(true); - lastRxTxTime = millis(); - Sender = newLoraMessage.substring(1,newLoraMessage.indexOf(">")); + Sender = newLoraMessage.substring(0,newLoraMessage.indexOf(">")); AddresseAndMessage = newLoraMessage.substring(newLoraMessage.indexOf("::")+2); Addressee = AddresseAndMessage.substring(0, AddresseAndMessage.indexOf(":")); + Addressee.trim(); Message = AddresseAndMessage.substring(AddresseAndMessage.indexOf(":")+1); - show_display(firstLine, secondLine, Sender + " -> " + Addressee, Message, 2000); + deleteNotHeardStation(); + validHeardStation = checkValidHeardStation(Addressee); + if (validHeardStation) { + sendNewLoraPacket("APRS", newLoraMessage); + display_toggle(true); + lastRxTxTime = millis(); + show_display(firstLine, secondLine, Sender + " -> " + Addressee, Message, 2000); + } else { + Serial.println(" ---> Station not Heard for last 30 min (Not Tx)"); + } } } }