Fix sending channel-mask twice for US915 (like).

This commit is contained in:
Orne Brocaar 2023-07-03 12:27:26 +01:00
parent 258e103f22
commit 4031c5cb95
2 changed files with 44 additions and 27 deletions

View File

@ -791,9 +791,8 @@ impl JoinRequest {
device_profile.reset_session_to_boot_params(&mut ds); device_profile.reset_session_to_boot_params(&mut ds);
if let Some(CFList::Channels(channels)) = match region_conf.get_cf_list(device_profile.mac_version) {
region_conf.get_cf_list(device_profile.mac_version) Some(CFList::Channels(channels)) => {
{
for f in channels.iter().cloned() { for f in channels.iter().cloned() {
if f == 0 { if f == 0 {
continue; continue;
@ -821,6 +820,20 @@ impl JoinRequest {
); );
} }
} }
Some(CFList::ChannelMask(masks)) => {
ds.enabled_uplink_channel_indices = vec![];
for (block_i, block) in masks.iter().enumerate() {
for (channel_i, enabled) in block.into_iter().enumerate() {
if enabled {
ds.enabled_uplink_channel_indices
.push((channel_i + (block_i * 16)) as u32);
}
}
}
}
None => {}
}
device_session::save(&ds) device_session::save(&ds)
.await .await

View File

@ -141,6 +141,10 @@ impl CFListChannelMasks {
Ok(b) Ok(b)
} }
pub fn iter(&self) -> std::slice::Iter<'_, ChMask> {
self.0.iter()
}
} }
/// ChMask encodes the channels usable for uplink access. 0 = channel 1, /// ChMask encodes the channels usable for uplink access. 0 = channel 1,