[fix](trx-frontend): gate RDS display updates on WFM mode
updateRdsPsOverlay was called on every spectrum frame (25 Hz) regardless of mode, doing 15+ DOM element lookups and text updates even in USB/AM/CW/etc. The server-side RDS DSP already only runs in WFM; align the client: - Spectrum SSE handler: only increment rdsFrameCount and call updateRdsPsOverlay when lastModeName === "WFM" - Mode change: call resetRdsDisplay() when switching to or from WFM so the overlay and RDS panel are cleared promptly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -1444,6 +1444,9 @@ function render(update) {
|
|||||||
modeEl.value = modeUpper;
|
modeEl.value = modeUpper;
|
||||||
if (modeUpper === "WFM" && lastModeName !== "WFM") {
|
if (modeUpper === "WFM" && lastModeName !== "WFM") {
|
||||||
setJogDivisor(10);
|
setJogDivisor(10);
|
||||||
|
resetRdsDisplay();
|
||||||
|
} else if (modeUpper !== "WFM" && lastModeName === "WFM") {
|
||||||
|
resetRdsDisplay();
|
||||||
}
|
}
|
||||||
lastModeName = modeUpper;
|
lastModeName = modeUpper;
|
||||||
updateWfmControls();
|
updateWfmControls();
|
||||||
@@ -3692,11 +3695,13 @@ function startSpectrumStreaming() {
|
|||||||
try {
|
try {
|
||||||
lastSpectrumData = JSON.parse(evt.data);
|
lastSpectrumData = JSON.parse(evt.data);
|
||||||
lastSpectrumRenderData = buildSpectrumRenderData(lastSpectrumData);
|
lastSpectrumRenderData = buildSpectrumRenderData(lastSpectrumData);
|
||||||
rdsFrameCount++;
|
|
||||||
pushOverviewWaterfallFrame(lastSpectrumData);
|
pushOverviewWaterfallFrame(lastSpectrumData);
|
||||||
refreshCenterFreqDisplay();
|
refreshCenterFreqDisplay();
|
||||||
scheduleSpectrumDraw();
|
scheduleSpectrumDraw();
|
||||||
updateRdsPsOverlay(lastSpectrumData.rds);
|
if (lastModeName === "WFM") {
|
||||||
|
rdsFrameCount++;
|
||||||
|
updateRdsPsOverlay(lastSpectrumData.rds);
|
||||||
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
};
|
};
|
||||||
spectrumSource.onerror = () => {
|
spectrumSource.onerror = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user