fixed powerbuttons, initial powerON checkbox usage, preferences loading

This commit is contained in:
OH1KH 2022-09-07 13:04:48 +03:00
parent 5fbd310db3
commit 3d0ea64f5d
4 changed files with 25 additions and 15 deletions

View File

@ -23,9 +23,9 @@ object frmPreferences: TfrmPreferences
Height = 712
Top = 0
Width = 883
ActivePage = tabModes
ActivePage = tabTRXcontrol
Align = alClient
TabIndex = 7
TabIndex = 5
TabOrder = 0
OnChange = pgPreferencesChange
object tabProgram: TTabSheet
@ -2833,11 +2833,14 @@ object frmPreferences: TfrmPreferences
AnchorSideTop.Side = asrCenter
Left = 517
Height = 23
Hint = 'Check if rigctld has started with --vfo parameter. '#10'if result is posirive (1) the polling command format '#10'used will be different.'
Top = 93
Width = 103
Caption = 'Use \chkvfo'
Checked = True
OnChange = TRXParamsChange
ParentShowHint = False
ShowHint = True
State = cbChecked
TabOrder = 10
end
@ -2874,10 +2877,13 @@ object frmPreferences: TfrmPreferences
AnchorSideTop.Side = asrBottom
Left = 517
Height = 23
Hint = 'Should Power ON command to be sent when initializing rig'
Top = 116
Width = 131
Caption = 'Rig pwr ON cmd'
Checked = True
ParentShowHint = False
ShowHint = True
State = cbChecked
TabOrder = 13
end

View File

@ -2680,6 +2680,8 @@ end;
procedure TfrmPreferences.tabModesEnter(Sender: TObject);
begin
sleep(100); //needed sometimes !?!?! when entering directly to this tab
Application.ProcessMessages; //otherwise names are missing from selector
LoadBandW(cmbRadioModes.ItemIndex);
cmbRadioModes.Items:=frmTRXControl.cmbRig.Items; //names to modes tab (needed when entering direct to modes tab)
cmbRadioModes.ItemIndex:= cmbRadioNr.ItemIndex; //select rig in use
@ -2934,7 +2936,6 @@ begin
chkModeRelatedOnly.Checked := cqrini.ReadBool('TRX','MemModeRelated',False);
edtRigCount.Value:=cqrini.ReadInteger('TRX', 'RigCount', 2);
InitRigCmb;
//frmTRXControl.cmbRigGetItems(nil);
LoadTRX(cmbRadioNr.ItemIndex);
LoadBandW(cmbRadioNr.ItemIndex);
@ -2945,7 +2946,7 @@ begin
dmUtils.LoadRigsToComboBox(cqrini.ReadString('ROT2', 'model', ''),edtRotCtldPath.Text,cmbModelRot2)
end
else begin
Application.MessageBox('rotctld binary not fount, cannot load list of supported rotators!'+LineEnding+LineEnding+
Application.MessageBox('rotctld binary not found, unable to load list of supported rotators!'+LineEnding+LineEnding+
'Fix path to rotctld in ROT control tab.', 'Error', mb_OK+ mb_IconError)
end;
@ -3360,13 +3361,15 @@ begin
end;
Procedure TfrmPreferences.LoadTRX(RigNr:integer);
var
nr :string;
nr,
rp :string;
Begin
nr:=IntToStr(RigNr);
if (FileExistsUTF8(edtRigCtldPath.Text)) then
dmUtils.LoadRigsToComboBox(cqrini.ReadString('TRX'+nr, 'model', ''),edtRigCtldPath.Text,cmbModelRig)
rp:= cqrini.ReadString('TRX', 'RigCtldPath', '/usr/bin/rigctld');
if FileExistsUTF8(rp) then
dmUtils.LoadRigsToComboBox(cqrini.ReadString('TRX'+nr, 'model', ''),rp,cmbModelRig)
else begin
Application.MessageBox('rigctld binary not fount, cannot load list of supported rigs!'+LineEnding+LineEnding+
Application.MessageBox('rigctld binary not found, unable to load list of supported rigs!'+LineEnding+LineEnding+
'Fix path to rigctld in TRX control tab.', 'Error', mb_OK+ mb_IconError)
end;
edtRDevice.Text := cqrini.ReadString('TRX'+nr, 'device', '');

View File

@ -372,7 +372,11 @@ begin
frmBandMap.CurrentFreq := f * 1000;
frmBandMap.CurrentMode := m;
if Assigned(radio) then
pnlPower.Enabled:=radio.Power;
begin
btPon.Enabled:=radio.Power;
btPoff.Enabled:=radio.Power;
btPstby.Enabled:=radio.Power;
end;
end;
function TfrmTRXControl.GetModeNumber(mode : String) : Cardinal;
@ -422,7 +426,8 @@ begin
dmUtils.LoadWindowPos(frmTRXControl);
cmbRigGetItems(nil);
cmbRig.ItemIndex:=StrToInt(cqrini.ReadString('TRX', 'RigInUse', '1'));
cmbRigCloseUp(nil); //defaults rig 1
cmbRigCloseUp(nil); //defaults rig 1 in case of undefined
cmbRigChange(nil); //inits rig
old_mode := '';
MemRelated := cqrini.ReadBool('TRX', 'MemModeRelated', False);
gbInfo.Visible := cqrini.ReadBool('TRX', 'MemShowInfo', gbInfo.Visible);

View File

@ -566,7 +566,7 @@ begin
Begin
fMorse:= b[3]='Y';
if DebugMode then Writeln('Send Morse: ',fMorse,LineEnding);
if fPower then
if fPower and fPowerON then
AllowCommand:=8 //issue power on
else
AllowCommand:=1 //check pending commands
@ -623,15 +623,11 @@ begin
AllowCommand:=-1; //waiting for reply
end;
8: Begin
if fPowerON then
begin
cmd:= '+\set_powerstat 1'+LineEnding;
if DebugMode then
Writeln('Sending: '+cmd);
RigctldConnect.SendMessage(cmd);
AllowCommand:=-1; //waiting for reply
end;
end;
//lower priority commands queue handled here