From dede74d0a5ad9aa794aebf2298d173159b2a612f Mon Sep 17 00:00:00 2001 From: Uladzimir Karpenka Date: Thu, 21 May 2026 21:37:25 +0300 Subject: [PATCH] Add web status bar fields --- MainForm.pas | 68 ++++++++++++++++++++++++++++++++++++++++++++++++- WebPageHtml.pas | 29 +++++++++++++++++---- WebServer.pas | 68 +++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 151 insertions(+), 14 deletions(-) diff --git a/MainForm.pas b/MainForm.pas index c507119..d60cf2a 100644 --- a/MainForm.pas +++ b/MainForm.pas @@ -2943,6 +2943,8 @@ procedure TMainForm.SpectrumTimerTick(Sender: TObject); var NowTick: QWord; ElapsedTick: QWord; + WebStatusText, WebBoardText, WebIPText, WebSupplyText: string; + WebPLLText, WebRXText, WebTXText, WebSeqText: string; begin // Синхронизируем размеры если размер панели изменился (после ресайза). // Важно: проверяем только видимые панели — когда спектр скрыт, @@ -3072,6 +3074,67 @@ begin // Пушим текущее состояние в веб-клиенты (если есть) if Assigned(FWebServer) then + begin + if FNetwork.Connected then + begin + if FRunning then + WebStatusText := 'Running' + else + WebStatusText := 'Connected'; + WebBoardText := 'Board: ' + BoardTypeName(FNetwork.Device.BoardType); + WebIPText := 'IP: ' + FNetwork.Device.IPAddress; + end + else + begin + WebStatusText := 'Disconnected'; + WebBoardText := 'Board --'; + WebIPText := 'IP --'; + end; + + if not FRunning then + begin + WebSupplyText := 'Supply --'; + WebPLLText := 'PLL --'; + end + else + begin + if FLastPLLLock then + WebPLLText := 'PLL OK' + else + WebPLLText := 'PLL?'; + + if not BoardSupportsSupplyVoltage(FNetwork.Device.BoardType) then + WebSupplyText := 'Supply n/a' + else if FLastSupplyV >= 0 then + begin + if FLastSupplyA >= 0 then + WebSupplyText := Format('Supply %.1fV %.1fA', [FLastSupplyV, FLastSupplyA]) + else + WebSupplyText := Format('Supply %.1fV', [FLastSupplyV]); + end + else + WebSupplyText := 'Supply --'; + end; + + if FRunning then + WebRXText := 'RX running' + else + WebRXText := 'RX idle'; + + if FTuning then + WebTXText := 'TX tune' + else if FTransmitting then + WebTXText := 'TX active' + else + WebTXText := 'TX idle'; + + if FSeqErrorCount > 0 then + WebSeqText := Format('SEQ ERR DDC%d', [FLastSeqErrorDDC]) + else if FRunning then + WebSeqText := 'SEQ OK' + else + WebSeqText := 'SEQ --'; + FWebServer.PushSpectrum( FSpectrumBuf, 1024, FWaterfallBuf, @@ -3087,7 +3150,10 @@ begin FVfoB, FActiveVfo, FTransmitting, TrkDrive.Position, FAtten, FTuning, FDisplayDuplex, - FLastFwdW, FLastSWR, FPAMaxPower); + FLastFwdW, FLastSWR, FPAMaxPower, + WebStatusText, WebBoardText, WebIPText, WebSupplyText, + WebPLLText, WebRXText, WebTXText, WebSeqText); + end; end; // =========================================================================== diff --git a/WebPageHtml.pas b/WebPageHtml.pas index 4de87ec..aedd028 100644 --- a/WebPageHtml.pas +++ b/WebPageHtml.pas @@ -95,8 +95,11 @@ begin '.ruler-area canvas{position:absolute;top:0;left:0;width:100%;height:100%}' + '.wf-area{flex:0 0 405px;position:relative;background:#000;border:1px solid #252525;border-radius:3px;overflow:hidden}' + '.wf-area canvas{position:absolute;top:0;left:0;width:100%;height:100%}' + - '.sbar{flex:0 0 16px;display:flex;align-items:center;padding:0 6px;gap:10px;background:#0e0e0e;border-top:1px solid #222;font-size:10px;color:#555}' + - '#latEl{margin-left:auto}' + + '.sbar{flex:0 0 24px;display:grid;grid-template-columns:minmax(120px,170px) minmax(190px,280px) minmax(120px,160px) minmax(135px,170px) minmax(70px,90px) minmax(120px,190px) minmax(120px,180px) minmax(90px,1fr) minmax(82px,96px) minmax(92px,112px);align-items:stretch;background:#0e0e0e;border-top:1px solid #222;font:10px Courier New,monospace;color:#ccc;overflow-x:auto;overflow-y:hidden}' + + '.sb-cell{min-width:0;display:flex;align-items:center;padding:0 8px;border-left:1px solid #222;background:#181818;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}' + + '.sb-cell:first-child{border-left:0}' + + '.sb-dim{color:#777}.sb-seq{color:#ffaa00}.sb-status{color:#90c090}.sb-time{justify-content:center;color:#bbb}.sb-lat{display:none}' + + '@media screen and (max-width:640px){.sbar{grid-template-columns:minmax(72px,1fr) minmax(104px,1.25fr) minmax(74px,1fr) minmax(78px,1fr);overflow:hidden}.sbar #sbBoard,.sbar #sbIP,.sbar #sbPLL,.sbar #sbRX,.sbar #sbTX,.sbar #sbLocal{display:none}.sb-cell{padding:0 5px;font-size:9px}}' + '@media screen and (max-width:1300px) and (min-width:641px){' + '.tbar{gap:3px;padding-left:4px;padding-right:4px;}' + 'button{padding:0 6px;font-size:10px;}' + @@ -227,7 +230,19 @@ begin '
' + '
' + '
' + - '
connecting...
' + + '
' + + 'connecting...' + + 'Board --' + + 'IP --' + + 'Supply --' + + 'PLL --' + + 'RX idle' + + 'TX idle' + + 'SEQ --' + + 'UTC --:--:--' + + 'Local --:--:--' + + '' + + '
' + '' + '