add test harness

This commit is contained in:
Mitch Ross
2026-02-08 14:45:12 -05:00
parent 1924203c19
commit ca15e227cd
7 changed files with 420 additions and 0 deletions
+23
View File
@@ -1058,3 +1058,26 @@
border-left-color: transparent;
color: var(--text-dim, #555);
}
/* Test Decode collapsible section */
.wxsat-test-decode-body {
transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
max-height: 400px;
opacity: 1;
margin-top: 8px;
}
.wxsat-test-decode-body.collapsed {
max-height: 0;
opacity: 0;
margin-top: 0;
overflow: hidden;
}
.wxsat-collapse-icon {
transition: transform 0.2s ease;
}
.wxsat-collapse-icon.collapsed {
transform: rotate(-90deg);
}
+56
View File
@@ -229,6 +229,61 @@ const WeatherSat = (function() {
}
}
/**
* Start test decode from a pre-recorded file
*/
async function testDecode() {
const satSelect = document.getElementById('wxsatTestSatSelect');
const fileInput = document.getElementById('wxsatTestFilePath');
const rateSelect = document.getElementById('wxsatTestSampleRate');
const satellite = satSelect?.value || 'NOAA-18';
const inputFile = (fileInput?.value || '').trim();
const sampleRate = parseInt(rateSelect?.value || '1000000', 10);
if (!inputFile) {
showNotification('Weather Sat', 'Enter a file path');
return;
}
clearConsole();
showConsole(true);
updatePhaseIndicator('decoding');
addConsoleEntry(`Test decode: ${inputFile}`, 'info');
updateStatusUI('connecting', 'Starting file decode...');
try {
const response = await fetch('/weather-sat/test-decode', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
satellite,
input_file: inputFile,
sample_rate: sampleRate,
})
});
const data = await response.json();
if (data.status === 'started' || data.status === 'already_running') {
isRunning = true;
currentSatellite = data.satellite || satellite;
updateStatusUI('decoding', `Decoding ${data.satellite} from file`);
updateFreqDisplay(data.frequency, data.mode);
startStream();
showNotification('Weather Sat', `Decoding ${data.satellite} from file`);
} else {
updateStatusUI('idle', 'Decode failed');
showNotification('Weather Sat', data.message || 'Failed to start decode');
addConsoleEntry(data.message || 'Failed to start decode', 'error');
}
} catch (err) {
console.error('Failed to start test decode:', err);
updateStatusUI('idle', 'Error');
showNotification('Weather Sat', 'Connection error');
}
}
/**
* Update status UI
*/
@@ -1309,6 +1364,7 @@ const WeatherSat = (function() {
stop,
startPass,
selectPass,
testDecode,
loadImages,
loadPasses,
showImage,