Update CSMA logic

pull/15/head
sh123 2020-12-08 15:26:14 +02:00
rodzic 0ee6fa034d
commit 79acf18f98
2 zmienionych plików z 15 dodań i 13 usunięć

Wyświetl plik

@ -148,19 +148,21 @@ void Service::loop()
onLoraDataAvailable(packetSize); onLoraDataAvailable(packetSize);
} }
// TX path // TX path
else if (random(0, 255) < CfgCsmaPersistence) {
if (serialBt_.available()) {
onBtDataAvailable();
}
else if (aprsisConn_.available() > 0) {
onAprsisDataAvailable();
}
else if (needsBeacon()) {
sendPeriodicBeacon();
}
}
else { else {
delay(CfgCsmaSlotTimeMs); if (random(0, 255) < CfgCsmaPersistence) {
if (serialBt_.available()) {
onBtDataAvailable();
}
else if (aprsisConn_.available() > 0) {
onAprsisDataAvailable();
}
else if (needsBeacon()) {
sendPeriodicBeacon();
}
}
else {
delay(CfgCsmaSlotTimeMs);
}
} }
delay(CfgPollDelayMs); delay(CfgPollDelayMs);
} }

Wyświetl plik

@ -66,7 +66,7 @@ private:
const String CfgLoraprsVersion = "LoRAPRS 0.1"; const String CfgLoraprsVersion = "LoRAPRS 0.1";
const int CfgPollDelayMs = 10; const int CfgPollDelayMs = 1;
// tx when lower than this value from random 0..255 // tx when lower than this value from random 0..255
// use lower value for high traffic, use 255 for real time // use lower value for high traffic, use 255 for real time