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 защищает от рекурсии, когда
|
// маршалятся адаптерами). FSyncingFromController защищает от рекурсии, когда
|
||||||
// программное изменение виджета триггерит его OnChange.
|
// программное изменение виджета триггерит его OnChange.
|
||||||
procedure TMainForm.OnControllerState(Sender: TObject; Field: TRadioField);
|
procedure TMainForm.OnControllerState(Sender: TObject; Field: TRadioField);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
FSyncingFromController := True;
|
FSyncingFromController := True;
|
||||||
try
|
try
|
||||||
@@ -1435,6 +1437,8 @@ begin
|
|||||||
rfNB: UpdateNBButton;
|
rfNB: UpdateNBButton;
|
||||||
rfSNB: UpdateSNBButton;
|
rfSNB: UpdateSNBButton;
|
||||||
rfANF: UpdateANFButton;
|
rfANF: UpdateANFButton;
|
||||||
|
rfAGCMode:
|
||||||
|
for i := 0 to 4 do StyleButton(BtnAGCMode[i], i = FController.FAGCMode);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
FSyncingFromController := False;
|
FSyncingFromController := False;
|
||||||
@@ -6086,16 +6090,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.OnVfoOverlayAGCChange(AGCMode: Integer);
|
procedure TMainForm.OnVfoOverlayAGCChange(AGCMode: Integer);
|
||||||
const
|
|
||||||
AGCModes: array[0..4] of TWDSPAGCMode = (agcFast, agcMedium, agcSlow, agcLong, agcOff);
|
|
||||||
var
|
|
||||||
I: Integer;
|
|
||||||
begin
|
begin
|
||||||
FController.FAGCMode := AGCMode;
|
FController.SetAGCMode(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;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.OnVfoOverlayInvalidate(Sender: TObject);
|
procedure TMainForm.OnVfoOverlayInvalidate(Sender: TObject);
|
||||||
@@ -6292,14 +6288,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.SyncWebAGC;
|
procedure TMainForm.SyncWebAGC;
|
||||||
var i: Integer;
|
|
||||||
begin
|
begin
|
||||||
if (FWebSyncInt < 0) or (FWebSyncInt > 4) then Exit;
|
FController.SetAGCMode(FWebSyncInt); // единый маппинг (исправляет старый web-баг)
|
||||||
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;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.WebOnAGCTop(DB: Integer);
|
procedure TMainForm.WebOnAGCTop(DB: Integer);
|
||||||
@@ -7296,18 +7286,9 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure TMainForm.BtnAGCModeClick(Sender: TObject);
|
procedure TMainForm.BtnAGCModeClick(Sender: TObject);
|
||||||
const
|
|
||||||
AGCModes: array[0..4] of TWDSPAGCMode = (
|
|
||||||
agcFast, agcMedium, agcSlow, agcLong, agcOff);
|
|
||||||
var
|
|
||||||
i, N: Integer;
|
|
||||||
begin
|
begin
|
||||||
N := (Sender as TFlatButton).Tag;
|
if FSyncingFromController then Exit;
|
||||||
FController.FAGCMode := N;
|
FController.SetAGCMode((Sender as TFlatButton).Tag);
|
||||||
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;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.TrkAGCChange(Sender: TObject);
|
procedure TMainForm.TrkAGCChange(Sender: TObject);
|
||||||
|
|||||||
+11
-1
@@ -382,7 +382,17 @@ procedure TRadioController.SetFilterBW(BWHz: Integer);
|
|||||||
begin FFilterBW := BWHz; Changed(rfFilterBW); { TODO wiring } end;
|
begin FFilterBW := BWHz; Changed(rfFilterBW); { TODO wiring } end;
|
||||||
|
|
||||||
procedure TRadioController.SetAGCMode(M: Integer);
|
procedure TRadioController.SetAGCMode(M: Integer);
|
||||||
begin FAGCMode := M; Changed(rfAGCMode); { TODO wiring: FDSPEngine.SetAGC } end;
|
const
|
||||||
|
// UI-индекс 0..4 (FAST/MED/SLOW/LONG/OFF) -> WDSP enum. Единый маппинг для
|
||||||
|
// всех фронтендов (раньше web ошибочно кастовал индекс прямо в enum).
|
||||||
|
AGCModes: array[0..4] of TWDSPAGCMode = (agcFast, agcMedium, agcSlow, agcLong, agcOff);
|
||||||
|
begin
|
||||||
|
if (M < 0) or (M > 4) then Exit;
|
||||||
|
FAGCMode := M;
|
||||||
|
if FWDSPReady and Assigned(FDSPEngine) then FDSPEngine.SetAGC(AGCModes[M], 50.0);
|
||||||
|
FBandCache[FCurrentBand].AGCMode := FAGCMode;
|
||||||
|
Changed(rfAGCMode);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRadioController.SetAGCTop(DB: Integer);
|
procedure TRadioController.SetAGCTop(DB: Integer);
|
||||||
begin FAGCTop := DB; Changed(rfAGCTop); { TODO wiring } end;
|
begin FAGCTop := DB; Changed(rfAGCTop); { TODO wiring } end;
|
||||||
|
|||||||
Reference in New Issue
Block a user