mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 18:43:51 +00:00
Phase 3 (batch 13): route active-VFO switch through controller command
- TRadioController.SetActiveVfo(Idx): switches the active RX VFO and retunes the receiver to its frequency. CTUN handling preserved: if the new VFO's freq is visible in the current window, only the demodulator shift changes (DDC/network untouched); otherwise CTUN is dropped and the window centers on the freq. HF band-detect + network push as before. Fires Changed(rfActiveVfo) (+ rfBand / rfCTun when those change). - OnControllerState(rfActiveVfo): UpdateVfoDisplay (freq displays + RX/TX button highlights) and a full spectrum/waterfall/ruler redraw. MainForm.ActivateVfo is now a thin delegate; all callers (VFO select/TX buttons, freq-display clicks, web ActivateVfo) go through it unchanged. Band-detect keeps the historical no-drive-recalc behavior. Builds clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
af85ddece6
commit
9f7a48f89a
+51
-1
@@ -610,7 +610,57 @@ begin
|
||||
end;
|
||||
|
||||
procedure TRadioController.SetActiveVfo(Idx: Integer);
|
||||
begin FActiveVfo := Idx; Changed(rfActiveVfo); { TODO wiring: ActivateVfo } end;
|
||||
// Переключение активного (RX) VFO с перестройкой приёмника на его частоту.
|
||||
// CTUN: если частота нового VFO видна в текущем окне — только меняем shift
|
||||
// (DDC/сеть не трогаем); иначе CTUN сбрасывается и центрируемся на частоте.
|
||||
// Рендер (дисплеи/спектр/band/CTUN-кнопка) — в UI через OnControllerState.
|
||||
var
|
||||
ActiveFreq: Double;
|
||||
HalfSpan, Offset: Double;
|
||||
FreqVisible: Boolean;
|
||||
BandIdx: Integer;
|
||||
begin
|
||||
FActiveVfo := Idx;
|
||||
ActiveFreq := ActiveVfoHz;
|
||||
|
||||
if FCTun then
|
||||
begin
|
||||
HalfSpan := FSpanHz / 2;
|
||||
Offset := ActiveFreq - FCenterFreq;
|
||||
FreqVisible := (Offset > -HalfSpan) and (Offset < HalfSpan);
|
||||
if FreqVisible then
|
||||
begin
|
||||
// Частота видна — просто сдвигаем демодулятор, DDC/сеть не трогаем.
|
||||
if FWDSPReady and Assigned(FDSPEngine) then FDSPEngine.SetShift(Offset);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// Частота за окном — сбрасываем CTUN и центрируемся на ней.
|
||||
FCTun := False;
|
||||
FBandCache[FCurrentBand].CTun := False;
|
||||
FCenterFreq := ActiveFreq;
|
||||
if FWDSPReady and Assigned(FDSPEngine) then FDSPEngine.SetShift(0.0);
|
||||
PushNetworkState;
|
||||
Changed(rfCTun);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
FCenterFreq := ActiveFreq;
|
||||
if FWDSPReady and Assigned(FDSPEngine) then FDSPEngine.SetShift(0.0);
|
||||
PushNetworkState;
|
||||
end;
|
||||
|
||||
// Детект диапазона по новой частоте (без пересчёта drive — как исторически).
|
||||
BandIdx := FreqToBandIdx(ActiveFreq);
|
||||
if (BandIdx >= 0) and (BandIdx <> FCurrentBand) then
|
||||
begin
|
||||
FCurrentBand := BandIdx;
|
||||
Changed(rfBand);
|
||||
end;
|
||||
|
||||
Changed(rfActiveVfo);
|
||||
end;
|
||||
|
||||
procedure TRadioController.TuneActiveBy(DeltaHz: Double);
|
||||
begin
|
||||
|
||||
Reference in New Issue
Block a user