[debug](trx-backend-soapysdr): trace SDR retune application
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -288,15 +288,39 @@ fn iq_read_loop(
|
|||||||
let mut zero_read_streak: u32 = 0;
|
let mut zero_read_streak: u32 = 0;
|
||||||
let mut overflow_log_window_start: Option<Instant> = None;
|
let mut overflow_log_window_start: Option<Instant> = None;
|
||||||
let mut overflow_log_suppressed: u32 = 0;
|
let mut overflow_log_suppressed: u32 = 0;
|
||||||
|
let mut retune_seq: u64 = 0;
|
||||||
|
let mut last_applied_retune_hz: Option<f64> = None;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
// Apply any pending hardware retune before the next read.
|
// Apply any pending hardware retune before the next read.
|
||||||
if let Ok(mut cmd) = retune_cmd.try_lock() {
|
if let Ok(mut cmd) = retune_cmd.try_lock() {
|
||||||
if let Some(hz) = cmd.take() {
|
if let Some(hz) = cmd.take() {
|
||||||
|
retune_seq = retune_seq.wrapping_add(1);
|
||||||
|
let started = Instant::now();
|
||||||
|
tracing::warn!(
|
||||||
|
"SDR retune request #{} starting: target={:.0} Hz, last_applied={}",
|
||||||
|
retune_seq,
|
||||||
|
hz,
|
||||||
|
last_applied_retune_hz
|
||||||
|
.map(|value| format!("{value:.0} Hz"))
|
||||||
|
.unwrap_or_else(|| "none".to_string())
|
||||||
|
);
|
||||||
if let Err(e) = source.set_center_freq(hz) {
|
if let Err(e) = source.set_center_freq(hz) {
|
||||||
tracing::warn!("SDR retune to {:.0} Hz failed: {}", hz, e);
|
tracing::warn!(
|
||||||
|
"SDR retune request #{} failed after {:?}: target={:.0} Hz: {}",
|
||||||
|
retune_seq,
|
||||||
|
started.elapsed(),
|
||||||
|
hz,
|
||||||
|
e
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
tracing::info!("SDR retuned to {:.0} Hz", hz);
|
last_applied_retune_hz = Some(hz);
|
||||||
|
tracing::info!(
|
||||||
|
"SDR retune request #{} applied in {:?}: {:.0} Hz",
|
||||||
|
retune_seq,
|
||||||
|
started.elapsed(),
|
||||||
|
hz
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user