mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 19:45:09 +00:00
Phase 3 (batch 32): extract StartWithDevice from BtnStartStopClick
Factor the "start with an already-chosen device" sequence (preload sample rate + async WDSP open + DoConnectDevice) out of BtnStartStopClick into StartWithDevice(Dev). BtnStartStopClick's START branch now resolves the device (dialog/autostart) and calls StartWithDevice; the web overlay will reuse the same method to connect without the modal dialog. Behavior-preserving. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
7f7f429515
commit
9dec47a6ca
+17
-6
@@ -330,6 +330,9 @@ type
|
||||
Count: Integer);
|
||||
procedure OnWDSPOpenDone(Success: Boolean);
|
||||
procedure DoConnectDevice(const Dev: THPSDRDevice);
|
||||
// Старт с уже выбранным устройством (preload rate + WDSP open + connect).
|
||||
// Переиспользуется десктоп-диалогом и web-оверлеем — без модального диалога.
|
||||
procedure StartWithDevice(const Dev: THPSDRDevice);
|
||||
|
||||
// DSP/Audio callbacks (вызываются из рабочих потоков)
|
||||
procedure OnAudioReady(const Left, Right: array of Single; Count: Integer);
|
||||
@@ -3561,12 +3564,7 @@ end;
|
||||
|
||||
procedure TMainForm.BtnStartStopClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
Dev: THPSDRDevice;
|
||||
PreG: TGlobalSettings;
|
||||
PreBands: array[0..CFG_BAND_COUNT-1] of TBandSettings;
|
||||
PreloadRate: Integer;
|
||||
FoundByIP: Boolean;
|
||||
AutoIP: string;
|
||||
begin
|
||||
if FController.FNetwork.Connected then
|
||||
@@ -3637,11 +3635,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// Создаём запись устройства из IP + BoardType из диалога если есть
|
||||
// Создаём запись устройства из IP + BoardType (из диалога/autostart) и стартуем.
|
||||
FillChar(Dev, SizeOf(Dev), 0);
|
||||
Dev.IPAddress := FPendingIP;
|
||||
Dev.BoardType := FPendingBoardType;
|
||||
StartWithDevice(Dev);
|
||||
end;
|
||||
|
||||
procedure TMainForm.StartWithDevice(const Dev: THPSDRDevice);
|
||||
// Запуск с уже выбранным устройством — общий путь для десктоп-диалога и
|
||||
// web-оверлея (без модального диалога). Подбор sample rate до WDSP, открытие
|
||||
// WDSP (async) и подключение.
|
||||
var
|
||||
PreloadRate: Integer;
|
||||
FoundByIP: Boolean;
|
||||
i: Integer;
|
||||
PreG: TGlobalSettings;
|
||||
PreBands: array[0..CFG_BAND_COUNT-1] of TBandSettings;
|
||||
begin
|
||||
// Подбираем sample rate до открытия WDSP, чтобы не делать двойной Open:
|
||||
// 1) Open на 192k, 2) сразу ChangeSampleRate+Open ещё раз.
|
||||
// Если устройство уже было обнаружено (есть MAC) и есть сохранённый профиль,
|
||||
|
||||
Reference in New Issue
Block a user