mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
Phase 3 (batch 2): route AGC mode through controller command
TRadioController.SetAGCMode now owns the index->WDSP mapping, applies to the DSP engine, and updates the band cache, then fires OnStateChanged. OnControllerState restyles the AGC button group. BtnAGCModeClick, OnVfoOverlayAGCChange, and SyncWebAGC all call the command. Fixes a latent web bug: SyncWebAGC used TWDSPAGCMode(index) directly, mapping the UI index (0=FAST..4=OFF) onto the wrong enum (0=OFF...), so web AGC selections set the wrong DSP mode. The button/overlay path used the correct AGCModes[] array; unifying on the command applies that to web too. Buttons/overlay behavior unchanged. Builds clean (cocoa). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ff42889fa1
commit
f76533f209
+8
-27
@@ -1420,6 +1420,8 @@ end;
|
||||
// маршалятся адаптерами). FSyncingFromController защищает от рекурсии, когда
|
||||
// программное изменение виджета триггерит его OnChange.
|
||||
procedure TMainForm.OnControllerState(Sender: TObject; Field: TRadioField);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
FSyncingFromController := True;
|
||||
try
|
||||
@@ -1435,6 +1437,8 @@ begin
|
||||
rfNB: UpdateNBButton;
|
||||
rfSNB: UpdateSNBButton;
|
||||
rfANF: UpdateANFButton;
|
||||
rfAGCMode:
|
||||
for i := 0 to 4 do StyleButton(BtnAGCMode[i], i = FController.FAGCMode);
|
||||
end;
|
||||
finally
|
||||
FSyncingFromController := False;
|
||||
@@ -6086,16 +6090,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainForm.OnVfoOverlayAGCChange(AGCMode: Integer);
|
||||
const
|
||||
AGCModes: array[0..4] of TWDSPAGCMode = (agcFast, agcMedium, agcSlow, agcLong, agcOff);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
FController.FAGCMode := AGCMode;
|
||||
for I := 0 to 4 do StyleButton(BtnAGCMode[I], I = AGCMode);
|
||||
if FController.FWDSPReady then
|
||||
FController.FDSPEngine.SetAGC(AGCModes[AGCMode], 50.0);
|
||||
FController.FBandCache[FController.FCurrentBand].AGCMode := FController.FAGCMode;
|
||||
FController.SetAGCMode(AGCMode);
|
||||
end;
|
||||
|
||||
procedure TMainForm.OnVfoOverlayInvalidate(Sender: TObject);
|
||||
@@ -6292,14 +6288,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainForm.SyncWebAGC;
|
||||
var i: Integer;
|
||||
begin
|
||||
if (FWebSyncInt < 0) or (FWebSyncInt > 4) then Exit;
|
||||
FController.FAGCMode := FWebSyncInt;
|
||||
for i := 0 to 4 do StyleButton(BtnAGCMode[i], i = FController.FAGCMode);
|
||||
if FController.FWDSPReady then
|
||||
FController.FDSPEngine.SetAGC(TWDSPAGCMode(FController.FAGCMode), 50.0);
|
||||
FController.FBandCache[FController.FCurrentBand].AGCMode := FController.FAGCMode;
|
||||
FController.SetAGCMode(FWebSyncInt); // единый маппинг (исправляет старый web-баг)
|
||||
end;
|
||||
|
||||
procedure TMainForm.WebOnAGCTop(DB: Integer);
|
||||
@@ -7296,18 +7286,9 @@ end;
|
||||
|
||||
|
||||
procedure TMainForm.BtnAGCModeClick(Sender: TObject);
|
||||
const
|
||||
AGCModes: array[0..4] of TWDSPAGCMode = (
|
||||
agcFast, agcMedium, agcSlow, agcLong, agcOff);
|
||||
var
|
||||
i, N: Integer;
|
||||
begin
|
||||
N := (Sender as TFlatButton).Tag;
|
||||
FController.FAGCMode := N;
|
||||
for i := 0 to 4 do StyleButton(BtnAGCMode[i], i = N);
|
||||
if FController.FWDSPReady then
|
||||
FController.FDSPEngine.SetAGC(AGCModes[N], 50.0);
|
||||
FController.FBandCache[FController.FCurrentBand].AGCMode := FController.FAGCMode;
|
||||
if FSyncingFromController then Exit;
|
||||
FController.SetAGCMode((Sender as TFlatButton).Tag);
|
||||
end;
|
||||
|
||||
procedure TMainForm.TrkAGCChange(Sender: TObject);
|
||||
|
||||
Reference in New Issue
Block a user