mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 18:43:51 +00:00
fix(ui): show DMR status without replacing PLL
This commit is contained in:
+14
-5
@@ -418,6 +418,7 @@ type
|
||||
procedure UpdateTXMeters;
|
||||
procedure UpdateTXControlAvailability;
|
||||
procedure UpdateStatusField7; // поле 7: PLL (HPSDR) или beacon (Pluto)
|
||||
procedure UpdateDMRStatus; // поле 8: только при активном DMR
|
||||
procedure UpdateStatusField3; // поле 3: Supply (HPSDR) или Temp/RSSI (Pluto)
|
||||
function BeaconStatusText: string; // компактный статус QO-100 beacon lock
|
||||
function DMRStatusText: string; // sync/type/polarity DMR front-end
|
||||
@@ -1463,6 +1464,7 @@ begin
|
||||
for i := 0 to FILT_COUNT - 1 do StyleButton(BtnFilter[i], i = FController.FFilter);
|
||||
SyncSpecViewFreq; // иначе полоса фильтра рисуется под старый режим
|
||||
UpdateTXControlAvailability;
|
||||
UpdateDMRStatus;
|
||||
end;
|
||||
rfFilter:
|
||||
begin
|
||||
@@ -2984,6 +2986,7 @@ begin
|
||||
SetStatusText(5, 'TX idle');
|
||||
SetStatusText(6, 'SEQ --');
|
||||
SetStatusText(7, 'PLL --');
|
||||
UpdateDMRStatus;
|
||||
if FSpecView <> nil then
|
||||
FSpecView.ADCOverloadVisible := False;
|
||||
if PbSpectrum <> nil then
|
||||
@@ -3518,6 +3521,7 @@ procedure TMainForm.UpdateTXMeters;
|
||||
// в TRadioController.ApplyHPStatus.
|
||||
begin
|
||||
UpdateStatusField7; // PLL (openHPSDR) или статус beacon lock (Pluto)
|
||||
UpdateDMRStatus; // отдельное динамическое поле DMR
|
||||
UpdateStatusField3; // Supply (openHPSDR) или Temp/RSSI (Pluto)
|
||||
end;
|
||||
|
||||
@@ -3623,11 +3627,6 @@ procedure TMainForm.UpdateStatusField7;
|
||||
// Поле 7 статус-бара. openHPSDR — PLL-lock (как прежде). Pluto в трансвертере —
|
||||
// статус QO-100 beacon lock (у Pluto нет PLL-телеметрии); Pluto без XVTR — пусто.
|
||||
begin
|
||||
if FController.FMode = MODE_DMR then
|
||||
begin
|
||||
SetStatusText(7, DMRStatusText);
|
||||
Exit;
|
||||
end;
|
||||
if FController.IsPluto then
|
||||
begin
|
||||
if FController.FCurrentXvtr >= 0 then SetStatusText(7, BeaconStatusText)
|
||||
@@ -3639,6 +3638,16 @@ begin
|
||||
else SetStatusText(7, 'PLL?');
|
||||
end;
|
||||
|
||||
procedure TMainForm.UpdateDMRStatus;
|
||||
begin
|
||||
if StatusPanel = nil then Exit;
|
||||
StatusPanel.SetStatusVisible(8, FController.FMode = MODE_DMR);
|
||||
if FController.FMode = MODE_DMR then
|
||||
SetStatusText(8, DMRStatusText)
|
||||
else
|
||||
SetStatusText(8, '');
|
||||
end;
|
||||
|
||||
procedure TMainForm.OnWidebandCB(ADCIndex: Integer;
|
||||
const Samples: array of SmallInt; Count: Integer);
|
||||
begin
|
||||
|
||||
+35
-11
@@ -13,8 +13,8 @@ uses
|
||||
type
|
||||
TMainStatusBar = class(TPanel)
|
||||
private
|
||||
FCells: array[0..7] of TPanel;
|
||||
FLabels: array[0..7] of TLabel;
|
||||
FCells: array[0..8] of TPanel;
|
||||
FLabels: array[0..8] of TLabel;
|
||||
procedure CreateStatusCell(Index: Integer; const Cap: string);
|
||||
procedure LayoutCells;
|
||||
protected
|
||||
@@ -22,6 +22,7 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure SetStatusText(Index: Integer; const Text: string);
|
||||
procedure SetStatusVisible(Index: Integer; Visible: Boolean);
|
||||
procedure ApplyTheme(const T: TAppTheme);
|
||||
end;
|
||||
|
||||
@@ -32,11 +33,12 @@ const
|
||||
GAP = 1;
|
||||
PAD_X = 8;
|
||||
SEQ_MIN_W = 90;
|
||||
STATUS_ORDER: array[0..7] of Integer = (2, 0, 1, 3, 7, 4, 5, 6);
|
||||
STATUS_ORDER: array[0..8] of Integer = (2, 0, 1, 3, 7, 8, 4, 5, 6);
|
||||
// поле 7: PLL (openHPSDR) ИЛИ статус QO-100 beacon lock (Pluto) — шире под "BCN LOCK …".
|
||||
// поле 8: динамический статус DMR; скрыт во всех остальных режимах.
|
||||
// поле 3: Supply (HPSDR) ИЛИ две температуры Pluto "Temp 37/53C RSSI -89dB" — шире.
|
||||
BASE_W: array[0..7] of Integer = (280, 160, 170, 190, 190, 180, 130, 200);
|
||||
INITIAL_TEXT: array[0..7] of string = (
|
||||
BASE_W: array[0..8] of Integer = (280, 160, 170, 190, 190, 180, 130, 200, 280);
|
||||
INITIAL_TEXT: array[0..8] of string = (
|
||||
'Board --',
|
||||
'IP --',
|
||||
'Disconnected',
|
||||
@@ -44,7 +46,8 @@ const
|
||||
'RX idle',
|
||||
'TX idle',
|
||||
'SEQ --',
|
||||
'PLL --'
|
||||
'PLL --',
|
||||
''
|
||||
);
|
||||
|
||||
constructor TMainStatusBar.Create(AOwner: TComponent);
|
||||
@@ -58,6 +61,7 @@ begin
|
||||
|
||||
for I := Low(STATUS_ORDER) to High(STATUS_ORDER) do
|
||||
CreateStatusCell(STATUS_ORDER[I], INITIAL_TEXT[STATUS_ORDER[I]]);
|
||||
FCells[8].Visible := False;
|
||||
LayoutCells;
|
||||
end;
|
||||
|
||||
@@ -87,6 +91,7 @@ end;
|
||||
procedure TMainStatusBar.LayoutCells;
|
||||
var
|
||||
PPI, X, I, Idx, W, H, G, Pad, FixedNatural, FixedAvail: Integer;
|
||||
VisibleCount, FixedCount: Integer;
|
||||
|
||||
function S(Value: Integer): Integer;
|
||||
begin
|
||||
@@ -103,7 +108,7 @@ var
|
||||
else if FixedAvail < FixedNatural then
|
||||
begin
|
||||
Result := (Int64(Result) * FixedAvail + FixedNatural div 2) div FixedNatural;
|
||||
if FixedAvail >= S(48) * 7 then
|
||||
if FixedAvail >= S(48) * FixedCount then
|
||||
Result := Max(S(48), Result);
|
||||
end;
|
||||
end;
|
||||
@@ -119,15 +124,26 @@ begin
|
||||
H := Max(1, ClientHeight - G * 2);
|
||||
|
||||
FixedNatural := 0;
|
||||
for I := Low(STATUS_ORDER) to High(STATUS_ORDER) - 1 do
|
||||
Inc(FixedNatural, S(BASE_W[STATUS_ORDER[I]]));
|
||||
FixedAvail := ClientWidth - S(SEQ_MIN_W) - G * 8;
|
||||
FixedCount := 0;
|
||||
VisibleCount := 0;
|
||||
for I := Low(STATUS_ORDER) to High(STATUS_ORDER) do
|
||||
begin
|
||||
Idx := STATUS_ORDER[I];
|
||||
if (FCells[Idx] = nil) or (not FCells[Idx].Visible) then Continue;
|
||||
Inc(VisibleCount);
|
||||
if Idx <> 6 then
|
||||
begin
|
||||
Inc(FixedNatural, S(BASE_W[Idx]));
|
||||
Inc(FixedCount);
|
||||
end;
|
||||
end;
|
||||
FixedAvail := ClientWidth - S(SEQ_MIN_W) - G * VisibleCount;
|
||||
|
||||
X := 0;
|
||||
for I := Low(STATUS_ORDER) to High(STATUS_ORDER) do
|
||||
begin
|
||||
Idx := STATUS_ORDER[I];
|
||||
if FCells[Idx] = nil then Continue;
|
||||
if (FCells[Idx] = nil) or (not FCells[Idx].Visible) then Continue;
|
||||
|
||||
Inc(X, G);
|
||||
if Idx = 6 then
|
||||
@@ -159,6 +175,14 @@ begin
|
||||
FLabels[Index].Caption := Text;
|
||||
end;
|
||||
|
||||
procedure TMainStatusBar.SetStatusVisible(Index: Integer; Visible: Boolean);
|
||||
begin
|
||||
if (Index < Low(FCells)) or (Index > High(FCells)) then Exit;
|
||||
if (FCells[Index] = nil) or (FCells[Index].Visible = Visible) then Exit;
|
||||
FCells[Index].Visible := Visible;
|
||||
LayoutCells;
|
||||
end;
|
||||
|
||||
procedure TMainStatusBar.ApplyTheme(const T: TAppTheme);
|
||||
var
|
||||
I: Integer;
|
||||
|
||||
Reference in New Issue
Block a user