[feat](trx-server): make VFO priming optional via behavior.vfo_prime config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -187,6 +187,9 @@ pub struct BehaviorConfig {
|
|||||||
pub max_retries: u32,
|
pub max_retries: u32,
|
||||||
/// Base delay for exponential backoff in milliseconds
|
/// Base delay for exponential backoff in milliseconds
|
||||||
pub retry_base_delay_ms: u64,
|
pub retry_base_delay_ms: u64,
|
||||||
|
/// Whether to prime both VFOs on startup by toggling and reading each.
|
||||||
|
/// Defaults to true for rigs with dual VFOs (e.g. FT-817).
|
||||||
|
pub vfo_prime: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BehaviorConfig {
|
impl Default for BehaviorConfig {
|
||||||
@@ -196,6 +199,7 @@ impl Default for BehaviorConfig {
|
|||||||
poll_interval_tx_ms: 100,
|
poll_interval_tx_ms: 100,
|
||||||
max_retries: 3,
|
max_retries: 3,
|
||||||
retry_base_delay_ms: 100,
|
retry_base_delay_ms: 100,
|
||||||
|
vfo_prime: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ fn build_rig_task_config(
|
|||||||
pskreporter_status,
|
pskreporter_status,
|
||||||
aprs_is_status,
|
aprs_is_status,
|
||||||
histories,
|
histories,
|
||||||
|
vfo_prime: rig_cfg.behavior.vfo_prime,
|
||||||
prebuilt_rig: None,
|
prebuilt_rig: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ pub struct RigTaskConfig {
|
|||||||
/// Per-rig decoder history store. Used by Reset* commands to clear the
|
/// Per-rig decoder history store. Used by Reset* commands to clear the
|
||||||
/// history and by the audio listener to serve history on connection.
|
/// history and by the audio listener to serve history on connection.
|
||||||
pub histories: Arc<DecoderHistories>,
|
pub histories: Arc<DecoderHistories>,
|
||||||
|
/// Whether to prime both VFOs on startup by toggling and reading each.
|
||||||
|
pub vfo_prime: bool,
|
||||||
/// Pre-built rig backend. When `Some`, the registry factory is skipped.
|
/// Pre-built rig backend. When `Some`, the registry factory is skipped.
|
||||||
/// Used by the SDR path in `main.rs` to pass a fully-configured
|
/// Used by the SDR path in `main.rs` to pass a fully-configured
|
||||||
/// `SoapySdrRig` (built with channel config) without duplicating the
|
/// `SoapySdrRig` (built with channel config) without duplicating the
|
||||||
@@ -81,6 +83,7 @@ impl Default for RigTaskConfig {
|
|||||||
pskreporter_status: None,
|
pskreporter_status: None,
|
||||||
aprs_is_status: None,
|
aprs_is_status: None,
|
||||||
histories: DecoderHistories::new(),
|
histories: DecoderHistories::new(),
|
||||||
|
vfo_prime: true,
|
||||||
prebuilt_rig: None,
|
prebuilt_rig: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,10 +193,14 @@ pub async fn run_rig_task(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prime VFO state
|
// Prime VFO state
|
||||||
if let Err(e) = prime_vfo_state(&mut rig, &mut state, retry).await {
|
if config.vfo_prime {
|
||||||
warn!("VFO priming failed: {:?}", e);
|
if let Err(e) = prime_vfo_state(&mut rig, &mut state, retry).await {
|
||||||
|
warn!("VFO priming failed: {:?}", e);
|
||||||
|
} else {
|
||||||
|
initial_status_read = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
initial_status_read = true;
|
info!("VFO priming disabled by config");
|
||||||
}
|
}
|
||||||
|
|
||||||
if initial_status_read {
|
if initial_status_read {
|
||||||
|
|||||||
Reference in New Issue
Block a user