Digipeater Fixes

pull/369/head
Mike 2024-11-02 17:27:58 -07:00
rodzic a8c771f0d2
commit 6f803a9908
1 zmienionych plików z 21 dodań i 13 usunięć

Wyświetl plik

@ -550,23 +550,31 @@ class AprsService extends Service {
// Skip digipeating if callssid* is found
return (lastUsedDigi, false) // Return the original path, do not modify
} else if (!hasModified && component.startsWith(digipeaterpath)) {
// Handle the first unused WIDE path
component match {
case w if w.endsWith("-2") =>
// Change -2 to -1 and insert callssid* before it
(acc :+ s"$callssid*" :+ w.stripSuffix("-2") + "-1", true)
case w if w.endsWith("-1") =>
// Remove the WIDE component entirely and insert callssid*
(acc :+ s"$callssid*", true)
case _ =>
// Leave unchanged if there's no -1 or -2
(acc :+ component, hasModified)
// We need to check if the first unused component matches digipeaterpath
if (acc.isEmpty || acc.last.endsWith("*")) {
// This is the first unused component
component match {
case w if w.endsWith("-2") =>
// Change -2 to -1 and insert callssid* before it
(acc :+ s"$callssid*" :+ w.stripSuffix("-2") + "-1", true)
case w if w.endsWith("-1") =>
// Remove the WIDE component entirely and insert callssid*
(acc :+ s"$callssid*", true)
case _ =>
// Leave unchanged if there's no -1 or -2
(acc :+ component, hasModified)
}
} else {
// If the first unused component doesn't match digipeaterpath, keep unchanged
(acc :+ component, hasModified)
}
} else if (component.startsWith(callssid) && !component.endsWith("*")) {
// Replace callssid with callssid* only if it hasn't been modified
} else if (component == callssid) {
// Check if it's the first unused component without *
if (!hasModified) {
// Replace callssid with callssid* only if it hasn't been modified
(acc :+ s"$callssid*", true)
} else {
// Keep the component as it is
(acc :+ component, hasModified)
}
} else {