digimode 3 improvement

This commit is contained in:
richonguzman 2024-08-05 15:42:33 -04:00
parent b763b4af78
commit b9e2c0e8f0
1 changed files with 12 additions and 3 deletions

View File

@ -30,10 +30,10 @@ namespace DIGI_Utils {
if (Config.digi.mode == 2) {
tempPath.replace("WIDE1-1", Config.callsign + "*");
} else if (Config.digi.mode == 3) {
if (path.indexOf("WIDE1-1")) {
if (path.indexOf("WIDE1-1") != -1) {
tempPath.replace("WIDE1-1", Config.callsign + "*");
}
if (path.indexOf("WIDE2-1")) {
if (path.indexOf("WIDE2-1") != -1) {
tempPath.replace("WIDE2-1", Config.callsign + "*");
}
if (path.indexOf(Config.callsign + "*," + Config.callsign + "*")) {
@ -59,8 +59,17 @@ namespace DIGI_Utils {
}
if (temp.indexOf(",") > 2) { // checks for path
const String& path = temp.substring(temp.indexOf(",") + 1); // after tocall
if ((Config.digi.mode == 2 && path.indexOf("WIDE1-1") != - 1) || (Config.digi.mode == 3 && (path.indexOf("WIDE1-1") != - 1 || path.indexOf("WIDE2-1") != -1))) {
if (Config.digi.mode == 2 && path.indexOf("WIDE1-1") != - 1) {
return buildPacket(path, packet, thirdParty);
} else if (Config.digi.mode == 3) {
int wide1Index = path.indexOf("WIDE1-1");
int wide2Index = path.indexOf("WIDE2-1");
if ((wide1Index != -1 && wide2Index == -1) || (wide1Index != -1 && wide2Index != -1 && wide1Index < wide2Index) || (wide1Index == -1 && wide2Index != -1)) {
return buildPacket(path, packet, thirdParty);
} else {
return "";
}
} else {
return "";
}