diff --git a/src/TypeDef.h b/src/TypeDef.h index e24675b2..96058827 100644 --- a/src/TypeDef.h +++ b/src/TypeDef.h @@ -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) + /*! \} */ diff --git a/src/protocols/LoRaWAN/LoRaWAN.cpp b/src/protocols/LoRaWAN/LoRaWAN.cpp index b31abbb2..c2cd77d7 100644 --- a/src/protocols/LoRaWAN/LoRaWAN.cpp +++ b/src/protocols/LoRaWAN/LoRaWAN.cpp @@ -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