mirror of
https://github.com/chirpstack/chirpstack.git
synced 2024-12-22 14:32:24 +00:00
Fix CN470 ping-slot frequencies + add comments.
The frequency-hopping ping-slots are equal to the beacon frequencys. With the US915 and AU915 channels using the Class-A downlink channels as beacon-frequencies, this was wrongly implemented in the same way, but in case of CN470 the beacon-frequencies are not equal to the Class-A downlink frequencies.
This commit is contained in:
parent
a284a8179e
commit
318f097344
@ -987,6 +987,8 @@ impl Region for Configuration {
|
|||||||
let down_channel = (u32::from_be_bytes(dev_addr.to_be_bytes()) as usize
|
let down_channel = (u32::from_be_bytes(dev_addr.to_be_bytes()) as usize
|
||||||
+ (beacon_time.as_secs() / 128) as usize)
|
+ (beacon_time.as_secs() / 128) as usize)
|
||||||
% 8;
|
% 8;
|
||||||
|
|
||||||
|
// Beaconing is performed on the same channel that normal downstream traffic as defined in the Class A specification.
|
||||||
Ok(self.base.downlink_channels[down_channel].frequency)
|
Ok(self.base.downlink_channels[down_channel].frequency)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +454,12 @@ impl Region for Configuration {
|
|||||||
let down_channel = (u32::from_be_bytes(dev_addr.to_be_bytes()) as usize
|
let down_channel = (u32::from_be_bytes(dev_addr.to_be_bytes()) as usize
|
||||||
+ (beacon_time.as_secs() / 128) as usize)
|
+ (beacon_time.as_secs() / 128) as usize)
|
||||||
% 8;
|
% 8;
|
||||||
Ok(self.base.downlink_channels[down_channel].frequency)
|
|
||||||
|
let beacon_freqs: Vec<u32> = vec![
|
||||||
|
508300000, 508500000, 508700000, 508900000, 509100000, 509300000, 509500000, 509700000,
|
||||||
|
];
|
||||||
|
|
||||||
|
Ok(beacon_freqs[down_channel])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_downlink_tx_power(&self, _freq: u32) -> isize {
|
fn get_downlink_tx_power(&self, _freq: u32) -> isize {
|
||||||
@ -594,7 +599,7 @@ mod tests {
|
|||||||
let beacon_time = Duration::from_secs((334382 * 60 * 60) + (52 * 60) + 44);
|
let beacon_time = Duration::from_secs((334382 * 60 * 60) + (52 * 60) + 44);
|
||||||
|
|
||||||
let freq = c.get_ping_slot_frequency(dev_addr, beacon_time).unwrap();
|
let freq = c.get_ping_slot_frequency(dev_addr, beacon_time).unwrap();
|
||||||
assert_eq!(501100000, freq);
|
assert_eq!(509100000, freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -675,6 +675,8 @@ impl Region for Configuration {
|
|||||||
let down_channel = (u32::from_be_bytes(dev_addr.to_be_bytes()) as usize
|
let down_channel = (u32::from_be_bytes(dev_addr.to_be_bytes()) as usize
|
||||||
+ (beacon_time.as_secs() / 128) as usize)
|
+ (beacon_time.as_secs() / 128) as usize)
|
||||||
% 8;
|
% 8;
|
||||||
|
|
||||||
|
// Beaconing is performed on the same channel that normal downstream traffic as defined in the Class A specification.
|
||||||
Ok(self.base.downlink_channels[down_channel].frequency)
|
Ok(self.base.downlink_channels[down_channel].frequency)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user