feat: Pluto/AD936x SDR backend (discovery, RX, VHF band plan)

Add ADALM-Pluto / AD9361 support as a second hardware backend alongside
openHPSDR, sharing the WDSP DSP pipeline and the existing controller API
(UI stays decoupled from logic).

- RadioBackend.pas: abstract TRadioBackend + TBackendCaps + TRadioDevice
  (Kind/URI/Serial). THPSDRNetwork now derives from it (state via virtual
  getters); TRadioController.FNetwork is the base type.
- IIOBindings.pas: dynamic libiio loader (runs without libiio present).
- PlutoBackend.pas: scan/probe-by-URI, connect, LO/rate/bandwidth/gain
  control, RX streaming thread (int16->24bit BE -> OnDDCIQ), Q conjugated
  to match WDSP IQ convention. Verified on LibreSDR (AD9361) over network.
- Unified discovery: TDiscoverThread scans both backends; network Plutos
  found via direct ProbeURI (no mDNS needed). ConnectDevice dispatches by
  Dev.Kind (EnsureBackend swaps backend, preserving callbacks).
- DeviceStore/DeviceForm: persist Kind/URI/Serial; save Pluto via
  AddSavedPluto so saved/autostart devices reconnect across restarts.
- VHF/UHF band plan (BoardUtils, kind-aware): 6m..ADS-B for Pluto; fixes
  HF clamps (band detect, mouse-wheel 60 MHz cap, freq-display max).
- SampleRateOverlay: configurable presets (Pluto 576k..5760k, >520 ksps),
  auto-width to fit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 18:55:20 +03:00
co-authored by Claude Opus 4.8
parent 0d82d1d8e6
commit a988849d3e
13 changed files with 1940 additions and 164 deletions
+58 -15
View File
@@ -7,12 +7,46 @@ unit BoardUtils;
interface
function BoardTypeName(BoardType: Integer): string;
function FreqToBandIdx(Hz: Double): Integer;
// Индекс диапазона по частоте. Pluto=True → VHF/UHF план, иначе HF (openHPSDR).
function FreqToBandIdx(Hz: Double; Pluto: Boolean = False): Integer;
// Короткое имя диапазона для кнопки (зависит от плана).
function BandName(Idx: Integer; Pluto: Boolean = False): string;
// Частота по умолчанию при входе в диапазон (если нет сохранённой/в диапазоне).
function BandDefaultFreq(Idx: Integer; Pluto: Boolean = False): Double;
implementation
uses SysUtils;
const
BAND_COUNT = 11;
// ---- HF/6m план (openHPSDR) ----
HF_NAMES: array[0..BAND_COUNT-1] of string = (
'160m','80m','60m','40m','30m','20m','17m','15m','12m','10m','6m');
HF_LO: array[0..BAND_COUNT-1] of Double = (
1800000, 3500000, 5330000, 7000000, 10100000,
14000000, 18068000, 21000000, 24890000, 28000000, 50000000);
HF_HI: array[0..BAND_COUNT-1] of Double = (
2000000, 4000000, 5410000, 7300000, 10150000,
14350000, 18168000, 21450000, 24990000, 29700000, 54000000);
HF_DEF: array[0..BAND_COUNT-1] of Double = (
1840000, 3700000, 5357000, 7100000, 10120000,
14200000, 18130000, 21300000, 24940000, 28400000, 50150000);
// ---- VHF/UHF/SHF план (Pluto / AD936x), 11 слотов ----
VU_NAMES: array[0..BAND_COUNT-1] of string = (
'6m','4m','2m','1.25m','70cm','23cm','13cm','9cm','FM','Air','ADS-B');
VU_LO: array[0..BAND_COUNT-1] of Double = (
50000000, 70000000, 144000000, 222000000, 430000000,
1240000000, 2300000000, 3300000000, 88000000, 118000000, 1087000000);
VU_HI: array[0..BAND_COUNT-1] of Double = (
54000000, 70500000, 148000000, 225000000, 440000000,
1300000000, 2450000000, 3500000000, 108000000, 137000000, 1093000000);
VU_DEF: array[0..BAND_COUNT-1] of Double = (
50150000, 70200000, 145000000, 223500000, 433500000,
1296200000, 2320000000, 3400100000, 100000000, 124000000, 1090000000);
function BoardTypeName(BoardType: Integer): string;
begin
case BoardType of
@@ -27,24 +61,33 @@ begin
end;
end;
function FreqToBandIdx(Hz: Double): Integer;
const
BAND_LO: array[0..10] of Double = (
1800000, 3500000, 5330000, 7000000, 10100000,
14000000, 18068000, 21000000, 24890000, 28000000, 50000000);
BAND_HI: array[0..10] of Double = (
2000000, 4000000, 5410000, 7300000, 10150000,
14350000, 18168000, 21450000, 24990000, 29700000, 54000000);
function FreqToBandIdx(Hz: Double; Pluto: Boolean): Integer;
var
i: Integer;
begin
Result := -1;
for i := 0 to 10 do
if (Hz >= BAND_LO[i]) and (Hz <= BAND_HI[i]) then
begin
Result := i;
Exit;
end;
if Pluto then
begin
for i := 0 to BAND_COUNT - 1 do
if (Hz >= VU_LO[i]) and (Hz <= VU_HI[i]) then Exit(i);
end
else
begin
for i := 0 to BAND_COUNT - 1 do
if (Hz >= HF_LO[i]) and (Hz <= HF_HI[i]) then Exit(i);
end;
end;
function BandName(Idx: Integer; Pluto: Boolean): string;
begin
if (Idx < 0) or (Idx >= BAND_COUNT) then Exit('');
if Pluto then Result := VU_NAMES[Idx] else Result := HF_NAMES[Idx];
end;
function BandDefaultFreq(Idx: Integer; Pluto: Boolean): Double;
begin
if (Idx < 0) or (Idx >= BAND_COUNT) then Exit(0);
if Pluto then Result := VU_DEF[Idx] else Result := HF_DEF[Idx];
end;
end.