feat(ook): add timing presets, RSSI, bit-order suggest, pattern filter, TSCM link

- Timing presets: five quick-fill buttons (300/600, 300/900, 400/800, 500/1500, 500 MC)
  that populate all six pulse-timing fields at once — maps to CTF flag timing profiles
- RSSI per frame: add -M level to rtl_433 command; parse snr/rssi/level from JSON;
  display dB SNR inline with each frame; include rssi_db column in CSV export
- Auto bit-order suggest: "Suggest" button counts printable chars across all stored
  frames for MSB vs LSB, selects the winner, shows count — no decoder restart needed
- Pattern filter: live hex/ASCII filter input above the frame log; hides non-matching
  frames and highlights matches in green; respects current bit order
- TSCM integration: "Decode (OOK)" button in RF signal device details panel switches
  to OOK mode and pre-fills frequency — frontend-only, no backend changes needed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
thatsatechnique
2026-03-04 11:51:39 -08:00
parent 4c282bb055
commit 0c3ccac21c
5 changed files with 157 additions and 8 deletions

View File

@@ -3294,6 +3294,7 @@
<!-- OOK Decoder Output Panel -->
<div id="ookOutputPanel" style="display: none; margin-bottom: 12px;">
<div style="background: #0a0a0a; border: 1px solid #1a2e1a; border-radius: 6px; padding: 8px 10px;">
<!-- Toolbar row 1: bit order + actions -->
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 10px; color: #555; text-transform: uppercase; letter-spacing: 1px;">
<span>Decoded Frames</span>
<div style="display: flex; gap: 6px; align-items: center;">
@@ -3303,10 +3304,21 @@
style="background: var(--accent); color: #000;">MSB</button>
<button class="btn btn-sm btn-ghost" id="ookBitLSB"
onclick="OokMode.setBitOrder('lsb')">LSB</button>
<button class="btn btn-sm btn-ghost" onclick="OokMode.suggestBitOrder()"
title="Auto-detect best bit order from printable character count">
Suggest <span id="ookSuggestLabel" style="font-size:9px; margin-left:2px;"></span>
</button>
<button class="btn btn-sm btn-ghost" onclick="OokMode.clearOutput()">Clear</button>
<button class="btn btn-sm btn-ghost" onclick="OokMode.exportLog()">CSV</button>
</div>
</div>
<!-- Toolbar row 2: pattern filter -->
<div style="margin-bottom: 6px;">
<input type="text" id="ookPatternFilter"
placeholder="Filter hex or ASCII..."
oninput="OokMode.filterFrames(this.value)"
style="width: 100%; background: #111; border: 1px solid #222; border-radius: 3px; color: var(--text-dim); font-family: var(--font-mono); font-size: 10px; padding: 3px 6px; box-sizing: border-box;">
</div>
<div id="ookOutput" style="max-height: 400px; overflow-y: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-dim);"></div>
</div>
<div style="margin-top: 4px; font-size: 10px; color: #555; text-align: right;">
@@ -13091,7 +13103,7 @@
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
`;
// Add "Listen" button for RF signals
// Add "Listen" and "Decode (OOK)" buttons for RF signals
if (protocol === 'rf' && device.frequency) {
const freq = device.frequency;
html += `
@@ -13101,6 +13113,10 @@
<button class="tscm-action-btn" onclick="listenToRfSignal(${freq}, 'am')">
Listen (AM)
</button>
<button class="tscm-action-btn" onclick="decodeWithOok(${freq})"
title="Open OOK decoder tuned to this frequency">
Decode (OOK)
</button>
`;
}
@@ -13114,7 +13130,7 @@
</button>
</div>
<div style="font-size: 10px; color: var(--text-secondary); margin-top: 8px;">
${protocol === 'rf' ? 'Listen buttons open Spectrum Waterfall. ' : ''}Known devices are excluded from threat scoring in future sweeps.
${protocol === 'rf' ? 'Listen opens Spectrum Waterfall. Decode (OOK) opens the OOK decoder tuned to this frequency. ' : ''}Known devices are excluded from threat scoring in future sweeps.
</div>
</div>
`;
@@ -13910,6 +13926,17 @@
}, 300);
}
function decodeWithOok(frequency) {
// Close the TSCM modal and switch to OOK decoder with the detected frequency pre-filled
closeTscmDeviceModal();
switchMode('ook');
setTimeout(function () {
if (typeof OokMode !== 'undefined' && typeof OokMode.setFreq === 'function') {
OokMode.setFreq(parseFloat(frequency).toFixed(3));
}
}, 300);
}
async function showDevicesByCategory(category) {
const modal = document.getElementById('tscmDeviceModal');
const content = document.getElementById('tscmDeviceModalContent');

View File

@@ -95,6 +95,21 @@
<input type="number" id="ookMinBits" value="8" step="1" min="1" max="512">
</div>
</div>
<div class="form-group" style="margin-top: 8px;">
<label style="font-size: 10px; color: var(--text-dim);">Quick presets (short/long &mu;s)</label>
<div style="display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;">
<button class="preset-btn" onclick="OokMode.setTiming(300,600,8000,5000,150,8)"
title="Generic ISM default">300/600</button>
<button class="preset-btn" onclick="OokMode.setTiming(300,900,8000,5000,150,16)"
title="PWM common variant">300/900</button>
<button class="preset-btn" onclick="OokMode.setTiming(400,800,8000,5000,150,16)"
title="Generic 2:1 ratio">400/800</button>
<button class="preset-btn" onclick="OokMode.setTiming(500,1500,10000,6000,200,16)"
title="Long-range keyfob">500/1500</button>
<button class="preset-btn" onclick="OokMode.setTiming(500,1000,8000,5000,150,8)"
title="Manchester clock period">500 MC</button>
</div>
</div>
</div>
<div class="section">