mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 19:45:09 +00:00
fix TUN tone frequency sign for LSB/CWL modes
gen1 (TXA PostGen) sits after all modulators and the bandpass filter, so a positive frequency always produces a tone above the carrier. For LSB and CWL the tone must appear below the carrier — negate the frequency for those modes. Also re-apply the tone when mode is switched while TUN is active. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -1595,12 +1595,21 @@ begin
|
||||
end;
|
||||
|
||||
procedure TWDSPEngine.SetTXTone(Enabled: Boolean; FreqHz, Mag: Double);
|
||||
var
|
||||
SignedFreq: Double;
|
||||
begin
|
||||
if not FInitialized then Exit;
|
||||
if Enabled then
|
||||
begin
|
||||
// gen1 (PostGen) стоит после всех модуляторов и бандпасса.
|
||||
// Положительная частота даёт тон ВЫШЕ несущей (USB-сторона).
|
||||
// Для LSB и CWL нужен тон НИЖЕ несущей — инвертируем знак.
|
||||
if (FMode = MODE_LSB) or (FMode = MODE_CWL) then
|
||||
SignedFreq := -Abs(FreqHz)
|
||||
else
|
||||
SignedFreq := Abs(FreqHz);
|
||||
SetTXAPostGenMode(TXA_CHAN, 0); // 0 = tone
|
||||
SetTXAPostGenToneFreq(TXA_CHAN, FreqHz);
|
||||
SetTXAPostGenToneFreq(TXA_CHAN, SignedFreq);
|
||||
SetTXAPostGenToneMag(TXA_CHAN, Max(0.0, Min(1.0, Mag)));
|
||||
SetTXAPostGenRun(TXA_CHAN, 1);
|
||||
end else
|
||||
|
||||
Reference in New Issue
Block a user