[LoRaWAN] Fix ADR bug if not enabled

This commit is contained in:
StevenCellist 2024-01-05 13:41:00 +01:00
parent 00264f48a9
commit f7730463bd

View file

@ -912,10 +912,11 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port, bool isConf
// increase frame counter by one
this->fcntUp += 1;
bool adrAckReq = false;
if(this->adrEnabled) {
// check if we need to do ADR stuff
uint32_t adrLimit = 0x01 << this->adrLimitExp;
uint32_t adrDelay = 0x01 << this->adrDelayExp;
bool adrAckReq = false;
if((this->fcntUp - this->adrFcnt) >= adrLimit) {
adrAckReq = true;
}
@ -959,6 +960,7 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port, bool isConf
// we tried something to improve the range, so increase the ADR frame counter by 'ADR delay'
this->adrFcnt += adrDelay;
}
}
// configure for uplink
this->selectChannels();