fix(trx-server): remove unused RigSdr import in rig_task.rs
Also run cargo fmt to fix formatting issues across trx-server, trx-frontend-http, and trx-configurator. https://claude.ai/code/session_01RsHUyVz2wjQjsEsxJo5owt Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -138,10 +138,7 @@ impl StreamErrorLogger {
|
||||
fn log(&self, err: &str) {
|
||||
let now = Instant::now();
|
||||
let kind = classify_stream_error(err);
|
||||
let mut state = self
|
||||
.state
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
let mut state = self.state.lock().unwrap_or_else(|e| e.into_inner());
|
||||
|
||||
// First occurrence or changed error class: log as error once.
|
||||
if state.last_kind != Some(kind) {
|
||||
@@ -1023,7 +1020,10 @@ fn run_playback(
|
||||
if rx.is_empty() {
|
||||
let _ = stream.pause();
|
||||
playing = false;
|
||||
ring_writer.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
||||
ring_writer
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.clear();
|
||||
info!("Audio playback: paused (idle)");
|
||||
if channel_closed {
|
||||
return Ok(());
|
||||
@@ -1051,7 +1051,10 @@ fn run_playback(
|
||||
let _ = stream.pause();
|
||||
playing = false;
|
||||
}
|
||||
ring_writer.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
||||
ring_writer
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.clear();
|
||||
|
||||
if channel_closed {
|
||||
return Ok(());
|
||||
|
||||
@@ -21,7 +21,7 @@ use trx_core::rig::controller::{
|
||||
};
|
||||
use trx_core::rig::request::RigRequest;
|
||||
use trx_core::rig::state::{RigMode, RigSnapshot, RigState};
|
||||
use trx_core::rig::{RigCat, RigRxStatus, RigSdr, RigTxStatus};
|
||||
use trx_core::rig::{RigCat, RigRxStatus, RigTxStatus};
|
||||
use trx_core::{DynResult, RigError, RigResult};
|
||||
|
||||
use crate::audio::DecoderHistories;
|
||||
@@ -564,7 +564,9 @@ async fn process_command(
|
||||
if let Err(e) = sdr.set_sdr_gain(gain_db).await {
|
||||
return Err(RigError::communication(format!("set_sdr_gain: {e}")));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_sdr_gain")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_sdr_gain"));
|
||||
}
|
||||
ctx.state.filter = ctx.rig.as_sdr_ref().and_then(|s| s.filter_state());
|
||||
let _ = ctx.state_tx.send(ctx.state.clone());
|
||||
return snapshot_from(ctx.state);
|
||||
@@ -574,7 +576,9 @@ async fn process_command(
|
||||
if let Err(e) = sdr.set_sdr_lna_gain(gain_db).await {
|
||||
return Err(RigError::communication(format!("set_sdr_lna_gain: {e}")));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_sdr_lna_gain")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_sdr_lna_gain"));
|
||||
}
|
||||
ctx.state.filter = ctx.rig.as_sdr_ref().and_then(|s| s.filter_state());
|
||||
let _ = ctx.state_tx.send(ctx.state.clone());
|
||||
return snapshot_from(ctx.state);
|
||||
@@ -584,7 +588,9 @@ async fn process_command(
|
||||
if let Err(e) = sdr.set_sdr_agc(enabled).await {
|
||||
return Err(RigError::communication(format!("set_sdr_agc: {e}")));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_sdr_agc")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_sdr_agc"));
|
||||
}
|
||||
ctx.state.filter = ctx.rig.as_sdr_ref().and_then(|s| s.filter_state());
|
||||
let _ = ctx.state_tx.send(ctx.state.clone());
|
||||
return snapshot_from(ctx.state);
|
||||
@@ -597,7 +603,9 @@ async fn process_command(
|
||||
if let Err(e) = sdr.set_sdr_squelch(enabled, threshold_db).await {
|
||||
return Err(RigError::communication(format!("set_sdr_squelch: {e}")));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_sdr_squelch")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_sdr_squelch"));
|
||||
}
|
||||
ctx.state.filter = ctx.rig.as_sdr_ref().and_then(|s| s.filter_state());
|
||||
let _ = ctx.state_tx.send(ctx.state.clone());
|
||||
return snapshot_from(ctx.state);
|
||||
@@ -609,7 +617,9 @@ async fn process_command(
|
||||
"set_sdr_noise_blanker: {e}"
|
||||
)));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_sdr_noise_blanker")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_sdr_noise_blanker"));
|
||||
}
|
||||
ctx.state.filter = ctx.rig.as_sdr_ref().and_then(|s| s.filter_state());
|
||||
let _ = ctx.state_tx.send(ctx.state.clone());
|
||||
return snapshot_from(ctx.state);
|
||||
@@ -619,7 +629,9 @@ async fn process_command(
|
||||
if let Err(e) = sdr.set_wfm_deemphasis(deemphasis_us).await {
|
||||
return Err(RigError::communication(format!("set_wfm_deemphasis: {e}")));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_wfm_deemphasis")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_wfm_deemphasis"));
|
||||
}
|
||||
if let Some(f) = ctx.state.filter.as_mut() {
|
||||
f.wfm_deemphasis_us = deemphasis_us;
|
||||
}
|
||||
@@ -631,7 +643,9 @@ async fn process_command(
|
||||
if let Err(e) = sdr.set_wfm_stereo(enabled).await {
|
||||
return Err(RigError::communication(format!("set_wfm_stereo: {e}")));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_wfm_stereo")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_wfm_stereo"));
|
||||
}
|
||||
if let Some(f) = ctx.state.filter.as_mut() {
|
||||
f.wfm_stereo = enabled;
|
||||
}
|
||||
@@ -643,7 +657,9 @@ async fn process_command(
|
||||
if let Err(e) = sdr.set_wfm_denoise(level).await {
|
||||
return Err(RigError::communication(format!("set_wfm_denoise: {e}")));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_wfm_denoise")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_wfm_denoise"));
|
||||
}
|
||||
if let Some(f) = ctx.state.filter.as_mut() {
|
||||
f.wfm_denoise = level;
|
||||
}
|
||||
@@ -655,7 +671,9 @@ async fn process_command(
|
||||
if let Err(e) = sdr.set_center_freq(freq).await {
|
||||
return Err(RigError::communication(format!("set_center_freq: {e}")));
|
||||
}
|
||||
} else { return Err(RigError::not_supported("set_center_freq")); }
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_center_freq"));
|
||||
}
|
||||
*ctx.poll_pause_until = Some(Instant::now() + Duration::from_millis(200));
|
||||
return snapshot_from(ctx.state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user