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:
2026-06-23 14:01:23 +03:00
co-authored by Claude Opus 4.8
parent 6b695ce756
commit 4749cf0cbc
6 changed files with 127 additions and 7 deletions
+30
View File
@@ -6,6 +6,15 @@ unit BoardUtils;
interface
type
// Один диапазон плана (имя кнопки + частота по умолчанию). Общий тип для
// desktop/web UI — единый источник band-плана через TRadioController.BandPlan.
TBandInfo = record
Name: string;
FreqHz: Double;
end;
TBandPlanArray = array of TBandInfo;
function BoardTypeName(BoardType: Integer): string;
// Короткое человекочитаемое имя AD936x-платы по hw_model (Pluto / LibreSDR / прочие).
function PlutoModelName(const HwModel: string): string;
@@ -15,6 +24,8 @@ function FreqToBandIdx(Hz: Double; Pluto: Boolean = False): Integer;
function BandName(Idx: Integer; Pluto: Boolean = False): string;
// Частота по умолчанию при входе в диапазон (если нет сохранённой/в диапазоне).
function BandDefaultFreq(Idx: Integer; Pluto: Boolean = False): Double;
// Полный band-план активного бэкенда (имена + дефолтные частоты).
function BuildBandPlan(Pluto: Boolean): TBandPlanArray;
implementation
@@ -105,4 +116,23 @@ begin
if Pluto then Result := VU_DEF[Idx] else Result := HF_DEF[Idx];
end;
function BuildBandPlan(Pluto: Boolean): TBandPlanArray;
var i: Integer;
begin
SetLength(Result, BAND_COUNT);
for i := 0 to BAND_COUNT - 1 do
begin
if Pluto then
begin
Result[i].Name := VU_NAMES[i];
Result[i].FreqHz := VU_DEF[i];
end
else
begin
Result[i].Name := HF_NAMES[i];
Result[i].FreqHz := HF_DEF[i];
end;
end;
end;
end.