From daee5672a9c22dd0216d58188483bbce92ea5676 Mon Sep 17 00:00:00 2001 From: Uladzimir Karpenka Date: Tue, 9 Jun 2026 10:22:15 +0300 Subject: [PATCH] Phase 5: fill SetBand as a real band-by-index command SetBand was a skeleton (FCurrentBand := Idx + Changed), leaving BandUp/BandDown non-functional. Fill it with the band-change logic (XVTR-exit + persist + restore) that WebAdapter.SyncBand had inline; SyncBand now just calls FController.SetBand. Gives CAT band up/down/by-index a controller command to call (Phase 4) instead of routing through the web adapter. Co-Authored-By: Claude Opus 4.8 --- RadioController.pas | 15 ++++++++++++++- WebAdapter.pas | 16 +--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/RadioController.pas b/RadioController.pas index 65b1269..25d4946 100644 --- a/RadioController.pas +++ b/RadioController.pas @@ -1545,7 +1545,20 @@ begin end; procedure TRadioController.SetBand(Idx: Integer); -begin FCurrentBand := Idx; Changed(rfBand); { TODO wiring: RestoreBand } end; +// Смена HF-диапазона по индексу (web/CAT/BandUp-Down). Выход из XVTR (если активен), +// персист покидаемого, restore нового. Полная команда — не трогает UI. +begin + if (Idx < 0) or (Idx >= CFG_BAND_COUNT) then Exit; + if FCurrentXvtr >= 0 then + begin + DeactivateXvtr; // выход в HF (HF-возврат внутри) + if Idx = FCurrentBand then Exit; + end + else if Idx = FCurrentBand then Exit; + if FDevConnected then begin SaveCurrentBand; FSettings.Save; end; + FCurrentBand := Idx; + RestoreBand(Idx); +end; procedure TRadioController.BandUp; begin if FCurrentBand < CFG_BAND_COUNT - 1 then SetBand(FCurrentBand + 1); end; diff --git a/WebAdapter.pas b/WebAdapter.pas index d579b6e..540d64d 100644 --- a/WebAdapter.pas +++ b/WebAdapter.pas @@ -172,21 +172,7 @@ procedure TWebAdapter.OnBand(Idx: Integer); begin FSyncInt := Idx; FController.Invoke(@SyncBand); end; procedure TWebAdapter.SyncBand; -// Смена HF-диапазона из web/CAT. Выход из XVTR (если активен) + persist + restore. -begin - if (FSyncInt < 0) or (FSyncInt >= CFG_BAND_COUNT) then Exit; - if FController.FCurrentXvtr >= 0 then - begin - FController.SetXvtrBand(-1); // выход в HF (DeactivateXvtr несёт HF-возврат) - if FSyncInt = FController.FCurrentBand then Exit; - end - else if FSyncInt = FController.FCurrentBand then - Exit; - if FController.FDevConnected then - begin FController.SaveCurrentBand; FController.FSettings.Save; end; - FController.FCurrentBand := FSyncInt; - FController.RestoreBand(FController.FCurrentBand); -end; +begin FController.SetBand(FSyncInt); end; // XVTR-выход + persist + restore — в команде procedure TWebAdapter.OnXvtrBand(Idx: Integer); begin FSyncInt := Idx; FController.Invoke(@SyncXvtrBand); end;