[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:
2026-02-23 18:33:02 +01:00
parent 3ebd185a7e
commit f4b92a0f20
8 changed files with 23 additions and 8 deletions
+11
View File
@@ -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" }
+1
View File
@@ -25,6 +25,7 @@ trx-app = { path = "../trx-app" }
trx-backend = { path = "trx-backend" }
trx-core = { path = "../trx-core" }
trx-aprs = { path = "../decoders/trx-aprs" }
trx-cw = { path = "../decoders/trx-cw" }
trx-ft8 = { path = "../decoders/trx-ft8" }
trx-wspr = { path = "../decoders/trx-wspr" }
trx-protocol = { path = "../trx-protocol" }
+2 -2
View File
@@ -23,11 +23,11 @@ use trx_core::audio::{
use trx_core::decode::{AprsPacket, DecodedMessage, Ft8Message, WsprMessage};
use trx_core::rig::state::{RigMode, RigState};
use trx_aprs::AprsDecoder;
use trx_cw::CwDecoder;
use trx_ft8::Ft8Decoder;
use trx_wspr::WsprDecoder;
use crate::config::AudioConfig;
use crate::decode;
use crate::decode_logs::DecoderLoggers;
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>>,
) {
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 last_reset_seq: u64 = 0;
let mut active = matches!(state_rx.borrow().status.mode, RigMode::CW | RigMode::CWR);
-5
View File
@@ -1,5 +0,0 @@
// SPDX-FileCopyrightText: 2025 Stanislaw Grams <stanislawgrams@gmail.com>
//
// SPDX-License-Identifier: BSD-2-Clause
pub mod cw;
-1
View File
@@ -5,7 +5,6 @@
mod aprsfi;
mod audio;
mod config;
mod decode;
mod decode_logs;
mod error;
mod listener;