From bc596dd9a1792263b43f8d74e01b2cb67f9d6d88 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Sat, 21 Mar 2026 21:45:59 +0100 Subject: [PATCH] [feat](trx-server): make VFO priming optional via behavior.vfo_prime config Co-Authored-By: Claude Opus 4.6 Signed-off-by: Stan Grams --- src/trx-server/src/config.rs | 4 ++++ src/trx-server/src/main.rs | 1 + src/trx-server/src/rig_task.rs | 13 ++++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/trx-server/src/config.rs b/src/trx-server/src/config.rs index 321cc07..96eeb4f 100644 --- a/src/trx-server/src/config.rs +++ b/src/trx-server/src/config.rs @@ -187,6 +187,9 @@ pub struct BehaviorConfig { pub max_retries: u32, /// Base delay for exponential backoff in milliseconds 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 { @@ -196,6 +199,7 @@ impl Default for BehaviorConfig { poll_interval_tx_ms: 100, max_retries: 3, retry_base_delay_ms: 100, + vfo_prime: true, } } } diff --git a/src/trx-server/src/main.rs b/src/trx-server/src/main.rs index 949bcaa..6528ff0 100644 --- a/src/trx-server/src/main.rs +++ b/src/trx-server/src/main.rs @@ -445,6 +445,7 @@ fn build_rig_task_config( pskreporter_status, aprs_is_status, histories, + vfo_prime: rig_cfg.behavior.vfo_prime, prebuilt_rig: None, } } diff --git a/src/trx-server/src/rig_task.rs b/src/trx-server/src/rig_task.rs index 70170e8..6faabe9 100644 --- a/src/trx-server/src/rig_task.rs +++ b/src/trx-server/src/rig_task.rs @@ -50,6 +50,8 @@ pub struct RigTaskConfig { /// Per-rig decoder history store. Used by Reset* commands to clear the /// history and by the audio listener to serve history on connection. pub histories: Arc, + /// 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. /// Used by the SDR path in `main.rs` to pass a fully-configured /// `SoapySdrRig` (built with channel config) without duplicating the @@ -81,6 +83,7 @@ impl Default for RigTaskConfig { pskreporter_status: None, aprs_is_status: None, histories: DecoderHistories::new(), + vfo_prime: true, prebuilt_rig: None, } } @@ -190,10 +193,14 @@ pub async fn run_rig_task( } // Prime VFO state - if let Err(e) = prime_vfo_state(&mut rig, &mut state, retry).await { - warn!("VFO priming failed: {:?}", e); + if config.vfo_prime { + if let Err(e) = prime_vfo_state(&mut rig, &mut state, retry).await { + warn!("VFO priming failed: {:?}", e); + } else { + initial_status_read = true; + } } else { - initial_status_read = true; + info!("VFO priming disabled by config"); } if initial_status_read {