mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 18:43:51 +00:00
Fix active-VFO desync; add bandstack-on-VFO-switch and per-XVTR VFO-B
Active-VFO desync (batch 15 follow-up): DoConnectDevice loaded FActiveVfo from settings but never re-rendered the highlight (it was drawn once in FormCreate while the field was still 0) nor re-tuned the receiver. Result on reconnect with B last-active: the engine (spectrum, filter band, mouse tuning) ran on VFO B while the UI showed A active. Now the connect path brings both the receiver and the highlight to the actually-active VFO via SetActiveVfo, and RestoreBand's final retune follows the active VFO (A -> ApplyVfoA, B -> SetVfoB) instead of always A. Bandstack on VFO switch: switching the active VFO to one parked on a different ham band now restores that band's DSP state (mode/filter/AGC/ CTUN/FM). Extracted ApplyBandDSP (the DSP half of RestoreBand, without the VFO frequencies) and reused it from both RestoreBand and SetActiveVfo. VFO frequencies stay independent (each VFO carries its own band); continuous tuning across a band edge still does not recall (band button only) as on real radios. SaveCurrentBand no longer writes a VFO frequency into a band's memory unless that VFO is actually within the band, so a 40m VFO-A no longer pollutes 30m's stored VfoA. Per-transverter VFO-B: TXvtrEntry gains LastFreqB (load/save/default + range clamp). ActivateXvtrBand restores VFO B, Deactivate/SaveAllAndExit persist it, and SetVfoB clamps to the transverter range like SetVfoA. The connect-time guard that forced VFO A in XVTR is dropped since B is now a valid, in-range frequency there too. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
24102343ea
commit
e09bc21bba
+11
-2
@@ -161,7 +161,8 @@ type
|
||||
TXPower: Integer; // 0..100 % (drive level специально для XVTR)
|
||||
DisablePA: Boolean; // True — отключить внутренний PA при TX (XVTR имеет свой)
|
||||
RXAntenna: Byte; // 0=по-умолчанию(основной band), 1=ANT1, 2=ANT2, 3=ANT3
|
||||
LastFreq: Double; // Hz — последняя tuned visible частота (BandStack)
|
||||
LastFreq: Double; // Hz — последняя tuned visible частота VFO A (BandStack)
|
||||
LastFreqB: Double; // Hz — последняя tuned visible частота VFO B
|
||||
LastMode: Integer; // Mode (LSB=0,USB=1,…FM=5)
|
||||
LastFilterIdx: Integer; // FM: 0=NFM, 1=WFM; иначе 0..FILT_COUNT-1
|
||||
LastFMSQOn: Boolean;
|
||||
@@ -1205,6 +1206,7 @@ begin
|
||||
X.Entries[i].DisablePA := False;
|
||||
X.Entries[i].RXAntenna := 0;
|
||||
X.Entries[i].LastFreq := 0.0;
|
||||
X.Entries[i].LastFreqB := 0.0;
|
||||
X.Entries[i].LastMode := 1; // USB — VHF SSB calling default
|
||||
X.Entries[i].LastFilterIdx := 0; // NFM
|
||||
X.Entries[i].LastFMSQOn := False;
|
||||
@@ -1227,11 +1229,13 @@ begin
|
||||
X.Entries[0].FreqEnd := 148000000;
|
||||
X.Entries[0].LOOffset := 116000000;
|
||||
X.Entries[0].LastFreq := 144300000;
|
||||
X.Entries[0].LastFreqB := 145500000;
|
||||
X.Entries[1].ButtonText := '70cm';
|
||||
X.Entries[1].FreqBegin := 430000000;
|
||||
X.Entries[1].FreqEnd := 440000000;
|
||||
X.Entries[1].LOOffset := 404000000;
|
||||
X.Entries[1].LastFreq := 432200000;
|
||||
X.Entries[1].LastFreqB := 433000000;
|
||||
end;
|
||||
|
||||
function TSettingsManager.LoadXvtr(const MAC: array of Byte;
|
||||
@@ -1265,6 +1269,7 @@ begin
|
||||
X.Entries[i].DisablePA := JB(EObj, 'dis_pa', X.Entries[i].DisablePA);
|
||||
X.Entries[i].RXAntenna := EnsureRange(JI(EObj, 'rx_ant', X.Entries[i].RXAntenna), 0, 3);
|
||||
X.Entries[i].LastFreq := JD(EObj, 'last_freq', X.Entries[i].LastFreq);
|
||||
X.Entries[i].LastFreqB := JD(EObj, 'last_freq_b', X.Entries[i].LastFreqB);
|
||||
X.Entries[i].LastMode := EnsureRange(JI(EObj, 'last_mode', X.Entries[i].LastMode), 0, 7);
|
||||
X.Entries[i].LastFilterIdx := EnsureRange(JI(EObj, 'last_filt', X.Entries[i].LastFilterIdx), 0, 9);
|
||||
X.Entries[i].LastFMSQOn := JB(EObj, 'last_fmsq_on', X.Entries[i].LastFMSQOn);
|
||||
@@ -1280,10 +1285,13 @@ begin
|
||||
X.Entries[i].LastFMRptOffsetHz := JD(EObj, 'last_fmrpt_offset', X.Entries[i].LastFMRptOffsetHz);
|
||||
X.Entries[i].LastCTCSSAutoActive := JB(EObj, 'last_ctcss_auto', X.Entries[i].LastCTCSSAutoActive);
|
||||
X.Entries[i].LastFMRptAutoActive := JB(EObj, 'last_fmrpt_auto', X.Entries[i].LastFMRptAutoActive);
|
||||
// Валидация: LastFreq должен быть в [FreqBegin..FreqEnd]
|
||||
// Валидация: Last freqs должны быть в [FreqBegin..FreqEnd]
|
||||
if (X.Entries[i].LastFreq < X.Entries[i].FreqBegin) or
|
||||
(X.Entries[i].LastFreq > X.Entries[i].FreqEnd) then
|
||||
X.Entries[i].LastFreq := (X.Entries[i].FreqBegin + X.Entries[i].FreqEnd) / 2.0;
|
||||
if (X.Entries[i].LastFreqB < X.Entries[i].FreqBegin) or
|
||||
(X.Entries[i].LastFreqB > X.Entries[i].FreqEnd) then
|
||||
X.Entries[i].LastFreqB := (X.Entries[i].FreqBegin + X.Entries[i].FreqEnd) / 2.0;
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -1310,6 +1318,7 @@ begin
|
||||
JW(EObj, 'dis_pa', X.Entries[i].DisablePA);
|
||||
JW(EObj, 'rx_ant', Integer(X.Entries[i].RXAntenna));
|
||||
JW(EObj, 'last_freq', X.Entries[i].LastFreq);
|
||||
JW(EObj, 'last_freq_b', X.Entries[i].LastFreqB);
|
||||
JW(EObj, 'last_mode', X.Entries[i].LastMode);
|
||||
JW(EObj, 'last_filt', X.Entries[i].LastFilterIdx);
|
||||
JW(EObj, 'last_fmsq_on', X.Entries[i].LastFMSQOn);
|
||||
|
||||
Reference in New Issue
Block a user