Update CSMA logic to take SlotTime into account

pull/15/head
sh123 2020-12-08 15:15:28 +02:00
rodzic 6e3c25bf29
commit a33ff5cd30
2 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -148,7 +148,7 @@ void Service::loop()
onLoraDataAvailable(packetSize);
}
// TX path
else if (random(0, 255) < CfgCsmaProbBoundary) {
else if (random(0, 255) < CfgCsmaPersistence) {
if (serialBt_.available()) {
onBtDataAvailable();
}
@ -159,6 +159,9 @@ void Service::loop()
sendPeriodicBeacon();
}
}
else {
delay(CfgCsmaSlotTimeMs);
}
delay(CfgPollDelayMs);
}

Wyświetl plik

@ -66,11 +66,11 @@ private:
const String CfgLoraprsVersion = "LoRAPRS 0.1";
// tune depending on TOA, higher value for higher time on air
const int CfgPollDelayMs = 500;
const int CfgPollDelayMs = 10;
// tx when lower than this value from random 0..255, use lower value for high traffic
const long CfgCsmaProbBoundary = 100;
const long CfgCsmaPersistence = 100;
const long CfgCsmaSlotTimeMs = 500;
const byte CfgPinSs = 5;
const byte CfgPinRst = 26;