From 89a8eee812ee4426e1bb234f38d696fea71e2fe5 Mon Sep 17 00:00:00 2001 From: OH1KH Date: Tue, 30 Aug 2022 16:22:44 +0300 Subject: [PATCH] Added preferences/TRXControl/Rig Power ON checkbox. If rig supports power cat commands and checked will send PowerON cmd to rig at initialize phase. --- src/fPreferences.lfm | 30 ++++++++++++++++++++++-------- src/fPreferences.pas | 3 +++ src/fTRXControl.pas | 1 + src/uRigControl.pas | 14 ++++++++++---- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/fPreferences.lfm b/src/fPreferences.lfm index 5033684..d34280d 100644 --- a/src/fPreferences.lfm +++ b/src/fPreferences.lfm @@ -5,8 +5,8 @@ object frmPreferences: TfrmPreferences Width = 1131 HelpType = htKeyword HelpKeyword = 'help/h1.html' - HorzScrollBar.Page = 794 - VertScrollBar.Page = 432 + HorzScrollBar.Page = 1094 + VertScrollBar.Page = 703 ActiveControl = lbPreferences AutoScroll = True BorderIcons = [biSystemMenu] @@ -23,9 +23,9 @@ object frmPreferences: TfrmPreferences Height = 713 Top = 0 Width = 883 - ActivePage = tabModes + ActivePage = tabTRXcontrol Align = alClient - TabIndex = 7 + TabIndex = 5 TabOrder = 0 OnChange = pgPreferencesChange object tabProgram: TTabSheet @@ -2140,7 +2140,7 @@ object frmPreferences: TfrmPreferences BorderSpacing.Left = 6 BorderSpacing.Top = 4 Caption = ' rigctld ' - ClientHeight = 86 + ClientHeight = 70 ClientWidth = 655 TabOrder = 0 object lblRigctdPath: TLabel @@ -2374,7 +2374,7 @@ object frmPreferences: TfrmPreferences Width = 511 BorderSpacing.Top = 3 Caption = 'Radio one serial parameters' - ClientHeight = 146 + ClientHeight = 130 ClientWidth = 509 TabOrder = 11 object lblSerialRSpd: TLabel @@ -2800,10 +2800,11 @@ object frmPreferences: TfrmPreferences end end object chkRVfo: TCheckBox - AnchorSideLeft.Control = edtRRigCtldPort + AnchorSideLeft.Control = grbSerialR + AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = chkRSendCWR AnchorSideTop.Side = asrCenter - Left = 549 + Left = 517 Height = 23 Top = 94 Width = 103 @@ -2851,6 +2852,19 @@ object frmPreferences: TfrmPreferences Caption = 'Name' ParentColor = False end + object chkRPwrOn: TCheckBox + AnchorSideLeft.Control = chkRVfo + AnchorSideTop.Control = chkRVfo + AnchorSideTop.Side = asrBottom + Left = 517 + Height = 23 + Top = 117 + Width = 131 + Caption = 'Rig pwr ON cmd' + Checked = True + State = cbChecked + TabOrder = 13 + end end end object TabROTcontrol: TTabSheet diff --git a/src/fPreferences.pas b/src/fPreferences.pas index 6463165..a529af0 100644 --- a/src/fPreferences.pas +++ b/src/fPreferences.pas @@ -130,6 +130,7 @@ type cb30cm: TCheckBox; cgLimit: TCheckGroup; cbNoKeyerReset: TCheckBox; + chkRPwrOn: TCheckBox; chkOperator: TCheckBox; chkDarcDok: TCheckBox; chkNewDOKTables: TCheckBox; @@ -3299,6 +3300,7 @@ Begin edtRRigCtldPort.Text := cqrini.ReadString('TRX'+nr, 'RigCtldPort', '4532'); edtRRigCtldArgs.Text := cqrini.ReadString('TRX'+nr, 'ExtraRigCtldArgs', ''); chkRRunRigCtld.Checked := cqrini.ReadBool('TRX'+nr, 'RunRigCtld', False); + chkRPwrON.Checked := cqrini.ReadBool('TRX'+nr, 'RigPwrON', True); edtRHost.Text := cqrini.ReadString('TRX'+nr, 'host', 'localhost'); cmbSpeedR.ItemIndex := cqrini.ReadInteger('TRX'+nr, 'SerialSpeed', 0); cmbDataBitsR.ItemIndex := cqrini.ReadInteger('TRX'+nr, 'DataBits', 0); @@ -3337,6 +3339,7 @@ Begin cqrini.WriteString('TRX'+nr, 'RigCtldPort', edtRRigCtldPort.Text); cqrini.WriteString('TRX'+nr, 'ExtraRigCtldArgs', edtRRigCtldArgs.Text); cqrini.WriteBool('TRX'+nr, 'RunRigCtld', chkRRunRigCtld.Checked); + cqrini.WriteBool('TRX'+nr, 'RigPwrON', chkRPwrON.Checked); cqrini.WriteString('TRX'+nr, 'host', edtRHost.Text); cqrini.WriteInteger('TRX'+nr, 'SerialSpeed', cmbSpeedR.ItemIndex); cqrini.WriteInteger('TRX'+nr, 'DataBits', cmbDataBitsR.ItemIndex); diff --git a/src/fTRXControl.pas b/src/fTRXControl.pas index dee4286..9fe9a31 100644 --- a/src/fTRXControl.pas +++ b/src/fTRXControl.pas @@ -1095,6 +1095,7 @@ begin radio.RigPoll := poll; radio.RigSendCWR := cqrini.ReadBool('TRX' + n, 'CWR', False); radio.RigChkVfo := cqrini.ReadBool('TRX' + n, 'ChkVfo', True); + radio.PowerON:=cqrini.ReadBool('TRX'+ n, 'RigPwrON', True); tmrRadio.Interval := radio.RigPoll; tmrRadio.Enabled := True; Result := True; diff --git a/src/uRigControl.pas b/src/uRigControl.pas index 6ccc479..06770ec 100644 --- a/src/uRigControl.pas +++ b/src/uRigControl.pas @@ -39,11 +39,12 @@ type TRigControl = class fVFO : TVFO; RigCommand : TStringList; fRigSendCWR : Boolean; - fRigChkVfo : Boolean; + fRigChkVfo : Boolean; fRXOffset : Double; fTXOffset : Double; fMorse : boolean; fPower : boolean; + fPowerON : boolean; fGetVfo : boolean; AllowCommand : integer; //things to do before start polling @@ -94,6 +95,8 @@ public //can rig send CW property Power : Boolean read fPower; //can rig switch power + property PowerON : Boolean write fPowerON; + //may rig switch power on at start property CanGetVfo : Boolean read fGetVfo; //can rig show vfo (many Icoms can not) property LastError : String read fLastError; @@ -620,10 +623,13 @@ begin AllowCommand:=-1; //waiting for reply end; 8: Begin - cmd:= '+\set_powerstat 1'+LineEnding; - if DebugMode then + if fPowerON then + begin + cmd:= '+\set_powerstat 1'+LineEnding; + if DebugMode then Writeln('Sending: '+cmd); - RigctldConnect.SendMessage(cmd); + RigctldConnect.SendMessage(cmd); + end; AllowCommand:=-1; //waiting for reply end;