[LoRaWAN] Prevent incorrect behaviour in restore()

This commit is contained in:
StevenCellist 2024-02-19 19:33:18 +01:00
parent 7bccb7f25c
commit 3d9db21387

View file

@ -82,6 +82,10 @@ int16_t LoRaWANNode::restore() {
return(RADIOLIB_ERR_NETWORK_NOT_JOINED);
}
if(!this->isActiveSession()) {
return(RADIOLIB_ERR_NETWORK_NOT_JOINED);
}
// pull all authentication keys from persistent storage
this->devAddr = mod->hal->getPersistentParameter<uint32_t>(RADIOLIB_EEPROM_LORAWAN_DEV_ADDR_ID);
mod->hal->readPersistentStorage(mod->hal->getPersistentAddr(RADIOLIB_EEPROM_LORAWAN_APP_S_KEY_ID), this->appSKey, RADIOLIB_AES128_BLOCK_SIZE);