From ad21516d48df13a47b8a4246c326cfd799a9c919 Mon Sep 17 00:00:00 2001 From: Uladzimir Karpenka Date: Thu, 4 Jun 2026 15:00:04 +0300 Subject: [PATCH] Phase 3 (batch 4): route RX step attenuator through controller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SetAtten clamps, applies to the network (SetStepAtten), and fires OnStateChanged; SyncWebAttn calls it. No desktop widget exists for the attenuator, so there's no OnControllerState case — but state and the web snapshot now flow through the single command path like everything else. Builds clean (cocoa). Co-Authored-By: Claude Opus 4.8 --- MainForm.pas | 3 +-- RadioController.pas | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MainForm.pas b/MainForm.pas index 94fbe3f..2e7101c 100644 --- a/MainForm.pas +++ b/MainForm.pas @@ -6638,8 +6638,7 @@ end; procedure TMainForm.SyncWebAttn; begin - FController.FAtten := Max(0, Min(2, FWebSyncInt)); - FController.FNetwork.SetStepAtten(FController.FAtten * 10); + FController.SetAtten(FWebSyncInt); end; procedure TMainForm.WebOnFMStep(Idx: Integer); diff --git a/RadioController.pas b/RadioController.pas index 03076f4..47eb0d4 100644 --- a/RadioController.pas +++ b/RadioController.pas @@ -442,7 +442,12 @@ procedure TRadioController.DriveBy(Delta: Integer); begin SetDrive(FDrivePercent + Delta); end; procedure TRadioController.SetAtten(Idx: Integer); -begin FAtten := Idx; Changed(rfAtten); { TODO wiring } end; +begin + if Idx < 0 then Idx := 0 else if Idx > 2 then Idx := 2; + FAtten := Idx; + if Assigned(FNetwork) then FNetwork.SetStepAtten(FAtten * 10); + Changed(rfAtten); +end; procedure TRadioController.SetBand(Idx: Integer); begin FCurrentBand := Idx; Changed(rfBand); { TODO wiring: RestoreBand } end;