mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-04-09 00:14:55 +00:00
feat: serial kiss
This commit is contained in:
parent
2a5cc33711
commit
d9629d0929
17 changed files with 408 additions and 221 deletions
|
|
@ -26,28 +26,32 @@ namespace DIGI_Utils {
|
|||
|
||||
String generateDigiRepeatedPacket(String packet, String callsign) {
|
||||
String sender, temp0, tocall, path;
|
||||
sender = packet.substring(0,packet.indexOf(">"));
|
||||
temp0 = packet.substring(packet.indexOf(">")+1,packet.indexOf(":"));
|
||||
sender = packet.substring(0, packet.indexOf(">"));
|
||||
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) {
|
||||
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", callsign + "*");
|
||||
} else {
|
||||
path.replace("WIDE1-" + hop , callsign + "*,WIDE1-" + String(hop.toInt()-1));
|
||||
}
|
||||
else {
|
||||
path.replace("WIDE1-" + hop, callsign + "*,WIDE1-" + String(hop.toInt() - 1));
|
||||
}
|
||||
String repeatedPacket = sender + ">" + tocall + "," + path + packet.substring(packet.indexOf(":"));
|
||||
return repeatedPacket;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -56,34 +60,29 @@ namespace DIGI_Utils {
|
|||
bool queryMessage = false;
|
||||
String loraPacket, Sender, AddresseeAndMessage, Addressee;
|
||||
if (packet != "") {
|
||||
Serial.print("Received Lora Packet : " + String(packet));
|
||||
if (packet.substring(0, 3) == "\x3c\xff\x01") {
|
||||
Serial.println(" ---> APRS LoRa Packet");
|
||||
Sender = packet.substring(3,packet.indexOf(">"));
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
|
||||
if (Sender != Config.callsign) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
//STATION_Utils::updatePacketBuffer(packet);
|
||||
String sender = packet.substring(3, packet.indexOf(">"));
|
||||
STATION_Utils::updateLastHeard(sender);
|
||||
// STATION_Utils::updatePacketBuffer(packet);
|
||||
Utils::typeOfPacket(packet.substring(3), "Digi");
|
||||
AddresseeAndMessage = packet.substring(packet.indexOf("::")+2);
|
||||
Addressee = AddresseeAndMessage.substring(0,AddresseeAndMessage.indexOf(":"));
|
||||
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 = APRS_IS_Utils::processReceivedLoRaMessage(Sender,AddresseeAndMessage);
|
||||
queryMessage = APRS_IS_Utils::processReceivedLoRaMessage(Sender, AddresseeAndMessage);
|
||||
}
|
||||
if (!queryMessage && packet.indexOf("WIDE1-") > 10 && Config.digi.mode == 2) { // If should repeat packet (WIDE1 Digi)
|
||||
loraPacket = generateDigiRepeatedPacket(packet.substring(3), Config.callsign);
|
||||
if (loraPacket != "") {
|
||||
delay(500);
|
||||
Serial.println(loraPacket);
|
||||
LoRa_Utils::sendNewPacket("APRS", loraPacket);
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
} /*else {
|
||||
Serial.println(" ---> LoRa Packet Ignored (first 3 bytes or NOGATE)\n");
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue