[fix](trx-rs): improve marine decode paths
Finish the pending MARINE frontend and decoder activation wiring, and lower the VDES detector power floors so weak signals are eligible for burst detection in the same power domain used by the IQ path. Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -891,7 +891,7 @@ fn downmix_if_needed(frame: Vec<f32>, channels: u16) -> Vec<f32> {
|
||||
mono
|
||||
}
|
||||
|
||||
/// Run the AIS decoder task. Only processes PCM when rig mode is AIS.
|
||||
/// Run the AIS decoder task. Only processes PCM when rig mode is AIS or MARINE.
|
||||
pub async fn run_ais_decoder(
|
||||
sample_rate: u32,
|
||||
channels: u16,
|
||||
@@ -905,14 +905,14 @@ pub async fn run_ais_decoder(
|
||||
let mut decoder_a = AisDecoder::new(sample_rate);
|
||||
let mut decoder_b = AisDecoder::new(sample_rate);
|
||||
let mut was_active = false;
|
||||
let mut active = matches!(state_rx.borrow().status.mode, RigMode::AIS);
|
||||
let mut active = matches!(state_rx.borrow().status.mode, RigMode::AIS | RigMode::MARINE);
|
||||
|
||||
loop {
|
||||
if !active {
|
||||
match state_rx.changed().await {
|
||||
Ok(()) => {
|
||||
let state = state_rx.borrow();
|
||||
active = matches!(state.status.mode, RigMode::AIS);
|
||||
active = matches!(state.status.mode, RigMode::AIS | RigMode::MARINE);
|
||||
if active {
|
||||
pcm_a_rx = pcm_a_rx.resubscribe();
|
||||
pcm_b_rx = pcm_b_rx.resubscribe();
|
||||
@@ -958,7 +958,7 @@ pub async fn run_ais_decoder(
|
||||
match changed {
|
||||
Ok(()) => {
|
||||
let state = state_rx.borrow();
|
||||
active = matches!(state.status.mode, RigMode::AIS);
|
||||
active = matches!(state.status.mode, RigMode::AIS | RigMode::MARINE);
|
||||
if !active && was_active {
|
||||
decoder_a.reset();
|
||||
decoder_b.reset();
|
||||
@@ -976,7 +976,7 @@ pub async fn run_ais_decoder(
|
||||
}
|
||||
}
|
||||
|
||||
/// Run the VDES decoder task. Only processes PCM when rig mode is VDES.
|
||||
/// Run the VDES decoder task. Only processes PCM when rig mode is VDES or MARINE.
|
||||
pub async fn run_vdes_decoder(
|
||||
sample_rate: u32,
|
||||
mut iq_rx: broadcast::Receiver<Vec<Complex<f32>>>,
|
||||
@@ -987,14 +987,14 @@ pub async fn run_vdes_decoder(
|
||||
info!("VDES decoder started ({}Hz complex baseband)", sample_rate);
|
||||
let mut decoder = VdesDecoder::new(sample_rate);
|
||||
let mut was_active = false;
|
||||
let mut active = matches!(state_rx.borrow().status.mode, RigMode::VDES);
|
||||
let mut active = matches!(state_rx.borrow().status.mode, RigMode::VDES | RigMode::MARINE);
|
||||
|
||||
loop {
|
||||
if !active {
|
||||
match state_rx.changed().await {
|
||||
Ok(()) => {
|
||||
let state = state_rx.borrow();
|
||||
active = matches!(state.status.mode, RigMode::VDES);
|
||||
active = matches!(state.status.mode, RigMode::VDES | RigMode::MARINE);
|
||||
if active {
|
||||
iq_rx = iq_rx.resubscribe();
|
||||
}
|
||||
@@ -1024,7 +1024,7 @@ pub async fn run_vdes_decoder(
|
||||
match changed {
|
||||
Ok(()) => {
|
||||
let state = state_rx.borrow();
|
||||
active = matches!(state.status.mode, RigMode::VDES);
|
||||
active = matches!(state.status.mode, RigMode::VDES | RigMode::MARINE);
|
||||
if !active && was_active {
|
||||
decoder.reset();
|
||||
was_active = false;
|
||||
|
||||
Reference in New Issue
Block a user