CubeCell-Arduino
CubeCell-Arduino copied to clipboard
Join Procedure Timeout
Hello, I would like to know if it is possible to set a timeout for the Join procedure in order to abort the execution when no messages are received. As I reviewed in the code, currently only undefined re-join is supported, despite number of trials is established to 1.
I would like to stop it if no responses are received because the device is in an out-of-coverage area, and put the device in low power mode for a period of time.
Thanks!
you can set a timer manually and after it is resolved then manually go into sleep
DEBUGPRINTLN("could not join after 7 minutes to any network. will sleep forever now :(");
TimerStop( &CancelJoinAttemptsTimer ); //reset timer
//make sure any attempt will not work by scrambling the identifiers
appEui[0] = 0x00;
appEui[1] = 0x00;
appEui[2] = 0x00;
devEui[0] = 0x00;
devEui[1] = 0x00;
devEui[2] = 0x00;
appKey[0] = 0x00;
appKey[1] = 0x00;
appKey[2] = 0x00;
LoRaWAN.init(loraWanClass,loraWanRegion); //init again so that any join attempt is stoped
deviceState=DEVICE_STATE_SLEEP;
factoryMode=true;
void loop()
{
if(factoryMode){
LoRaWAN.sleep();
}else{
.....