web: fix A=B/SWAP VFO ops, wire attenuator, TUN button, FNP filter overlay

- Add freq_a command: sets VFO A regardless of active VFO; fixes A=B and
  SWAP when VFO B is active (prev. sent freq_b which overwrote wrong VFO)
- Add pend("freq") to B=A / A=B / SWAP to guard local display during round-trip
- RX step attenuator: HPSDRNetwork.SetStepAtten → bytes 1442/1443 in HP packet;
  WebServer attn command; MainForm FAtten + SyncWebAttn; attSel.onchange in JS
- TUN mode: set_tun WebSocket command wired to ApplyTUN(); toneBtn toggles
  with on/off highlight and pending protection; tuning field in state JSON
- FNP button opens semi-transparent filter overlay (10 buttons, 5×2 grid)
  with mode-appropriate widths (SSB/CW/AM/FM); active filter highlighted;
  cur.filter_bw updated immediately on click so passband redraws within 50ms

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 15:04:23 +03:00
co-authored by Claude Sonnet 4.6
parent 9f208006aa
commit 154b6eccba
4 changed files with 165 additions and 20 deletions
+11 -2
View File
@@ -141,6 +141,7 @@ type
FIsTransmitting: Boolean;
FPAEnabled: Boolean;
FAlexEnabled: Boolean;
FStepAtten: Byte; // ADC0 step attenuator 0-31 dB
FSendLock: TCriticalSection; // защита concurrent UDP sends
@@ -190,6 +191,7 @@ type
DriveLevel: Byte = 100);
procedure UpdateState(RXFreqHz, TXFreqHz: Double; DriveLevel: Byte;
Transmitting, PAEnabled, AlexEnabled: Boolean);
procedure SetStepAtten(dB: Byte);
procedure SendFullHP;
procedure SendDDCAudio(const LeftRight: array of SmallInt);
procedure SendDUCIQ(const IData, QData: array of Integer);
@@ -1208,6 +1210,13 @@ begin
FAlexEnabled := AlexEnabled;
end;
procedure THPSDRNetwork.SetStepAtten(dB: Byte);
begin
if dB > 31 then dB := 31;
FStepAtten := dB;
if FConnected then SendFullHP;
end;
procedure THPSDRNetwork.SendFullHP;
var
Buf: array[0..1443] of Byte;
@@ -1274,8 +1283,8 @@ begin
// Step attenuators ADC0/ADC1 (bytes 1443/1442)
// 0 dB = 0, max 31 dB
Buf[1443] := 0; // ADC0 attenuation
Buf[1442] := 0; // ADC1 attenuation
Buf[1443] := FStepAtten; // ADC0 attenuation
Buf[1442] := FStepAtten; // ADC1 attenuation
DoSendTo(FSocket, Buf, SizeOf(Buf), FDevice.IPAddress, FPortHPFromPC);
end;