From 88ccc7ab81b65e8c41f53411e7433aaaa1bbc7c4 Mon Sep 17 00:00:00 2001 From: Stanislaw Grams Date: Sun, 8 Feb 2026 23:09:51 +0100 Subject: [PATCH] [feat](trx-frontend-http): add decoder toggle/clear UI and endpoints Add POST endpoints for toggle_aprs_decode, toggle_cw_decode, clear_aprs_decode, and clear_cw_decode. Add toggle buttons in APRS and CW tabs. Render decoder enabled state from SSE updates. Clear button now also resets server-side decoder state. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Stanislaw Grams --- .../trx-frontend-http/assets/web/app.js | 18 +++++++++ .../trx-frontend-http/assets/web/index.html | 2 + .../assets/web/plugins/aprs.js | 7 +++- .../assets/web/plugins/cw.js | 7 +++- .../trx-frontend/trx-frontend-http/src/api.rs | 38 +++++++++++++++++++ 5 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js index 2ca326e..1fb221a 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js @@ -362,6 +362,24 @@ function render(update) { if (typeof update.clients === "number") { document.getElementById("about-clients").textContent = update.clients; } + // Decoder toggle buttons + const aprsToggleBtn = document.getElementById("aprs-decode-toggle-btn"); + const cwToggleBtn = document.getElementById("cw-decode-toggle-btn"); + if (aprsToggleBtn) { + const aprsOn = !!update.aprs_decode_enabled; + aprsToggleBtn.textContent = aprsOn ? "Disable APRS" : "Enable APRS"; + aprsToggleBtn.style.borderColor = aprsOn ? "#00d17f" : ""; + aprsToggleBtn.style.color = aprsOn ? "#00d17f" : ""; + window.aprsDecodeEnabled = aprsOn; + } + if (cwToggleBtn) { + const cwOn = !!update.cw_decode_enabled; + cwToggleBtn.textContent = cwOn ? "Disable CW" : "Enable CW"; + cwToggleBtn.style.borderColor = cwOn ? "#00d17f" : ""; + cwToggleBtn.style.color = cwOn ? "#00d17f" : ""; + window.cwDecodeEnabled = cwOn; + } + powerHint.textContent = readyText(); lastLocked = update.status && update.status.lock === true; lockBtn.textContent = lastLocked ? "Unlock" : "Lock"; diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html index 428fdb0..b878bde 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html @@ -145,6 +145,7 @@