mirror of
https://github.com/smittix/intercept.git
synced 2026-07-22 08:18:09 -07:00
Fix waterfall stop before direct listen
This commit is contained in:
@@ -2248,10 +2248,10 @@ async function _startDirectListenInternal() {
|
|||||||
await stopScanner();
|
await stopScanner();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWaterfallRunning && waterfallMode === 'rf') {
|
if (isWaterfallRunning && waterfallMode === 'rf') {
|
||||||
resumeRfWaterfallAfterListening = true;
|
resumeRfWaterfallAfterListening = true;
|
||||||
stopWaterfall();
|
await stopWaterfall();
|
||||||
}
|
}
|
||||||
|
|
||||||
const freqInput = document.getElementById('radioScanStart');
|
const freqInput = document.getElementById('radioScanStart');
|
||||||
const freq = freqInput ? parseFloat(freqInput.value) : 118.0;
|
const freq = freqInput ? parseFloat(freqInput.value) : 118.0;
|
||||||
@@ -3365,6 +3365,12 @@ function startWaterfall() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setWaterfallMode('rf');
|
||||||
|
const spanMhz = Math.max(0.1, waterfallEndFreq - waterfallStartFreq);
|
||||||
|
const segments = Math.max(1, Math.ceil(spanMhz / 2.4));
|
||||||
|
const targetSweepSeconds = 0.8;
|
||||||
|
const interval = Math.max(0.05, Math.min(0.3, targetSweepSeconds / segments));
|
||||||
|
|
||||||
fetch('/listening/waterfall/start', {
|
fetch('/listening/waterfall/start', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
@@ -3375,7 +3381,7 @@ function startWaterfall() {
|
|||||||
gain: gain,
|
gain: gain,
|
||||||
device: device,
|
device: device,
|
||||||
max_bins: maxBins,
|
max_bins: maxBins,
|
||||||
interval: 0.4,
|
interval: interval,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
@@ -3396,7 +3402,7 @@ function startWaterfall() {
|
|||||||
.catch(err => console.error('[WATERFALL] Start error:', err));
|
.catch(err => console.error('[WATERFALL] Start error:', err));
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopWaterfall() {
|
async function stopWaterfall() {
|
||||||
if (waterfallMode === 'audio') {
|
if (waterfallMode === 'audio') {
|
||||||
stopAudioWaterfall();
|
stopAudioWaterfall();
|
||||||
isWaterfallRunning = false;
|
isWaterfallRunning = false;
|
||||||
@@ -3405,15 +3411,15 @@ function stopWaterfall() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch('/listening/waterfall/stop', { method: 'POST' })
|
try {
|
||||||
.then(r => r.json())
|
await fetch('/listening/waterfall/stop', { method: 'POST' });
|
||||||
.then(() => {
|
|
||||||
isWaterfallRunning = false;
|
isWaterfallRunning = false;
|
||||||
if (waterfallEventSource) { waterfallEventSource.close(); waterfallEventSource = null; }
|
if (waterfallEventSource) { waterfallEventSource.close(); waterfallEventSource = null; }
|
||||||
document.getElementById('startWaterfallBtn').style.display = 'block';
|
document.getElementById('startWaterfallBtn').style.display = 'block';
|
||||||
document.getElementById('stopWaterfallBtn').style.display = 'none';
|
document.getElementById('stopWaterfallBtn').style.display = 'none';
|
||||||
})
|
} catch (err) {
|
||||||
.catch(err => console.error('[WATERFALL] Stop error:', err));
|
console.error('[WATERFALL] Stop error:', err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectWaterfallSSE() {
|
function connectWaterfallSSE() {
|
||||||
|
|||||||
Reference in New Issue
Block a user