Phase 5: make RestoreBand a full controller command (self-retune)

controller.RestoreBand now does the final receiver retune on the active VFO
(SetVfoA/SetVfoB) itself — channel orchestration rides the OnAfterTune hook — and
emits rfBandRestore so the UI resets the waterfall-average buffer (desktop-only,
fires on explicit band change, not per-tune). MainForm.RestoreBand collapses to a
thin delegate.

RestoreBand is now headless-complete: desktop band buttons, channels, connect-
restore, and (soon) web/CAT can call it directly. Preserves the active-VFO retune
(active B no longer centers on A) from the batch-15 fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Uladzimir Karpenka
2026-06-09 09:52:11 +03:00
co-authored by Claude Opus 4.8
parent 7b40eae174
commit de1f4b772d
2 changed files with 15 additions and 18 deletions
+5 -13
View File
@@ -714,20 +714,9 @@ end;
procedure TMainForm.RestoreBand(BandIdx: Integer);
begin
if (BandIdx < 0) or (BandIdx >= CFG_BAND_COUNT) then Exit;
// Сброс порогов водопада — только при явной смене диапазона (не на каждом
// пересечении границы при тюнинге, поэтому здесь, а не в rfBand-рендере).
FSpecView.ResetWfAvgBuf;
// Состояние + DSP + события рендера — в контроллере.
// Тонкий делегат: состояние+DSP+финальная перестройка+рендер — в команде
// контроллера; сброс Wf-avg буфера — в OnControllerState(rfBandRestore).
FController.RestoreBand(BandIdx);
// Финальная перестройка приёмника на АКТИВНЫЙ VFO. Если активен B — нельзя
// центрироваться на VFO A (иначе движок слушает A, а маркер/мышь — на B).
// VFO A идёт через ApplyVfoA (канальная оркестрация: auto-CTCSS, pre-channel
// drive); VFO B — через SetVfoB (перестройка + рендер rfVfoB).
if FController.FActiveVfo = 0 then
ApplyVfoA(Round(FController.FVfoA))
else
FController.SetVfoB(Round(FController.FVfoB));
end;
procedure TMainForm.SaveAllAndExit;
@@ -1232,6 +1221,9 @@ begin
for i := 0 to CFG_XVTR_COUNT - 1 do
if BtnXvtrBand[i] <> nil then
StyleButton(BtnXvtrBand[i], i = FController.FCurrentXvtr);
rfBandRestore:
// Явная смена диапазона: сброс порогов водопада (не на каждом тюне).
FSpecView.ResetWfAvgBuf;
rfMute:
begin
StyleButton(BtnMute, FController.FMuted);