[refactor](decoders): extract CW decoder into trx-cw crate
Move the Goertzel-based CW decoder out of trx-server::decode::cw into a dedicated src/decoders/trx-cw crate, matching the layout of trx-aprs, trx-ft8, and trx-wspr. The decode module is now empty and removed. - src/decoders/trx-cw/ (new — Goertzel + Morse decoder) - trx-server: drop decode module entirely, use trx_cw::CwDecoder - CwEvent stays in trx-core (mirrors AprsPacket / Ft8Message / WsprMessage) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Generated
+8
@@ -2336,6 +2336,13 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "trx-cw"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"trx-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "trx-frontend"
|
name = "trx-frontend"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -2425,6 +2432,7 @@ dependencies = [
|
|||||||
"trx-aprs",
|
"trx-aprs",
|
||||||
"trx-backend",
|
"trx-backend",
|
||||||
"trx-core",
|
"trx-core",
|
||||||
|
"trx-cw",
|
||||||
"trx-ft8",
|
"trx-ft8",
|
||||||
"trx-protocol",
|
"trx-protocol",
|
||||||
"trx-wspr",
|
"trx-wspr",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"src/decoders/trx-aprs",
|
"src/decoders/trx-aprs",
|
||||||
|
"src/decoders/trx-cw",
|
||||||
"src/decoders/trx-ft8",
|
"src/decoders/trx-ft8",
|
||||||
"src/decoders/trx-wspr",
|
"src/decoders/trx-wspr",
|
||||||
"src/trx-core",
|
"src/trx-core",
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2026 Stanislaw Grams <stanislawgrams@gmail.com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
|
||||||
|
[package]
|
||||||
|
name = "trx-cw"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
trx-core = { path = "../../trx-core" }
|
||||||
@@ -25,6 +25,7 @@ trx-app = { path = "../trx-app" }
|
|||||||
trx-backend = { path = "trx-backend" }
|
trx-backend = { path = "trx-backend" }
|
||||||
trx-core = { path = "../trx-core" }
|
trx-core = { path = "../trx-core" }
|
||||||
trx-aprs = { path = "../decoders/trx-aprs" }
|
trx-aprs = { path = "../decoders/trx-aprs" }
|
||||||
|
trx-cw = { path = "../decoders/trx-cw" }
|
||||||
trx-ft8 = { path = "../decoders/trx-ft8" }
|
trx-ft8 = { path = "../decoders/trx-ft8" }
|
||||||
trx-wspr = { path = "../decoders/trx-wspr" }
|
trx-wspr = { path = "../decoders/trx-wspr" }
|
||||||
trx-protocol = { path = "../trx-protocol" }
|
trx-protocol = { path = "../trx-protocol" }
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ use trx_core::audio::{
|
|||||||
use trx_core::decode::{AprsPacket, DecodedMessage, Ft8Message, WsprMessage};
|
use trx_core::decode::{AprsPacket, DecodedMessage, Ft8Message, WsprMessage};
|
||||||
use trx_core::rig::state::{RigMode, RigState};
|
use trx_core::rig::state::{RigMode, RigState};
|
||||||
use trx_aprs::AprsDecoder;
|
use trx_aprs::AprsDecoder;
|
||||||
|
use trx_cw::CwDecoder;
|
||||||
use trx_ft8::Ft8Decoder;
|
use trx_ft8::Ft8Decoder;
|
||||||
use trx_wspr::WsprDecoder;
|
use trx_wspr::WsprDecoder;
|
||||||
|
|
||||||
use crate::config::AudioConfig;
|
use crate::config::AudioConfig;
|
||||||
use crate::decode;
|
|
||||||
use crate::decode_logs::DecoderLoggers;
|
use crate::decode_logs::DecoderLoggers;
|
||||||
|
|
||||||
const APRS_HISTORY_RETENTION: Duration = Duration::from_secs(24 * 60 * 60);
|
const APRS_HISTORY_RETENTION: Duration = Duration::from_secs(24 * 60 * 60);
|
||||||
@@ -765,7 +765,7 @@ pub async fn run_cw_decoder(
|
|||||||
decode_logs: Option<Arc<DecoderLoggers>>,
|
decode_logs: Option<Arc<DecoderLoggers>>,
|
||||||
) {
|
) {
|
||||||
info!("CW decoder started ({}Hz, {} ch)", sample_rate, channels);
|
info!("CW decoder started ({}Hz, {} ch)", sample_rate, channels);
|
||||||
let mut decoder = decode::cw::CwDecoder::new(sample_rate);
|
let mut decoder = CwDecoder::new(sample_rate);
|
||||||
let mut was_active = false;
|
let mut was_active = false;
|
||||||
let mut last_reset_seq: u64 = 0;
|
let mut last_reset_seq: u64 = 0;
|
||||||
let mut active = matches!(state_rx.borrow().status.mode, RigMode::CW | RigMode::CWR);
|
let mut active = matches!(state_rx.borrow().status.mode, RigMode::CW | RigMode::CWR);
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2025 Stanislaw Grams <stanislawgrams@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
pub mod cw;
|
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
mod aprsfi;
|
mod aprsfi;
|
||||||
mod audio;
|
mod audio;
|
||||||
mod config;
|
mod config;
|
||||||
mod decode;
|
|
||||||
mod decode_logs;
|
mod decode_logs;
|
||||||
mod error;
|
mod error;
|
||||||
mod listener;
|
mod listener;
|
||||||
|
|||||||
Reference in New Issue
Block a user