From 005f114a97262815ab64d7544e943e3bfe8310c4 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Mon, 3 Jun 2024 00:02:43 -0400 Subject: [PATCH] more - less code --- src/LoRa_APRS_iGate.cpp | 2 +- src/digi_utils.cpp | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 734e8cc..bc5d424 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -154,7 +154,7 @@ void loop() { String packet = ""; if (Config.loramodule.rxActive) { packet = LoRa_Utils::receivePacket(); // We need to fetch LoRa packet above APRSIS and Digi - } + } if (packet != "") { if (Config.aprs_is.active) { // If APRSIS enabled diff --git a/src/digi_utils.cpp b/src/digi_utils.cpp index e75fd3c..eca2e21 100644 --- a/src/digi_utils.cpp +++ b/src/digi_utils.cpp @@ -25,39 +25,33 @@ extern bool backUpDigiMode; namespace DIGI_Utils { String generateDigiRepeatedPacket(const String& packet){ - String sender, temp0, tocall, path; - sender = packet.substring(0, packet.indexOf(">")); + String temp0, path; temp0 = packet.substring(packet.indexOf(">") + 1, packet.indexOf(":")); if (temp0.indexOf(",") > 2) { - tocall = temp0.substring(0, temp0.indexOf(",")); path = temp0.substring(temp0.indexOf(",") + 1, temp0.indexOf(":")); if (path.indexOf("WIDE1-") >= 0) { String hop = path.substring(path.indexOf("WIDE1-") + 6, path.indexOf("WIDE1-") + 7); if (hop.toInt() >= 1 && hop.toInt() <= 7) { if (hop.toInt() == 1) { path.replace("WIDE1-1", Config.callsign + "*"); - } - else { + } else { path.replace("WIDE1-" + hop, Config.callsign + "*,WIDE1-" + String(hop.toInt() - 1)); } - String repeatedPacket = sender; + String repeatedPacket = packet.substring(0, packet.indexOf(">")); // sender repeatedPacket += ">"; - repeatedPacket += tocall; + repeatedPacket += temp0.substring(0, temp0.indexOf(",")); // tocall repeatedPacket += ","; repeatedPacket += path; repeatedPacket += packet.substring(packet.indexOf(":")); return repeatedPacket; - } - else { + } else { return ""; } - } - else { + } else { return ""; } - } - else { + } else { return ""; } }