From 960cadd4b0b7844c960907cf491fb65c727ea53e Mon Sep 17 00:00:00 2001 From: Uladzimir Karpenka Date: Thu, 21 May 2026 15:42:59 +0300 Subject: [PATCH] add alert ADC overload --- MainForm.pas | 30 ++++++++++++++++++++++++------ SpectrumView.pas | 2 +- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/MainForm.pas b/MainForm.pas index b16bea7..21b383b 100644 --- a/MainForm.pas +++ b/MainForm.pas @@ -151,8 +151,10 @@ type FSupplyA: Double; FPLLLock: Boolean; FHWPTT: Boolean; + FADCOverload: Byte; public - constructor Create(AForm: TObject; FW, SW, SV, SA: Double; PLL, HWPTT: Boolean); + constructor Create(AForm: TObject; FW, SW, SV, SA: Double; PLL, HWPTT: Boolean; + ADCOverload: Byte); procedure Execute; end; @@ -473,7 +475,8 @@ type // Public UI update (called from sync objects) procedure DoAddDevice(const Dev: THPSDRDevice; const Entry: string); - procedure DoUpdateStatus(FwdW, SWRV, SupplyV, SupplyA: Double; PLLLock, HWPTT: Boolean); + procedure DoUpdateStatus(FwdW, SWRV, SupplyV, SupplyA: Double; PLLLock, HWPTT: Boolean; + ADCOverload: Byte); procedure UpdateTXMeters; procedure DoUpdateDDCSeq(DDCIdx: Integer; Seq: LongWord); procedure DoUpdateDDCSeqOrNoDevice(DDCIdx: Integer; Seq: LongWord); @@ -883,7 +886,7 @@ begin end; constructor TStatusUISync.Create(AForm: TObject; - FW, SW, SV, SA: Double; PLL, HWPTT: Boolean); + FW, SW, SV, SA: Double; PLL, HWPTT: Boolean; ADCOverload: Byte); begin inherited Create; FForm := AForm; @@ -893,11 +896,13 @@ begin FSupplyA := SA; FPLLLock := PLL; FHWPTT := HWPTT; + FADCOverload := ADCOverload; end; procedure TStatusUISync.Execute; begin - TMainForm(FForm).DoUpdateStatus(FFwdW, FSWRV, FSupplyV, FSupplyA, FPLLLock, FHWPTT); + TMainForm(FForm).DoUpdateStatus(FFwdW, FSWRV, FSupplyV, FSupplyA, FPLLLock, FHWPTT, + FADCOverload); end; constructor TDDCSeqSync.Create(AForm: TObject; Idx: Integer; Seq: LongWord); @@ -2617,6 +2622,10 @@ begin SetStatusText(5, 'TX idle'); SetStatusText(6, 'SEQ --'); SetStatusText(7, 'PLL --'); + if FSpecView <> nil then + FSpecView.ADCOverloadVisible := False; + if PbSpectrum <> nil then + PbSpectrum.Invalidate; FillChar(FDDCSeqValid, SizeOf(FDDCSeqValid), 0); FSeqErrorCount := 0; FLastSeqErrorDDC := -1; @@ -3250,7 +3259,8 @@ begin if not IsTx then FwdW := 0; Sync := TStatusUISync.Create(Self, FwdW, SWRV, SupplyV, SupplyA, (Status.StatusBits and HPS_PLL_LOCKED) <> 0, - (Status.StatusBits and HPS_PTT) <> 0); + (Status.StatusBits and HPS_PTT) <> 0, + Status.ADCOverload); try M := Sync.Execute; TThread.Synchronize(nil, M); @@ -3259,7 +3269,8 @@ begin end; end; -procedure TMainForm.DoUpdateStatus(FwdW, SWRV, SupplyV, SupplyA: Double; PLLLock, HWPTT: Boolean); +procedure TMainForm.DoUpdateStatus(FwdW, SWRV, SupplyV, SupplyA: Double; PLLLock, HWPTT: Boolean; + ADCOverload: Byte); const // Thetis/piHPSDR PEP-style баллистика для FwdW и SWR: атака мгновенная // (peak-hold), спад медленный — стрелка «висит» на пике и плавно опускается. @@ -3305,6 +3316,13 @@ begin FLastSupplyA := -1.0; FLastPLLLock := PLLLock; + if (FSpecView <> nil) and (FSpecView.ADCOverloadVisible <> (ADCOverload <> 0)) then + begin + FSpecView.ADCOverloadVisible := ADCOverload <> 0; + if PbSpectrum <> nil then + PbSpectrum.Invalidate; + end; + // Hardware PTT (foot switch / mic PTT) — обнаружение фронта (нужно делать // на rate HP Status, а не таймера, чтобы не пропустить короткое нажатие). if HWPTT <> FHWPTTActive then diff --git a/SpectrumView.pas b/SpectrumView.pas index 689bd75..01b3ebe 100644 --- a/SpectrumView.pas +++ b/SpectrumView.pas @@ -441,7 +441,7 @@ begin FTXSpanHz := 192000.0; FTXVfoIndex := 0; FTXOverlay := False; - FADCOverloadVisible := True; // test indicator; later driven by HP Status. + FADCOverloadVisible := False; FSpectrumBufCount := 1024; FWaterfallBufCount := 1024; FWfFrameInterval := 2;