mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
Phase 3 (WA3): move outgoing web state-mirror into the web adapter
The per-tick PushSpectrum mirror (status strings + ~40 state values + spectrum/ waterfall buffers) moves out of SpectrumTimerTick into TWebAdapter.PushState, which reads FController for everything and takes the pixel buffers as params. MainForm's timer now just calls FWebAdapter.PushState(FSpectrumBuf, FWaterfallBuf). Server lifecycle/ownership stays in MainForm for now — it's still driven by the remaining host-coupled handlers (PushXvtrToWeb, device CRUD); ownership transfer completes when those move. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e5a13096dc
commit
e1ecf947b8
+84
-1
@@ -19,7 +19,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
RadioController, WebServer, WDSPEngine;
|
||||
RadioController, WebServer, WDSPEngine, HPSDRNetwork, HPSDRProtocol, BoardUtils;
|
||||
|
||||
type
|
||||
// UI/оркестрационные операции, которые адаптер дёргает у хозяина (пока не
|
||||
@@ -91,6 +91,11 @@ type
|
||||
// TX-mic от web-клиента → WDSP. Вызывается из WS-потока; без маршалинга —
|
||||
// подача в движок thread-safe (как OnMicPacket/OnDDCIQ контроллера).
|
||||
procedure OnMic(Samples: PSingle; Count: Integer);
|
||||
|
||||
// Исходящее зеркало: периодический снимок состояния + спектр/водопад в web.
|
||||
// Зовётся хозяином из GUI-таймера (буферы пикселей — у хозяина, остальное из
|
||||
// FController). Сервер сам гейтит по FRunning и шлёт активным клиентам.
|
||||
procedure PushState(const ASpec, AWf: array of Single);
|
||||
end;
|
||||
|
||||
implementation
|
||||
@@ -290,4 +295,82 @@ begin
|
||||
FController.FDSPEngine.PushTXMicSamplesD(Buf, n);
|
||||
end;
|
||||
|
||||
// ── Исходящее зеркало состояния ──────────────────────────────────────────────
|
||||
|
||||
procedure TWebAdapter.PushState(const ASpec, AWf: array of Single);
|
||||
var
|
||||
StatusText, BoardText, IPText, SupplyText: string;
|
||||
PLLText, RXText, TXText, SeqText: string;
|
||||
begin
|
||||
if FController.FNetwork.Connected then
|
||||
begin
|
||||
if FController.FRunning then StatusText := 'Running'
|
||||
else StatusText := 'Connected';
|
||||
BoardText := 'Board: ' + BoardTypeName(FController.FNetwork.Device.BoardType);
|
||||
IPText := 'IP: ' + FController.FNetwork.Device.IPAddress;
|
||||
end
|
||||
else
|
||||
begin
|
||||
StatusText := 'Disconnected';
|
||||
BoardText := 'Board --';
|
||||
IPText := 'IP --';
|
||||
end;
|
||||
|
||||
if not FController.FRunning then
|
||||
begin
|
||||
SupplyText := 'Supply --';
|
||||
PLLText := 'PLL --';
|
||||
end
|
||||
else
|
||||
begin
|
||||
if FController.FLastPLLLock then PLLText := 'PLL OK'
|
||||
else PLLText := 'PLL?';
|
||||
|
||||
if not BoardSupportsSupplyVoltage(FController.FNetwork.Device.BoardType) then
|
||||
SupplyText := 'Supply n/a'
|
||||
else if FController.FLastSupplyV >= 0 then
|
||||
begin
|
||||
if FController.FLastSupplyA >= 0 then
|
||||
SupplyText := Format('Supply %.1fV %.1fA', [FController.FLastSupplyV, FController.FLastSupplyA])
|
||||
else
|
||||
SupplyText := Format('Supply %.1fV', [FController.FLastSupplyV]);
|
||||
end
|
||||
else
|
||||
SupplyText := 'Supply --';
|
||||
end;
|
||||
|
||||
if FController.FRunning then RXText := 'RX running'
|
||||
else RXText := 'RX idle';
|
||||
|
||||
if FController.FTuning then TXText := 'TX tune'
|
||||
else if FController.FTransmitting then TXText := 'TX active'
|
||||
else TXText := 'TX idle';
|
||||
|
||||
if FController.FSeqErrorCount > 0 then
|
||||
SeqText := Format('SEQ ERR DDC%d', [FController.FLastSeqErrorDDC])
|
||||
else if FController.FRunning then
|
||||
SeqText := 'SEQ OK'
|
||||
else
|
||||
SeqText := 'SEQ --';
|
||||
|
||||
FServer.PushSpectrum(
|
||||
ASpec, 1024,
|
||||
AWf,
|
||||
FController.FLastSMeter,
|
||||
FController.FVfoA, FController.FMode, FController.FFilterBW, FController.FAGCMode, FController.FAGCTop,
|
||||
FController.FSpanHz, FController.FVolume,
|
||||
FController.FWfAGCEnabled, FController.FWfNFEnabled,
|
||||
FController.FCurrentBand,
|
||||
FController.FRunning and FController.FNetwork.Connected,
|
||||
FController.FRunning, FController.FMuted, FController.FCTun,
|
||||
FController.FNRMode, FController.FNBMode, FController.FSNB, FController.FANF,
|
||||
FController.FCenterFreq, FController.FFilter,
|
||||
FController.FVfoB, FController.FActiveVfo,
|
||||
FController.FTransmitting, FController.FDrivePercent,
|
||||
FController.FAtten, FController.FTuning, FController.FDisplayDuplex,
|
||||
FController.FLastFwdW, FController.FLastSWR, FController.FPAMaxPower,
|
||||
StatusText, BoardText, IPText, SupplyText,
|
||||
PLLText, RXText, TXText, SeqText);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user