mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-10-31 02:51:58 +01:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a472c307d3 | ||
|
|
fc256de09c | ||
|
|
9b5fa49e31 | ||
|
|
102169c0aa | ||
|
|
295d1fa2ef |
No files matched your search
+2
-1
@@ -7,4 +7,5 @@
|
||||
/data_embed/*.gz
|
||||
installer/firmware
|
||||
installer/*.bin
|
||||
**/__pycache__/
|
||||
**/__pycache__/
|
||||
.claude/
|
||||
@@ -20,7 +20,7 @@ ____________________________________________________
|
||||
|
||||
| New Menu | Map |
|
||||
| --- | --- |
|
||||
|  |  |
|
||||
|  |  |
|
||||
|
||||
____________________________________________________
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 125 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 396 KiB |
@@ -68,7 +68,7 @@ ___________________________________________________________________*/
|
||||
#endif
|
||||
|
||||
|
||||
String versionDate = "2026-09-23";
|
||||
String versionDate = "2026-09-29";
|
||||
String versionNumber = "4.0.1";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
|
||||
+6
-3
@@ -110,9 +110,10 @@ namespace DIGI_Utils {
|
||||
int digiMode = Config.digi.mode;
|
||||
String tempPath = path;
|
||||
|
||||
if (tempPath.indexOf("WIDE1-1") != -1 && (digiMode == 1 || digiMode == 2)) { // WIDE1-1
|
||||
if (tempPath.indexOf("WIDE1-1") != -1 && (digiMode == 1 || digiMode == 2 || backupDigiMode)) { // WIDE1-1
|
||||
if (tempPath.indexOf("*") != -1 ) return ""; // "*" shouldn't be in WIDE1-1 (only) type of packet
|
||||
tempPath.replace("WIDE1-1", stationCallsign + "*");
|
||||
if (pathTokenIndex(tempPath, "WIDE1-1") != 0) return ""; // WIDE1-1 must be the first hop
|
||||
tempPath = stationCallsign + "*" + tempPath.substring(7);
|
||||
} else if (tempPath.indexOf("WIDE2-") != -1 && digiMode == 2) { // WIDE2-n Digipeater
|
||||
tempPath = cleanPath(path);
|
||||
int idx = pathTokenIndex(tempPath, "WIDE2-1");
|
||||
@@ -130,8 +131,10 @@ namespace DIGI_Utils {
|
||||
packetToRepeat = packet.substring(0, packet.indexOf(",") + 1);
|
||||
packetToRepeat += tempPath;
|
||||
} else { // CrossFreq Digipeater
|
||||
String cleanedPath = cleanPath(path);
|
||||
if (pathTokenIndex(cleanedPath, stationCallsign) != -1 ||
|
||||
pathTokenIndex(cleanedPath, stationCallsign + "*") != -1) return ""; // stationCallsign shouldn't be in path (exact token, path only)
|
||||
packetToRepeat = cleanPath(packet.substring(0, suffixIndex));
|
||||
if (packetToRepeat.indexOf(stationCallsign) != -1) return ""; // stationCallsign shouldn't be in path
|
||||
packetToRepeat += ",";
|
||||
packetToRepeat += stationCallsign;
|
||||
packetToRepeat += "*";
|
||||
|
||||
+27
-10
@@ -41,6 +41,8 @@ bool transmitFlag = true;
|
||||
|
||||
#define DIFS_SLOTS 2 // Number of secuential CAD slots to consider a free channel to Tx
|
||||
int backoffMax = 4; // Max Backoff value (number of CAD slots to wait before Tx)
|
||||
#define CAD_MAX_WAIT_MS 10000 // Max total time waiting for a free channel, then the packet is dropped
|
||||
unsigned long cadStartTime = 0;
|
||||
|
||||
#ifdef HAS_SX1262
|
||||
SX1262 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN);
|
||||
@@ -195,8 +197,13 @@ namespace LoRa_Utils {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cadTimedOut() {
|
||||
return millis() - cadStartTime > CAD_MAX_WAIT_MS;
|
||||
}
|
||||
|
||||
void waitForDIFS() {
|
||||
while (!doDIFS()) {
|
||||
if (cadTimedOut()) return;
|
||||
Serial.println("CAD/DIFS failed, retry...");
|
||||
}
|
||||
}
|
||||
@@ -204,6 +211,7 @@ namespace LoRa_Utils {
|
||||
void doBEB() {
|
||||
int backoffCounter = random(1, backoffMax + 1);
|
||||
while (backoffCounter > 0) {
|
||||
if (cadTimedOut()) return;
|
||||
if (doCAD()) {
|
||||
waitForDIFS(); // busy channel: freeze backoff and restart DIFS
|
||||
} else {
|
||||
@@ -225,22 +233,30 @@ namespace LoRa_Utils {
|
||||
if (Config.digi.ecoMode != 1) digitalWrite(INTERNAL_LED_PIN, HIGH); // disabled in Ultra Eco Mode
|
||||
#endif
|
||||
|
||||
bool cadDropped = false;
|
||||
if (Config.loramodule.cadActive) {
|
||||
cadStartTime = millis();
|
||||
waitForDIFS(); // DIFS (Distributed Inter-Frame Space)
|
||||
doBEB(); // BEB (Binary Exponential Backoff)
|
||||
if (cadTimedOut()) {
|
||||
Utils::println("CAD timeout, packet dropped: " + newPacket);
|
||||
cadDropped = true;
|
||||
}
|
||||
}
|
||||
|
||||
int state = radio.transmit("\x3c\xff\x01" + newPacket);
|
||||
transmitFlag = true;
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
if (Config.syslog.active && networkManager->isConnected()) {
|
||||
SYSLOG_Utils::logLoRaTx(newPacket);
|
||||
if (!cadDropped) {
|
||||
int state = radio.transmit("\x3c\xff\x01" + newPacket);
|
||||
transmitFlag = true;
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
if (Config.syslog.active && networkManager->isConnected()) {
|
||||
SYSLOG_Utils::logLoRaTx(newPacket);
|
||||
}
|
||||
Utils::print("---> LoRa Packet Tx : ");
|
||||
Utils::println(newPacket);
|
||||
} else {
|
||||
Utils::print(F("failed, code "));
|
||||
Utils::println(String(state));
|
||||
}
|
||||
Utils::print("---> LoRa Packet Tx : ");
|
||||
Utils::println(newPacket);
|
||||
} else {
|
||||
Utils::print(F("failed, code "));
|
||||
Utils::println(String(state));
|
||||
}
|
||||
#ifdef INTERNAL_LED_PIN
|
||||
if (Config.digi.ecoMode != 1) digitalWrite(INTERNAL_LED_PIN, LOW); // disabled in Ultra Eco Mode
|
||||
@@ -250,6 +266,7 @@ namespace LoRa_Utils {
|
||||
changeFreqRx();
|
||||
}
|
||||
}
|
||||
if (cadDropped) radio.startReceive(); // no Tx end IRQ will restart Rx
|
||||
}
|
||||
|
||||
String receivePacketFromSleep() {
|
||||
|
||||
Reference in new issue
Block a user