add alert overlay

This commit is contained in:
2026-05-21 15:38:56 +03:00
parent 5800e9ec35
commit b5103bf474
2 changed files with 126 additions and 1 deletions
+17 -1
View File
@@ -18,7 +18,8 @@ interface
uses
Classes, SysUtils, Graphics, ExtCtrls, Controls, Math,
IntfGraphics, FPImage, LCLIntf, LCLType, GraphType, AppTheme;
IntfGraphics, FPImage, LCLIntf, LCLType, GraphType, AppTheme,
AlertOverlay;
const
SV_CLR_BG = TColor($00101010);
@@ -98,6 +99,9 @@ type
// красным сверху). Без DUP при TX оба флага True. Без TX оба False.
FTXOverlay: Boolean;
// ── ADC overload overlay ─────────────────────────────────────────────────
FADCOverloadVisible: Boolean;
// ── Marker ────────────────────────────────────────────────────────────────
FMarkerActive: Boolean;
FMarkerX: Integer;
@@ -139,6 +143,7 @@ type
// Используется для прозрачной заливки полосы фильтра разными цветами
// (RX-зелёный / TX-красный) поверх градиента сетки.
procedure BlendBand(X1, X2, H: Integer; R, G, B, Alpha: Byte);
procedure DrawADCOverloadOverlay(C: TCanvas; W, H: Integer);
// Считает X1/X2 для полосы фильтра вокруг указанной частоты VFO, c учётом
// текущего режима (LSB/USB/DSB и пр.) и FFilterBW.
procedure CalcFilterBandX(VfoFreq: Double; W: Integer;
@@ -181,6 +186,9 @@ type
property TXVfoIndex: Integer read FTXVfoIndex write FTXVfoIndex;
property TXOverlay: Boolean read FTXOverlay write FTXOverlay;
// Test overlay for ADC overload; later this will be driven from HP Status.
property ADCOverloadVisible: Boolean read FADCOverloadVisible write FADCOverloadVisible;
// ── Маркер ────────────────────────────────────────────────────────────────
property MarkerActive: Boolean read FMarkerActive write FMarkerActive;
property MarkerX: Integer read FMarkerX write FMarkerX;
@@ -433,6 +441,7 @@ begin
FTXSpanHz := 192000.0;
FTXVfoIndex := 0;
FTXOverlay := False;
FADCOverloadVisible := True; // test indicator; later driven by HP Status.
FSpectrumBufCount := 1024;
FWaterfallBufCount := 1024;
FWfFrameInterval := 2;
@@ -540,6 +549,12 @@ begin
end;
end;
procedure TSpectrumView.DrawADCOverloadOverlay(C: TCanvas; W, H: Integer);
begin
if not FADCOverloadVisible then Exit;
DrawAlertOverlay(FSpectrumBitmap, C, W, H, 'ADC OVERLOAD', 'Input clipping detected');
end;
procedure TSpectrumView.CalcFilterBandX(VfoFreq: Double; W: Integer;
out X1, X2, VfoX: Integer);
// Возвращает X-координаты левого/правого края полосы фильтра вокруг VfoFreq
@@ -962,6 +977,7 @@ begin
end;
if FMarkerActive then DrawMarkerLine(C, W, H);
DrawADCOverloadOverlay(C, W, H);
end;
// ────────────────────────────────────────────────────────────────────────────