mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Fix signal activity panel dying after DSD startup banner
The stream thread used a blocking readline() with no timeout, so once DSD finished outputting its startup banner there were no more events until actual signal activity. The frontend decayed to zero and appeared dead. If DSD crashed, the synthesizer state never transitioned to 'stopped' so there was no visual or textual indication of failure. - Use select() with 1s timeout on DSD stderr to avoid indefinite block - Send heartbeat events every 3s while decoder is alive but idle - Detect DSD crashes: capture exit code and remaining stderr, send as 'crashed' status with details and show notification to user - Frontend properly transitions synthesizer to 'stopped' on process death (was only happening on user-initiated stop) - Increase idle breathing amplitude so LISTENING state is clearly visible (0.12 +/- 0.06 vs old 0.05 +/- 0.035) - Release device reservation on crash, not just user stop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -196,14 +196,42 @@ function handleDmrMessage(msg) {
|
||||
// Raw DSD output — update last line display for diagnostics
|
||||
const rawEl = document.getElementById('dmrRawOutput');
|
||||
if (rawEl) rawEl.textContent = msg.text || '';
|
||||
} else if (msg.type === 'heartbeat') {
|
||||
// Decoder is alive and listening — keep synthesizer in listening state
|
||||
if (isDmrRunning && dmrSynthInitialized) {
|
||||
if (dmrEventType === 'idle' || dmrEventType === 'raw') {
|
||||
dmrEventType = 'raw';
|
||||
dmrActivityTarget = Math.max(dmrActivityTarget, 0.15);
|
||||
dmrLastEventTime = Date.now();
|
||||
updateDmrSynthStatus();
|
||||
}
|
||||
}
|
||||
} else if (msg.type === 'status') {
|
||||
const statusEl = document.getElementById('dmrStatus');
|
||||
if (statusEl) {
|
||||
statusEl.textContent = msg.text === 'started' ? 'DECODING' : 'IDLE';
|
||||
}
|
||||
if (msg.text === 'stopped') {
|
||||
if (msg.text === 'started') {
|
||||
if (statusEl) statusEl.textContent = 'DECODING';
|
||||
} else if (msg.text === 'crashed') {
|
||||
isDmrRunning = false;
|
||||
updateDmrUI();
|
||||
dmrEventType = 'stopped';
|
||||
dmrActivityTarget = 0;
|
||||
updateDmrSynthStatus();
|
||||
if (statusEl) statusEl.textContent = 'CRASHED';
|
||||
if (typeof releaseDevice === 'function') releaseDevice('dmr');
|
||||
const detail = msg.detail || `Decoder exited (code ${msg.exit_code})`;
|
||||
if (typeof showNotification === 'function') {
|
||||
showNotification('DMR Error', detail);
|
||||
}
|
||||
const rawEl = document.getElementById('dmrRawOutput');
|
||||
if (rawEl) rawEl.textContent = detail;
|
||||
} else if (msg.text === 'stopped') {
|
||||
isDmrRunning = false;
|
||||
updateDmrUI();
|
||||
dmrEventType = 'stopped';
|
||||
dmrActivityTarget = 0;
|
||||
updateDmrSynthStatus();
|
||||
if (statusEl) statusEl.textContent = 'STOPPED';
|
||||
if (typeof releaseDevice === 'function') releaseDevice('dmr');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,7 +315,7 @@ function drawDmrSynthesizer() {
|
||||
if (timeSinceEvent > 2000) {
|
||||
// No events for 2s — decay target toward idle
|
||||
dmrActivityTarget = Math.max(0, dmrActivityTarget - DMR_DECAY_RATE);
|
||||
if (dmrActivityTarget < 0.05 && dmrEventType !== 'stopped') {
|
||||
if (dmrActivityTarget < 0.1 && dmrEventType !== 'stopped') {
|
||||
dmrEventType = 'idle';
|
||||
updateDmrSynthStatus();
|
||||
}
|
||||
@@ -300,9 +328,9 @@ function drawDmrSynthesizer() {
|
||||
let effectiveActivity = dmrActivityLevel;
|
||||
if (dmrEventType === 'stopped') {
|
||||
effectiveActivity = 0;
|
||||
} else if (effectiveActivity < 0.05 && isDmrRunning) {
|
||||
// Gentle idle breathing
|
||||
effectiveActivity = 0.05 + Math.sin(now / 800) * 0.035;
|
||||
} else if (effectiveActivity < 0.1 && isDmrRunning) {
|
||||
// Visible idle breathing — shows decoder is alive and listening
|
||||
effectiveActivity = 0.12 + Math.sin(now / 1000) * 0.06;
|
||||
}
|
||||
|
||||
// Ripple timing for sync events
|
||||
|
||||
Reference in New Issue
Block a user