Skip to content

Commit

Permalink
Remove Class-B beacon frequency correction.
Browse files Browse the repository at this point in the history
This was copied over from the Semtech UDP Packet Forwarder, but should
have been implemented on dequeue instead of enqueue, as the enqueue is
happening in the future. For now this is removed, as it might need
further research if this logic is needed or not. It is present in the
Semtech UDP Packet Forwarder, but I could not find the same logic in the
Basics Station.

If this is needed, it must be implemented on dequeue, to make sure that
we compensate the frequency with the xtal_correct value as close to the
actual transmission as possible.

For now this is removed as on sending the downlink, the Concentratord
aggregates the downlink count on frequency. Before this change it would
generate a many different frequencies as the xtal_correct value is
variable.
  • Loading branch information
brocaar committed Aug 31, 2021
1 parent c350f0e commit 97c727d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
7 changes: 1 addition & 6 deletions chirpstack-concentratord-sx1301/src/handler/beacon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,10 @@ fn send_beacon(
beacon_pl.resize(data.len(), 0);
data.copy_from_slice(&beacon_pl);

let xtal_correct = match gps::get_xtal_correct() {
Ok(v) => v,
Err(err) => return Err(err),
};

let tx_freq = conf.frequencies
[((beacon_time.as_secs() % (1 << 32)) % conf.frequencies.len() as u64) as usize];
let tx_packet = hal::TxPacket {
freq_hz: (tx_freq as f64 * xtal_correct) as u32,
freq_hz: tx_freq,
tx_mode: hal::TxMode::OnGPS,
count_us: match gps::epoch2cnt(&beacon_time) {
Ok(v) => v,
Expand Down
8 changes: 0 additions & 8 deletions chirpstack-concentratord-sx1301/src/handler/gps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,6 @@ pub fn get_gps_epoch() -> Result<Duration, String> {
return Ok(GPS_TIME_REF.lock().unwrap().gps_epoch);
}

pub fn get_xtal_correct() -> Result<f64, String> {
if *XTAL_CORRECT_OK.lock().unwrap() == false {
return Err("no valid xtal correction value available yet".to_string());
}

return Ok(*XTAL_CORRECT.lock().unwrap());
}

fn gps_process_sync() {
let (gps_time, gps_epoch, _, _) = match gps::get(true, false) {
Ok(v) => v,
Expand Down

0 comments on commit 97c727d

Please sign in to comment.