mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
Phase 3 (batch 20): unify web/CAT VFO-B onto the SetVfoB command
SyncWebFreq (VFO-B branch), SyncWebFreqB and SyncCATVfoB each carried a copy of the pre-SetVfoB inline VFO-B block that pushed the radio via SetRunAndFreq(True,...). That reset the HP sequence counter on every freq change (only correct at Run start), left FIsTransmitting/Alex flags stale, skipped the drive recalc on a band crossing, and forced shift=0 (ignoring CTUN). All three now delegate to FController.SetVfoB, so web, CAT and desktop share one path (ApplyTuneCore + PushNetworkState) with rendering via OnControllerState(rfVfoB/rfBand). ~70 lines removed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
492b29bea1
commit
c7d93c2e46
+8
-67
@@ -5611,32 +5611,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.SyncWebFreq;
|
procedure TMainForm.SyncWebFreq;
|
||||||
var BandIdx: Integer;
|
|
||||||
begin
|
begin
|
||||||
// Веб шлёт "freq" для активного VFO
|
// Веб шлёт "freq" для активного VFO — маршрутизируем через те же команды,
|
||||||
|
// что и десктоп (рендер/сеть/band-detect внутри них и в OnControllerState).
|
||||||
if FController.FActiveVfo = 0 then
|
if FController.FActiveVfo = 0 then
|
||||||
ApplyVfoA(Round(FWebSyncFreq))
|
ApplyVfoA(Round(FWebSyncFreq))
|
||||||
else
|
else
|
||||||
begin
|
FController.SetVfoB(FWebSyncFreq);
|
||||||
FController.FVfoB := FWebSyncFreq;
|
|
||||||
FreqDispB.Frequency := Round(FController.FVfoB);
|
|
||||||
FController.FCenterFreq := FController.FVfoB;
|
|
||||||
if FController.FWDSPReady then FController.FDSPEngine.SetShift(0.0);
|
|
||||||
if FController.FRunning then
|
|
||||||
FController.FNetwork.SetRunAndFreq(True, XvtrTranslate(FController.FCenterFreq), XvtrTranslate(FController.FCenterFreq), FController.FDriveLevel);
|
|
||||||
BandIdx := FreqToBandIdx(FController.FVfoB);
|
|
||||||
if (BandIdx >= 0) and (BandIdx <> FController.FCurrentBand) then
|
|
||||||
begin
|
|
||||||
StyleButton(BtnBand[FController.FCurrentBand], False);
|
|
||||||
FController.FCurrentBand := BandIdx;
|
|
||||||
StyleButton(BtnBand[FController.FCurrentBand], True);
|
|
||||||
end;
|
|
||||||
FSpecView.InvalidateRulerCache;
|
|
||||||
SyncSpecViewFreq;
|
|
||||||
FSpecView.DrawSpectrum; PbSpectrum.Invalidate;
|
|
||||||
if PbRuler <> nil then PbRuler.Invalidate;
|
|
||||||
UpdateVfoDisplay;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.WebOnMode(Mode: Integer);
|
procedure TMainForm.WebOnMode(Mode: Integer);
|
||||||
@@ -5956,30 +5937,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.SyncWebFreqB;
|
procedure TMainForm.SyncWebFreqB;
|
||||||
var BandIdx: Integer;
|
|
||||||
begin
|
begin
|
||||||
FController.FVfoB := FWebSyncFreq;
|
// Унифицировано с десктопом: команда хранит частоту, при активном B
|
||||||
FreqDispB.Frequency := Round(FController.FVfoB);
|
// перестраивает приёмник (CTUN-aware) + сеть; рендер — через rfVfoB/rfBand.
|
||||||
if FController.FActiveVfo = 1 then
|
FController.SetVfoB(FWebSyncFreq);
|
||||||
begin
|
|
||||||
FController.FCenterFreq := FController.FVfoB;
|
|
||||||
if not FController.FCTun then
|
|
||||||
if FController.FWDSPReady then FController.FDSPEngine.SetShift(0.0);
|
|
||||||
if FController.FRunning then
|
|
||||||
FController.FNetwork.SetRunAndFreq(True, XvtrTranslate(FController.FCenterFreq), XvtrTranslate(FController.FCenterFreq), FController.FDriveLevel);
|
|
||||||
BandIdx := FreqToBandIdx(FController.FVfoB);
|
|
||||||
if (BandIdx >= 0) and (BandIdx <> FController.FCurrentBand) then
|
|
||||||
begin
|
|
||||||
StyleButton(BtnBand[FController.FCurrentBand], False);
|
|
||||||
FController.FCurrentBand := BandIdx;
|
|
||||||
StyleButton(BtnBand[FController.FCurrentBand], True);
|
|
||||||
end;
|
|
||||||
FSpecView.InvalidateRulerCache;
|
|
||||||
SyncSpecViewFreq;
|
|
||||||
FSpecView.DrawSpectrum; PbSpectrum.Invalidate;
|
|
||||||
if PbRuler <> nil then PbRuler.Invalidate;
|
|
||||||
end;
|
|
||||||
UpdateVfoDisplay;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// ── Активный VFO (из веба) ───────────────────────────────────────────────
|
// ── Активный VFO (из веба) ───────────────────────────────────────────────
|
||||||
@@ -7063,29 +7024,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.SyncCATVfoB;
|
procedure TMainForm.SyncCATVfoB;
|
||||||
var BandIdx: Integer;
|
|
||||||
begin
|
begin
|
||||||
FController.FVfoB := FCATSyncFreq;
|
// Унифицировано с десктопом/вебом: та же команда SetVfoB.
|
||||||
FreqDispB.Frequency := Round(FController.FVfoB);
|
FController.SetVfoB(FCATSyncFreq);
|
||||||
if FController.FActiveVfo = 1 then
|
|
||||||
begin
|
|
||||||
FController.FCenterFreq := FController.FVfoB;
|
|
||||||
if FController.FWDSPReady then FController.FDSPEngine.SetShift(0.0);
|
|
||||||
if FController.FRunning then
|
|
||||||
FController.FNetwork.SetRunAndFreq(True, XvtrTranslate(FController.FCenterFreq), XvtrTranslate(FController.FCenterFreq), FController.FDriveLevel);
|
|
||||||
BandIdx := FreqToBandIdx(FController.FVfoB);
|
|
||||||
if (BandIdx >= 0) and (BandIdx <> FController.FCurrentBand) then
|
|
||||||
begin
|
|
||||||
StyleButton(BtnBand[FController.FCurrentBand], False);
|
|
||||||
FController.FCurrentBand := BandIdx;
|
|
||||||
StyleButton(BtnBand[FController.FCurrentBand], True);
|
|
||||||
end;
|
|
||||||
FSpecView.InvalidateRulerCache;
|
|
||||||
SyncSpecViewFreq;
|
|
||||||
FSpecView.DrawSpectrum; PbSpectrum.Invalidate;
|
|
||||||
if PbRuler <> nil then PbRuler.Invalidate;
|
|
||||||
UpdateVfoDisplay;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.SyncCATBandUp;
|
procedure TMainForm.SyncCATBandUp;
|
||||||
|
|||||||
Reference in New Issue
Block a user