[feat](trx-protocol): add centralised decoder registry
Add DECODER_REGISTRY in trx-protocol::decoders as the single source of truth for all decoder metadata (activation mode, supported rig modes, background-decode capability). Replace duplicated resolver functions in background_decode.rs and sse.rs with shared resolve_bookmark_decoders(). Add GET /decoders endpoint to expose the registry to the frontend. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -3241,22 +3241,22 @@ function render(update) {
|
||||
const wsprStatus = document.getElementById("wspr-status");
|
||||
setModeBoundDecodeStatus(
|
||||
aisStatus,
|
||||
["AIS", "FM", "PKT"],
|
||||
"Select AIS or FM mode to decode",
|
||||
["AIS"],
|
||||
"Select AIS mode to decode",
|
||||
"Connected, listening for packets",
|
||||
);
|
||||
if (window.updateAisBar) window.updateAisBar();
|
||||
setModeBoundDecodeStatus(
|
||||
vdesStatus,
|
||||
["VDES", "FM"],
|
||||
"Select VDES or FM mode to decode",
|
||||
["VDES"],
|
||||
"Select VDES mode to decode",
|
||||
"Connected, listening for bursts",
|
||||
);
|
||||
if (window.updateVdesBar) window.updateVdesBar();
|
||||
setModeBoundDecodeStatus(
|
||||
aprsStatus,
|
||||
["PKT", "FM"],
|
||||
"Select FM mode to decode",
|
||||
["PKT"],
|
||||
"Select PKT mode to decode",
|
||||
"Connected, listening for packets",
|
||||
);
|
||||
if (window.updateAprsBar) window.updateAprsBar();
|
||||
@@ -8903,10 +8903,10 @@ function updateDecodeStatus(text) {
|
||||
const ft8 = document.getElementById("ft8-status");
|
||||
const ft4 = document.getElementById("ft4-status");
|
||||
const ft2 = document.getElementById("ft2-status");
|
||||
setModeBoundDecodeStatus(ais, ["AIS", "FM", "PKT"], "Select AIS or FM mode to decode", text);
|
||||
setModeBoundDecodeStatus(ais, ["AIS"], "Select AIS mode to decode", text);
|
||||
const vdesText = text === "Connected, listening for packets" ? "Connected, listening for bursts" : text;
|
||||
setModeBoundDecodeStatus(vdes, ["VDES", "FM"], "Select VDES or FM mode to decode", vdesText);
|
||||
setModeBoundDecodeStatus(aprs, ["PKT", "FM"], "Select FM mode to decode", text);
|
||||
setModeBoundDecodeStatus(vdes, ["VDES"], "Select VDES mode to decode", vdesText);
|
||||
setModeBoundDecodeStatus(aprs, ["PKT"], "Select PKT mode to decode", text);
|
||||
const cwText = text === "Connected, listening for packets" ? "Connected, listening for CW" : text;
|
||||
setModeBoundDecodeStatus(cw, ["CW", "CWR"], "Select CW mode to decode", cwText);
|
||||
if (ft8 && ft8.textContent !== "Receiving") ft8.textContent = text;
|
||||
|
||||
@@ -449,13 +449,14 @@
|
||||
<input type="number" id="bm-freq" class="status-input" required min="0" placeholder="e.g. 7074000" />
|
||||
</label>
|
||||
<label class="bm-label">Mode
|
||||
<input type="text" id="bm-mode" class="status-input" list="bm-mode-list" required placeholder="e.g. USB" />
|
||||
<input type="text" id="bm-mode" class="status-input" list="bm-mode-list" required placeholder="e.g. DIG" />
|
||||
<datalist id="bm-mode-list">
|
||||
<option value="LSB">
|
||||
<option value="USB">
|
||||
<option value="AM">
|
||||
<option value="SAM">
|
||||
<option value="FM">
|
||||
<option value="DIG">
|
||||
<option value="CW">
|
||||
<option value="WFM">
|
||||
</datalist>
|
||||
@@ -560,25 +561,25 @@
|
||||
<div class="plugin-item">
|
||||
<strong>FT8 Decoder</strong>
|
||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||
Decodes FT8 messages from RX audio (USB only, toggle required).
|
||||
Decodes FT8 messages from RX audio (DIG/USB only, toggle required).
|
||||
</div>
|
||||
</div>
|
||||
<div class="plugin-item">
|
||||
<strong>FT4 Decoder</strong>
|
||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||
Decodes FT4 messages from RX audio (USB only, toggle required). 7.5-second slots.
|
||||
Decodes FT4 messages from RX audio (DIG/USB only, toggle required). 7.5-second slots.
|
||||
</div>
|
||||
</div>
|
||||
<div class="plugin-item">
|
||||
<strong>FT2 Decoder</strong>
|
||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||
Decodes FT2 messages from RX audio (USB only, toggle required). 3.75-second slots.
|
||||
Decodes FT2 messages from RX audio (DIG/USB only, toggle required). 3.75-second slots.
|
||||
</div>
|
||||
</div>
|
||||
<div class="plugin-item">
|
||||
<strong>WSPR Decoder</strong>
|
||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||
Decodes WSPR messages from RX audio (USB only, toggle required).
|
||||
Decodes WSPR messages from RX audio (DIG/USB only, toggle required).
|
||||
</div>
|
||||
</div>
|
||||
<div class="plugin-item">
|
||||
|
||||
@@ -322,8 +322,7 @@ function renderAprsHistory() {
|
||||
|
||||
function updateAprsBar() {
|
||||
if (!aprsBarOverlay) return;
|
||||
const modeVal = (document.getElementById("mode")?.value || "").toUpperCase();
|
||||
const isPkt = modeVal === "PKT" || modeVal === "FM";
|
||||
const isPkt = (document.getElementById("mode")?.value || "").toUpperCase() === "PKT";
|
||||
const cutoffMs = Date.now() - APRS_BAR_WINDOW_MS;
|
||||
const okFrames = aprsPacketHistory.filter((p) => p.crcOk && p._tsMs >= cutoffMs);
|
||||
const frames = collapseAprsDuplicates(okFrames).slice(0, 8);
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@
|
||||
if (supported.length > 0) return supported;
|
||||
const mode = String(bookmark && bookmark.mode || "").trim().toUpperCase();
|
||||
if (mode === "AIS") return ["ais"];
|
||||
if (mode === "PKT" || mode === "FM") return ["aprs"];
|
||||
if (mode === "PKT") return ["aprs"];
|
||||
return supported;
|
||||
}
|
||||
|
||||
|
||||
@@ -428,9 +428,9 @@ async function bmApply(bm) {
|
||||
await postPath("/set_freq?hz=" + bm.freq_hz);
|
||||
}
|
||||
})();
|
||||
// Decoder toggles (USB / DIG / FM / PKT modes) — also fire-and-forget.
|
||||
// Decoder toggles (DIG / FM modes) — also fire-and-forget.
|
||||
const hasDecoders = Array.isArray(bm.decoders) && bm.decoders.length > 0;
|
||||
const decoderMode = bm.mode === "USB" || bm.mode === "DIG" || bm.mode === "FM" || bm.mode === "PKT";
|
||||
const decoderMode = bm.mode === "DIG" || bm.mode === "FM";
|
||||
const decoderPromise = (hasDecoders && decoderMode) ? (async () => {
|
||||
const statusResp = await fetch("/status");
|
||||
if (statusResp.ok) {
|
||||
|
||||
Reference in New Issue
Block a user