From 7d3570346fc194205963c9faf7ec8e39dc47bb4e Mon Sep 17 00:00:00 2001 From: Uladzimir Karpenka Date: Thu, 4 Jun 2026 15:10:44 +0300 Subject: [PATCH] Phase 3 (batch 5): route FM step through controller command FM step is the only FM control exposed to another frontend (web: SyncWebFMStep in, FWebServer.FMStepIdx out), so it's the FM param with real cross-frontend value. - TRadioController.SetFMStep clamps and fires OnStateChanged(rfFMStepIdx). - OnControllerState updates the step dropdown, pushes FMStepIdx to the web server, and sets the FSpecView FM grid step (when in FM mode). - MainForm.SetFMStep is now a thin wrapper over the command, so existing callers (band restore, dropdown select, web sync, XVTR restore) are unchanged. FM squelch/CTCSS/repeater are intentionally left as-is: they are UI-only (no web/CAT/daemon exposure) and already operate on controller state fields, so routing them through commands adds ceremony without value for the swappable-UI/daemon goals; CTCSS would also need CTCSS_TONES relocated to a shared unit and repeater needs the network helpers (XvtrTranslate/ ActiveTXFreqHz) that belong to the heavy-command batch. Builds clean (cocoa). Co-Authored-By: Claude Opus 4.8 --- MainForm.pas | 16 +++++++++++----- RadioController.pas | 6 +++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/MainForm.pas b/MainForm.pas index 2e7101c..43223a6 100644 --- a/MainForm.pas +++ b/MainForm.pas @@ -1453,6 +1453,13 @@ begin FSpecView.WfAGCEnabled := FController.FWfAGCEnabled; rfWfNF: FSpecView.WfNFEnabled := FController.FWfNFEnabled; + rfFMStepIdx: + begin + if FStepDropDown <> nil then FStepDropDown.SetItemIndex(FController.FFMStepIdx); + if FWebServer <> nil then FWebServer.FMStepIdx := FController.FFMStepIdx; + if (FController.FMode = MODE_FM) and (FSpecView <> nil) then + FSpecView.FMGridStepHz := FM_STEP_HZ[FController.FFMStepIdx]; + end; end; finally FSyncingFromController := False; @@ -5400,11 +5407,10 @@ end; procedure TMainForm.SetFMStep(Idx: Integer); begin - FController.FFMStepIdx := Idx; - if FStepDropDown <> nil then FStepDropDown.SetItemIndex(Idx); - if FWebServer <> nil then FWebServer.FMStepIdx := Idx; - if (FController.FMode = MODE_FM) and (FSpecView <> nil) then - FSpecView.FMGridStepHz := FM_STEP_HZ[Idx]; + // Тонкая обёртка: команда контроллера обновит UI/web/спецвью через + // OnControllerState(rfFMStepIdx). Сохранена для существующих вызовов + // (RestoreBand, dropdown-select, web-sync, XVTR-restore). + FController.SetFMStep(Idx); end; procedure TMainForm.BtnFMStepClick(Sender: TObject); diff --git a/RadioController.pas b/RadioController.pas index 47eb0d4..b408e43 100644 --- a/RadioController.pas +++ b/RadioController.pas @@ -516,7 +516,11 @@ procedure TRadioController.SetTune(On_: Boolean); begin FTuning := On_; Changed(rfTuning); { TODO wiring: ApplyTUN } end; procedure TRadioController.SetFMStep(Idx: Integer); -begin FFMStepIdx := Idx; Changed(rfFMStepIdx); { TODO wiring } end; +begin + if Idx < 0 then Idx := 0 else if Idx > 3 then Idx := 3; // FM_STEP_COUNT = 4 + FFMStepIdx := Idx; + Changed(rfFMStepIdx); +end; procedure TRadioController.SetFMCTCSS(On_: Boolean); begin FFMCTCSSOn := On_; Changed(rfFMCTCSS); { TODO wiring } end;