mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
Phase 3 (batch 12): consolidate VFO B tuning into controller command
The "set VFO B" engine block was duplicated inline across three tune paths (DoSpectrumClick, DoSpectrumDrag, FreqDispBChanged), each subtly different (drag had no band-detect/ruler; click had no drive recalc). - TRadioController.SetVfoB(Hz): always stores FVfoB; when B is the active VFO, retunes the receiver (DDC=VFO B, no CTUN, shift 0), HF band-detects (FCurrentBand + drive recalc -> Changed(rfBand)) and pushes to the radio; when B is inactive (split, listening on A) it only stores the freq for TX. Fires Changed(rfVfoB). - OnControllerState(rfVfoB): renders FreqDispB and, when B active, the spectrum/ruler (deferred via FSpectrumDirty, matching the rfVfoA path). The three call sites collapse to a single FController.SetVfoB(...) each; FreqDispBChanged is now a one-liner. Behavior unified: click/FreqDispB drop from sync DrawSpectrum to deferred (consistent with VFO A click-to-tune, imperceptible); drag gains band-detect + ruler refresh; click gains drive recalc on band change. Net -23 lines. Left inline (not identical): DoWidebandClick VFO B (extra XVTR clamp + wideband-specific render) and SyncWebFreq (uses SetRunAndFreq, the web/run network path, not UpdateState+SendFullHP). 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
908c02d08a
commit
eb10283c85
+25
-1
@@ -571,7 +571,31 @@ begin
|
||||
end;
|
||||
|
||||
procedure TRadioController.SetVfoB(Hz: Double);
|
||||
begin FVfoB := Hz; Changed(rfVfoB); { TODO wiring } end;
|
||||
// VFO B всегда сохраняется. Если B активен — перестраиваем приёмник (DDC=VFO B,
|
||||
// без CTUN, сдвиг 0), детектим диапазон и толкаем в сеть. Если B неактивен
|
||||
// (split, слушаем A) — только сохраняем частоту (используется для TX).
|
||||
// Рендер FreqDispB/спектра — в UI через OnControllerState(rfVfoB).
|
||||
var BandIdx: Integer;
|
||||
begin
|
||||
FVfoB := Hz;
|
||||
if FActiveVfo = 1 then
|
||||
begin
|
||||
FCenterFreq := FVfoB;
|
||||
if FWDSPReady and Assigned(FDSPEngine) then FDSPEngine.SetShift(0.0);
|
||||
if FCurrentXvtr < 0 then
|
||||
begin
|
||||
BandIdx := FreqToBandIdx(FVfoB);
|
||||
if (BandIdx >= 0) and (BandIdx <> FCurrentBand) then
|
||||
begin
|
||||
FCurrentBand := BandIdx;
|
||||
FDriveLevel := CalcDriveByte;
|
||||
Changed(rfBand);
|
||||
end;
|
||||
end;
|
||||
PushNetworkState;
|
||||
end;
|
||||
Changed(rfVfoB);
|
||||
end;
|
||||
|
||||
procedure TRadioController.SetActiveVfo(Idx: Integer);
|
||||
begin FActiveVfo := Idx; Changed(rfActiveVfo); { TODO wiring: ActivateVfo } end;
|
||||
|
||||
Reference in New Issue
Block a user