mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
feat: unify band plan across desktop + web UIs
Web band selector was hardcoded to the HF plan, so on Pluto it showed 160m..6m instead of the VHF/UHF plan and highlighted the wrong entry (band switching itself already worked: web sends idx, controller maps it via the IsPluto plan). Mirror the sample-rate unification. Single source of truth = BoardUtils -> controller: - BoardUtils: TBandInfo/TBandPlanArray + BuildBandPlan(Pluto). - TRadioController.BandPlan returns BuildBandPlan(IsPluto). Both UIs derive from it: - Desktop already plan-aware (RelabelBands + RestoreBand) - unchanged. - Web: WebServer.SetBands + "bands" in state JSON; hosts push BandPlan on connect/startup; JS builds the band selector from state.bands (BAND_N/BAND_F now dynamic). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -479,6 +479,7 @@ type
|
||||
procedure OnXvtrSettingsChange(const X: TXvtrSettings);
|
||||
procedure PushXvtrToWeb;
|
||||
procedure PushRatePresetsToWeb; // backend sample-rate пресеты → web
|
||||
procedure PushBandsToWeb; // backend band-план → web
|
||||
// XVTR helpers
|
||||
function FindXvtrIdxForFreq(FreqHz: Double): Integer;
|
||||
function XvtrTranslate(VisibleHz: Double): Double;
|
||||
@@ -884,6 +885,7 @@ begin
|
||||
PushXvtrToWeb;
|
||||
PushDeviceListToWeb; // saved-устройства сразу видны web-overlay
|
||||
PushRatePresetsToWeb; // дефолтный бэкенд до connect; перезапишется на смене
|
||||
PushBandsToWeb;
|
||||
FillChar(FCATLastGlobal, SizeOf(FCATLastGlobal), 0);
|
||||
FCATLastGlobal.CATTcpPort := 19090;
|
||||
for i := 0 to 3 do
|
||||
@@ -3685,6 +3687,7 @@ begin
|
||||
FSampleRateOverlay.SetCurrentRate(FController.FSampleRate);
|
||||
end;
|
||||
PushRatePresetsToWeb; // тот же источник зеркалим в web-морду
|
||||
PushBandsToWeb; // band-план бэкенда → web (HF ↔ VHF/UHF)
|
||||
|
||||
// Отдельный Pluto RF-AGC блок под AGC: показываем и сдвигаем панели ниже.
|
||||
LayoutLeftPanel(Caps.HasHWGain);
|
||||
@@ -5375,6 +5378,27 @@ begin
|
||||
FWebServer.SetRatePresets(FController.SampleRatePresets);
|
||||
end;
|
||||
|
||||
procedure TMainForm.PushBandsToWeb;
|
||||
// Band-план бэкенда → web (HF / VHF-UHF). Единый источник — FController.BandPlan,
|
||||
// тот же BoardUtils-план, что и для desktop-кнопок (RelabelBands).
|
||||
var
|
||||
Plan: TBandPlanArray;
|
||||
Names: array of string;
|
||||
Freqs: array of Double;
|
||||
i: Integer;
|
||||
begin
|
||||
if FWebServer = nil then Exit;
|
||||
Plan := FController.BandPlan;
|
||||
SetLength(Names, Length(Plan));
|
||||
SetLength(Freqs, Length(Plan));
|
||||
for i := 0 to High(Plan) do
|
||||
begin
|
||||
Names[i] := Plan[i].Name;
|
||||
Freqs[i] := Plan[i].FreqHz;
|
||||
end;
|
||||
FWebServer.SetBands(Names, Freqs);
|
||||
end;
|
||||
|
||||
procedure TMainForm.PushXvtrToWeb;
|
||||
var
|
||||
Arr: TWebXvtrArray;
|
||||
|
||||
Reference in New Issue
Block a user