[LoRaWAN] Fix dwelltime & JR-dr for AU915, add JR dwelltime check

This commit is contained in:
StevenCellist 2024-06-05 21:27:19 +02:00
parent aebbdd4c93
commit e42cd7e2a5
2 changed files with 11 additions and 2 deletions

View file

@ -36,6 +36,8 @@ LoRaWANNode::LoRaWANNode(PhysicalLayer* phy, const LoRaWANBand_t* band, uint8_t
this->difsSlots = 2;
this->backoffMax = 6;
this->enableCSMA = false;
this->dwellTimeEnabledUp = this->dwellTimeUp != 0;
this->dwellTimeEnabledDn = this->dwellTimeDn != 0;
memset(this->availableChannels, 0, sizeof(this->availableChannels));
}
@ -507,6 +509,13 @@ int16_t LoRaWANNode::activateOTAA(uint8_t joinDr, LoRaWANJoinEvent_t *joinEvent)
state = this->setPhyProperties(RADIOLIB_LORAWAN_CHANNEL_DIR_UPLINK);
RADIOLIB_ASSERT(state);
if(this->dwellTimeEnabledUp) {
RadioLibTime_t toa = this->phyLayer->getTimeOnAir(RADIOLIB_LORAWAN_JOIN_REQUEST_LEN);
if(toa > this->dwellTimeUp) {
return(RADIOLIB_ERR_DWELL_TIME_EXCEEDED);
}
}
// copy devNonce currently in use
uint16_t devNonceUsed = this->devNonce;

View file

@ -227,7 +227,7 @@ const LoRaWANBand_t AU915 = {
.powerMax = 30,
.powerNumSteps = 10,
.dutyCycle = 0,
.dwellTimeUp = 0,
.dwellTimeUp = RADIOLIB_LORAWAN_DWELL_TIME,
.dwellTimeDn = 0,
.txFreqs = {
RADIOLIB_LORAWAN_CHANNEL_NONE,
@ -247,7 +247,7 @@ const LoRaWANBand_t AU915 = {
.freqStep = 0.200,
.drMin = 0,
.drMax = 5,
.joinRequestDataRate = 0
.joinRequestDataRate = 2
},
{
.numChannels = 8,