mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 18:43:51 +00:00
Phase 3 (batch 14): route VFO swap / A>B / B>A through controller
Filled the three VFO-transfer commands (the skeletons were also backwards: VfoACopyB stored A:=B etc). - VfoSwap: swaps A/B, retunes the receiver to the active VFO freq (center=freq, shift 0), HF band-detect, network push. Fires rfVfoA/rfVfoB/rfBand. UI handler is thin (+ ruler-cache invalidate, since a swap is a large freq jump). - VfoACopyB (A>B): delegates to SetVfoB(FVfoA) — store B:=A, retune when B active, render via rfVfoB. - VfoBCopyA (B>A): copies B->A; when A active goes through SetVfoA, else just fires rfVfoA. The desktop B>A handler still calls ApplyVfoA for the active-A case to preserve channel orchestration (auto-CTCSS / pre-channel drive), matching the original (A>B never had that path). Net simplification; builds clean, links. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
38947113f5
commit
a8a192a3a3
+10
-57
@@ -5395,78 +5395,31 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.BtnVfoSwapClick(Sender: TObject);
|
procedure TMainForm.BtnVfoSwapClick(Sender: TObject);
|
||||||
var
|
|
||||||
Tmp: Double;
|
|
||||||
BandIdx: Integer;
|
|
||||||
ActiveFreq: Int64;
|
|
||||||
begin
|
begin
|
||||||
// Меняем частоты местами
|
// Своп + перестройка — в контроллере; рендер дисплеев/спектра/band — через
|
||||||
Tmp := FController.FVfoA; FController.FVfoA := FController.FVfoB; FController.FVfoB := Tmp;
|
// OnControllerState(rfVfoA/rfVfoB/rfBand). Кэш линейки сбрасываем здесь
|
||||||
|
// (большой скачок частоты — позиции тиков меняются).
|
||||||
// Определяем новую частоту активного VFO
|
FController.VfoSwap;
|
||||||
if FController.FActiveVfo = 0 then ActiveFreq := Round(FController.FVfoA)
|
|
||||||
else ActiveFreq := Round(FController.FVfoB);
|
|
||||||
|
|
||||||
// Перестраиваем приёмник
|
|
||||||
FController.FCenterFreq := ActiveFreq;
|
|
||||||
if FController.FWDSPReady then FController.FDSPEngine.SetShift(0.0);
|
|
||||||
if FController.FNetwork.Connected and FController.FNetwork.Running then
|
|
||||||
begin
|
|
||||||
FController.FNetwork.UpdateState(XvtrTranslate(FController.FCenterFreq), XvtrTranslate(ActiveTXFreqHz), FController.FDriveLevel, FController.FTransmitting, True, True);
|
|
||||||
FController.FNetwork.SendFullHP;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Обновляем кнопку диапазона
|
|
||||||
BandIdx := FreqToBandIdx(ActiveFreq);
|
|
||||||
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;
|
FSpecView.InvalidateRulerCache;
|
||||||
UpdateVfoDisplay;
|
|
||||||
SyncSpecViewFreq;
|
|
||||||
FSpecView.DrawSpectrum;
|
|
||||||
PbSpectrum.Invalidate;
|
|
||||||
if PbRuler <> nil then PbRuler.Invalidate;
|
if PbRuler <> nil then PbRuler.Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.BtnVfoACopyBClick(Sender: TObject);
|
procedure TMainForm.BtnVfoACopyBClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
// A>B: копируем частоту A в B (VFO-B получает частоту VFO-A)
|
// A>B: B получает частоту A. Команда сохраняет B, перестраивает если B
|
||||||
FController.FVfoB := FController.FVfoA;
|
// активен, рендерит через OnControllerState(rfVfoB).
|
||||||
if FController.FActiveVfo = 1 then
|
FController.VfoACopyB;
|
||||||
begin
|
|
||||||
// B активен — перестраиваем приёмник на новую частоту B
|
|
||||||
FController.FCenterFreq := Round(FController.FVfoB);
|
|
||||||
if FController.FWDSPReady then FController.FDSPEngine.SetShift(0.0);
|
|
||||||
if FController.FNetwork.Connected and FController.FNetwork.Running then
|
|
||||||
begin
|
|
||||||
FController.FNetwork.UpdateState(XvtrTranslate(FController.FCenterFreq), XvtrTranslate(ActiveTXFreqHz), FController.FDriveLevel, FController.FTransmitting, True, True);
|
|
||||||
FController.FNetwork.SendFullHP;
|
|
||||||
end;
|
|
||||||
FSpecView.InvalidateRulerCache;
|
|
||||||
SyncSpecViewFreq;
|
|
||||||
FSpecView.DrawSpectrum; PbSpectrum.Invalidate;
|
|
||||||
if PbRuler <> nil then PbRuler.Invalidate;
|
|
||||||
end;
|
|
||||||
FreqDispB.Frequency := Round(FController.FVfoB);
|
|
||||||
UpdateVfoDisplay;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.BtnVfoBCopyAClick(Sender: TObject);
|
procedure TMainForm.BtnVfoBCopyAClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
// B>A: копируем частоту B в A (VFO-A получает частоту VFO-B)
|
// B>A: A получает частоту B. При активном A идём через ApplyVfoA (сохраняем
|
||||||
|
// канальную оркестрацию); иначе только сохраняем + рендер дисплея.
|
||||||
FController.FVfoA := FController.FVfoB;
|
FController.FVfoA := FController.FVfoB;
|
||||||
if FController.FActiveVfo = 0 then
|
if FController.FActiveVfo = 0 then
|
||||||
ApplyVfoA(Round(FController.FVfoA)) // A активен — перестраиваем приёмник
|
ApplyVfoA(Round(FController.FVfoA))
|
||||||
else
|
else
|
||||||
begin
|
|
||||||
FreqDispA.Frequency := Round(FController.FVfoA);
|
FreqDispA.Frequency := Round(FController.FVfoA);
|
||||||
UpdateVfoDisplay;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainForm.ActiveTXFreqHz: Double;
|
function TMainForm.ActiveTXFreqHz: Double;
|
||||||
|
|||||||
+31
-6
@@ -672,14 +672,39 @@ procedure TRadioController.SetCenter(Hz: Double);
|
|||||||
begin FCenterFreq := Hz; Changed(rfCenterFreq); { TODO wiring } end;
|
begin FCenterFreq := Hz; Changed(rfCenterFreq); { TODO wiring } end;
|
||||||
|
|
||||||
procedure TRadioController.VfoSwap;
|
procedure TRadioController.VfoSwap;
|
||||||
var T: Double;
|
// Меняем VFO A/B местами и перестраиваем приёмник на новую частоту активного
|
||||||
begin T := FVfoA; FVfoA := FVfoB; FVfoB := T; Changed(rfVfoA); Changed(rfVfoB); { TODO wiring } end;
|
// VFO (центр=частота, shift 0 — CTUN-оффсет после свопа теряет смысл).
|
||||||
|
var
|
||||||
|
T: Double;
|
||||||
|
ActiveFreq: Double;
|
||||||
|
BandIdx: Integer;
|
||||||
|
begin
|
||||||
|
T := FVfoA; FVfoA := FVfoB; FVfoB := T;
|
||||||
|
ActiveFreq := ActiveVfoHz;
|
||||||
|
FCenterFreq := ActiveFreq;
|
||||||
|
if FWDSPReady and Assigned(FDSPEngine) then FDSPEngine.SetShift(0.0);
|
||||||
|
BandIdx := FreqToBandIdx(ActiveFreq);
|
||||||
|
if (BandIdx >= 0) and (BandIdx <> FCurrentBand) then
|
||||||
|
begin
|
||||||
|
FCurrentBand := BandIdx;
|
||||||
|
Changed(rfBand);
|
||||||
|
end;
|
||||||
|
PushNetworkState;
|
||||||
|
Changed(rfVfoA);
|
||||||
|
Changed(rfVfoB);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRadioController.VfoACopyB;
|
procedure TRadioController.VfoACopyB; // A>B: частота A копируется в B
|
||||||
begin FVfoA := FVfoB; Changed(rfVfoA); { TODO wiring } end;
|
begin
|
||||||
|
SetVfoB(FVfoA); // сохраняет B:=A, перестраивает если B активен, рендер rfVfoB
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRadioController.VfoBCopyA;
|
procedure TRadioController.VfoBCopyA; // B>A: частота B копируется в A
|
||||||
begin FVfoB := FVfoA; Changed(rfVfoB); { TODO wiring } end;
|
begin
|
||||||
|
FVfoA := FVfoB;
|
||||||
|
if FActiveVfo = 0 then SetVfoA(FVfoA) // A активен — перестраиваем приёмник
|
||||||
|
else Changed(rfVfoA); // A неактивен — только рендер дисплея
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRadioController.SetMode(M: Integer);
|
procedure TRadioController.SetMode(M: Integer);
|
||||||
begin
|
begin
|
||||||
|
|||||||
Reference in New Issue
Block a user