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:
2026-05-10 17:02:43 +03:00
co-authored by Claude Sonnet 4.6
parent 7a0b778114
commit 604fd836ba
2 changed files with 15 additions and 1 deletions
+10 -1
View File
@@ -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