Skip to content

Commit

Permalink
[LoRaWAN] Fix persistence of channel mask (fixes #1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenCellist committed Oct 28, 2024
1 parent 0156c90 commit 4121368
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/protocols/LoRaWAN/LoRaWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2917,10 +2917,9 @@ void LoRaWANNode::getChannelPlanMask(uint64_t* chMaskGrp0123, uint32_t* chMaskGr
*chMaskGrp0123 = 0;
*chMaskGrp45 = 0;

uint8_t numCh = this->getAvailableChannels(NULL);

// if there are any channels selected, create the mask from those channels
if(numCh > 0) {
// channels are always selected for dynamic bands and/or when a device is active
if(this->band->bandType == RADIOLIB_LORAWAN_BAND_DYNAMIC || this->isActivated()) {
for(int i = 0; i < RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS; i++) {
uint8_t idx = this->channelPlan[RADIOLIB_LORAWAN_UPLINK][i].idx;
if(idx != RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE) {
Expand All @@ -2932,12 +2931,6 @@ void LoRaWANNode::getChannelPlanMask(uint64_t* chMaskGrp0123, uint32_t* chMaskGr
}
}
return;
}

// it should not happen that no channels are set for dynamic band
// but in that case, simply return
if(this->band->bandType == RADIOLIB_LORAWAN_BAND_DYNAMIC) {
return;

} else { // bandType == RADIOLIB_LORAWAN_BAND_FIXED
// if a subband is set, we can set the channel indices straight from subband
Expand Down

0 comments on commit 4121368

Please sign in to comment.