fix: web spectrum tuning range from backend caps; remove dead code

Fix: dragging/wheeling the spectrum in the web UI clamped frequency to a
hardcoded HF ceiling (vfoMax=60 MHz), so on Pluto VHF/UHF it snapped down
to 60 MHz and couldn't pan up (only the VFO wheel worked, via a different
limit). Push the backend's tuning range (BackendCaps.MinFreqHz/MaxFreqHz)
to the web alongside the band plan; JS vfoMin/vfoMax use freq_min/freq_max
from state. The transverter branch (XVTR_CUR>=0) is unchanged — it keeps
the wide-open range since the displayed RF freq is translated to IF and
clamped server-side.

Dead-code cleanup (audit of this session's work):
- SampleRateMode/TSampleRateMode: orphaned when the sample-rate
  unification replaced the srmContinuous branch in ApplyBackendCapsToUI;
  no readers left. Removed (+ now-unused PLUTO_MAX_SR).
- Pre-existing write-only/unused: TBackendCaps.MaxSampleRate,
  SampleRateOverlay.SPAN_NAMES, MainForm.BAND_FREQ.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 14:35:56 +03:00
co-authored by Claude Opus 4.8
parent 4749cf0cbc
commit 3cedc6225d
8 changed files with 29 additions and 16 deletions
+6 -2
View File
@@ -455,6 +455,7 @@ begin
'let stA=0,stAmem=100,stB=0,stBmem=100;' +
'let freqMhzDigits=3,freqMaxHz=999999999;' +
'let freqMin=30000,freqMax=60000000;' + // диапазон бэкенда (из state.freq_min/max)
'function fmtVfo(hz,step){' +
'const N=freqMhzDigits+6;' +
'const s=String(Math.max(0,Math.round(hz||0))).padStart(N,"0");' +
@@ -695,6 +696,7 @@ begin
'if(msg.bands!=null&&Array.isArray(msg.bands)&&msg.bands.length){' +
'const nn=msg.bands.map(function(b){return b.name;});' +
'if(JSON.stringify(nn)!==JSON.stringify(BAND_N)){BAND_N=nn;BAND_F=msg.bands.map(function(b){return b.freq;});rebuildBandSel();}}' +
'if(msg.freq_min!=null)freqMin=msg.freq_min;if(msg.freq_max!=null)freqMax=msg.freq_max;' +
// Обновляем localCenter/localSpan из сервера только когда пользователь не тянет
'if(!dragging&&Date.now()-wheelActiveTs>300){' +
// В CTUN без DUP: TX-спектр WDSP центрирован по vfo_a_hz, а не по DDC LO.
@@ -813,8 +815,10 @@ begin
'function activeVfoHz(){return activeVfo==="A"?vfoA:vfoB;}' +
'function setActiveVfoHz(f){if(activeVfo==="A")vfoA=f;else vfoB=f;}' +
'function sendActiveFreq(f){if(activeVfo==="A")ws2({cmd:"freq",hz:f});else ws2({cmd:"freq",hz:f});}' +
'function vfoMin(){return XVTR_CUR>=0?0:30000;}' +
'function vfoMax(){return XVTR_CUR>=0?999999999999:60000000;}' +
// Границы перестройки берём из бэкенда (freqMin/freqMax из state), а не
// хардкодим HF — иначе на Pluto (VHF/UHF) drag по спектру клампило в 60 МГц.
'function vfoMin(){return XVTR_CUR>=0?0:Math.max(30000,freqMin);}' +
'function vfoMax(){return XVTR_CUR>=0?999999999999:freqMax;}' +
'function doWheel(e){e.preventDefault();e.stopPropagation();audioKick();const dir=e.deltaY<0?1:-1,st=tuneStep(e),base=Math.floor(activeVfoHz()/st)*st;' +
'const nf=cl(dir>0?base+st:(Math.round(activeVfoHz())===base?base-st:base),vfoMin(),vfoMax());' +
'setActiveVfoHz(nf);wheelActiveTs=Date.now();' +