[LoRaWAN] Added check to not uplink in Rx slots

This commit is contained in:
jgromes 2023-08-12 21:48:31 +02:00
parent 45c376bde6
commit 1ed22717d7
2 changed files with 9 additions and 3 deletions

View file

@ -518,6 +518,11 @@
*/
#define RADIOLIB_ERR_INVALID_CID (-1107)
/*!
\brief User requested to start uplink while still inside RX window.
*/
#define RADIOLIB_ERR_UPLINK_UNAVAILABLE (-1108)
/*!
\}
*/

View file

@ -342,9 +342,10 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port) {
// check if sufficient time has elapsed since the last uplink
Module* mod = this->phyLayer->getMod();
/*if(mod->hal->millis() - this->rxDelayStart < ) {
}*/
if(mod->hal->millis() - this->rxDelayStart < rxDelays[1]) {
// not enough time elapsed since the last uplink, we may still be in an RX window
return(RADIOLIB_ERR_UPLINK_UNAVAILABLE);
}
// build the uplink message
// the first 16 bytes are reserved for MIC calculation blocks