Skip to content

Commit

Permalink
[LoRaWAN] add new keywords, add debug guard
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenCellist committed Nov 11, 2023
1 parent 84bb8da commit 966ab6c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 10 additions & 5 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ setSyncWord KEYWORD2
setOutputPower KEYWORD2
setCurrentLimit KEYWORD2
setPreambleLength KEYWORD2
invertPreamble KEYWORD2
setGain KEYWORD2
getFrequencyError KEYWORD2
getRSSI KEYWORD2
Expand Down Expand Up @@ -222,7 +221,6 @@ spectralScanStart KEYWORD2
spectralScanAbort KEYWORD2
spectralScanGetStatus KEYWORD2
spectralScanGetResult KEYWORD2
setPaConfig KEYWORD2

# nRF24
setIrqAction KEYWORD2
Expand Down Expand Up @@ -291,12 +289,18 @@ setModem KEYWORD2

# LoRaWAN
wipe KEYWORD2
restoreOTAA KEYWORD2
restore KEYWORD2
beginOTAA KEYWORD2
beginABP KEYWORD2
saveSession KEYWORD2
uplink KEYWORD2
downlink KEYWORD2
configureChannel KEYWORD2
sendReceive KEYWORD2
setDeviceStatus KEYWORD2
setDatarate KEYWORD2
setADR KEYWORD2
selectSubband KEYWORD2
setCSMA KEYWORD2

#######################################
# Constants (LITERAL1)
Expand Down Expand Up @@ -408,4 +412,5 @@ RADIOLIB_ERR_COMMAND_QUEUE_EMPTY LITERAL1
RADIOLIB_ERR_COMMAND_QUEUE_ITEM_NOT_FOUND LITERAL1
RADIOLIB_ERR_JOIN_NONCE_INVALID LITERAL1
RADIOLIB_ERR_N_FCNT_DOWN_INVALID LITERAL1
RADIOLIB_ERR_A_FCNT_DOWN_INVALID LITERAL1
RADIOLIB_ERR_A_FCNT_DOWN_INVALID LITERAL1
RADIOLIB_ERR_DATA_RATE_INVALID LITERAL1
12 changes: 7 additions & 5 deletions src/protocols/LoRaWAN/LoRaWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ int16_t LoRaWANNode::restore() {

// check the magic value
if(mod->hal->getPersistentParameter<uint16_t>(RADIOLIB_PERSISTENT_PARAM_LORAWAN_MAGIC_ID) != RADIOLIB_LORAWAN_MAGIC) {
RADIOLIB_DEBUG_PRINTLN("magic id not set (no saved session)");
RADIOLIB_DEBUG_PRINTLN("first 16 bytes of NVM:");
uint8_t nvmBuff[16];
mod->hal->readPersistentStorage(mod->hal->getPersistentAddr(0), nvmBuff, 16);
RADIOLIB_DEBUG_HEXDUMP(nvmBuff, 16);
#if defined(RADIOLIB_DEBUG)
RADIOLIB_DEBUG_PRINTLN("magic id not set (no saved session)");
RADIOLIB_DEBUG_PRINTLN("first 16 bytes of NVM:");
uint8_t nvmBuff[16];
mod->hal->readPersistentStorage(mod->hal->getPersistentAddr(0), nvmBuff, 16);
RADIOLIB_DEBUG_HEXDUMP(nvmBuff, 16);
#endif
// the magic value is not set, user will have to do perform the join procedure
return(RADIOLIB_ERR_NETWORK_NOT_JOINED);
}
Expand Down

0 comments on commit 966ab6c

Please sign in to comment.