TRXcontrol rig change works

This commit is contained in:
OH1KH 2022-08-25 10:54:40 +03:00
parent a25ddbe0f4
commit a1662e2484
5 changed files with 155 additions and 144 deletions

View File

@ -766,7 +766,7 @@ begin
dmUtils.LoadBandsSettings;
frmTRXControl.InicializeRig;
frmTRXControl.InitializeRig;
frmRotControl.InicializeRot;
OpenFreqMemories('');

View File

@ -1497,15 +1497,7 @@ begin
end;
if frmTRXControl.Showing then
begin
if frmTRXControl.rbRadio1.Checked then
tmrRadio.Interval := cqrini.ReadInteger('TRX1','Poll',500)
else
tmrRadio.Interval := cqrini.ReadInteger('TRX2','Poll',500)
end
else begin
tmrRadio.Interval := cqrini.ReadInteger('TRX1','Poll',500)
end;
tmrRadio.Interval := cqrini.ReadInteger('TRX'+IntToStr(frmTRXControl.cmbRig.ItemIndex+1),'Poll',500);
cbTxLo.Checked := cqrini.ReadBool('NewQSO', 'UseTXLO', False);
edtTXLO.Text := cqrini.ReadString('NewQSO', 'TXLO', '');
@ -4504,7 +4496,7 @@ end;
procedure TfrmNewQSO.acRefreshTRXExecute(Sender: TObject);
begin
frmTRXControl.InicializeRig;
frmTRXControl.InitializeRig;
tmrRadio.Enabled := True;
frmRotControl.InicializeRot;
tmrRotor.Enabled := True
@ -7172,7 +7164,9 @@ begin
FreeAndNil(CWint)
end;
if frmTRXControl.rbRadio1.Checked then n := '1' else n := '2';
//if frmTRXControl.rbRadio1.Checked then n := '1' else n := '2';
//ToDo fix CW when cmbRig works elsewhere!
n:='1';
if ((dmData.DebugLevel>=1 ) or ((abs(dmData.DebugLevel) and 8) = 8 )) then Writeln('Radio'+n+' CW settings:');
KeyerType := cqrini.ReadInteger('CW','Type'+n,0);
if ((dmData.DebugLevel>=1 ) or ((abs(dmData.DebugLevel) and 8) = 8 )) then Writeln('CW init keyer type:',KeyerType);

View File

@ -1640,7 +1640,7 @@ begin
frmBandMap.LoadFonts;
cqrini.SaveToDisk;
if TRXChanged then
frmTRXControl.InicializeRig;
frmTRXControl.InitializeRig;
if RotChanged then
frmRotControl.InicializeRot;
@ -1691,7 +1691,7 @@ begin
if frmPropagation.Showing then
frmPropagation.RefreshPropagation;
frmTRXControl.rbRadio1.Caption := edtRadioName.Text;
frmTRXControl.FillRigNames;
frmTRXControl.SetDebugMode(chkTrxControlDebug.Checked or (dmData.DebugLevel>0));
if ((frmNewQSO.sbNewQSO.Panels[0].Text = '') or (frmNewQSO.sbNewQSO.Panels[0].Text = cMyLoc)) then

View File

@ -1,12 +1,12 @@
object frmTRXControl: TfrmTRXControl
Left = 732
Height = 326
Height = 302
Top = 27
Width = 275
Width = 265
Anchors = []
Caption = 'TRX control'
ClientHeight = 301
ClientWidth = 275
ClientHeight = 277
ClientWidth = 265
Icon.Data = {
BE1000000000010001002020000001002000A810000016000000280000002000
0000400000000100200000000000001000006400000064000000000000000000
@ -152,7 +152,7 @@ object frmTRXControl: TfrmTRXControl
OnKeyDown = FormKeyDown
OnKeyUp = FormKeyUp
OnShow = FormShow
LCLVersion = '2.2.0.4'
LCLVersion = '2.2.2.0'
object gbMode: TGroupBox
AnchorSideLeft.Control = gbVfo
AnchorSideTop.Control = gbVfo
@ -160,7 +160,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 196
Left = 186
Height = 238
Top = 48
Width = 78
@ -279,16 +279,16 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Control = Owner
AnchorSideRight.Control = gbMode
Left = 1
Height = 301
Height = 277
Top = 0
Width = 194
Width = 184
Align = alLeft
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 1
BorderSpacing.Right = 1
BevelOuter = bvNone
ClientHeight = 301
ClientWidth = 194
ClientHeight = 277
ClientWidth = 184
TabOrder = 1
object gbFreq: TGroupBox
AnchorSideLeft.Control = pnlMain
@ -297,14 +297,14 @@ object frmTRXControl: TfrmTRXControl
Left = 1
Height = 64
Top = 1
Width = 192
Width = 182
Align = alTop
BorderSpacing.Left = 1
BorderSpacing.Top = 1
BorderSpacing.Right = 1
Caption = ' Freq '
ClientHeight = 46
ClientWidth = 190
ClientWidth = 180
TabOrder = 0
OnClick = gbFreqClick
object lblFreq: TLabel
@ -316,10 +316,10 @@ object frmTRXControl: TfrmTRXControl
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = gbFreq
AnchorSideBottom.Side = asrBottom
Left = 4
Left = 3
Height = 39
Top = 4
Width = 183
Width = 174
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = False
@ -332,6 +332,7 @@ object frmTRXControl: TfrmTRXControl
Font.Height = 30
Font.Style = [fsBold]
Layout = tlCenter
ParentColor = False
ParentFont = False
OnClick = lblFreqClick
end
@ -342,10 +343,10 @@ object frmTRXControl: TfrmTRXControl
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = lblFreq
AnchorSideBottom.Side = asrBottom
Left = 4
Left = 3
Height = 39
Top = 4
Width = 183
Width = 174
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = False
AutoSelect = False
@ -365,16 +366,16 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Control = gbInfo
AnchorSideRight.Control = pnlMain
Left = 1
Height = 158
Height = 128
Top = 117
Width = 192
Width = 182
Align = alClient
BorderSpacing.Left = 1
BorderSpacing.Top = 3
BorderSpacing.Right = 1
Caption = ' Band '
ClientHeight = 140
ClientWidth = 190
ClientHeight = 110
ClientWidth = 180
TabOrder = 1
object btn160m: TButton
AnchorSideLeft.Control = gbBand
@ -440,7 +441,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = btn15m
AnchorSideTop.Side = asrBottom
Left = 67
Left = 62
Height = 25
Top = 84
Width = 56
@ -455,7 +456,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = btn17m
AnchorSideTop.Side = asrBottom
Left = 67
Left = 62
Height = 25
Top = 58
Width = 56
@ -470,7 +471,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = btn20m
AnchorSideTop.Side = asrBottom
Left = 67
Left = 62
Height = 25
Top = 32
Width = 56
@ -484,7 +485,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideLeft.Control = gbBand
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = gbBand
Left = 67
Left = 62
Height = 25
Top = 6
Width = 56
@ -498,7 +499,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Control = gbBand
AnchorSideRight.Control = gbBand
AnchorSideRight.Side = asrBottom
Left = 128
Left = 118
Height = 25
Top = 6
Width = 56
@ -515,7 +516,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbBand
AnchorSideRight.Side = asrBottom
Left = 128
Left = 118
Height = 25
Top = 32
Width = 56
@ -532,7 +533,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbBand
AnchorSideRight.Side = asrBottom
Left = 128
Left = 118
Height = 25
Top = 84
Width = 56
@ -549,7 +550,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbBand
AnchorSideRight.Side = asrBottom
Left = 128
Left = 118
Height = 25
Top = 58
Width = 56
@ -570,12 +571,12 @@ object frmTRXControl: TfrmTRXControl
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 30
Top = 110
Width = 190
Top = 80
Width = 180
Anchors = [akLeft, akRight, akBottom]
BevelOuter = bvNone
ClientHeight = 30
ClientWidth = 190
ClientWidth = 180
TabOrder = 12
Visible = False
object btPon: TButton
@ -596,7 +597,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = pnlPower
AnchorSideTop.Side = asrCenter
Left = 67
Left = 62
Height = 25
Top = 3
Width = 56
@ -610,7 +611,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = pnlPower
AnchorSideRight.Side = asrBottom
Left = 128
Left = 118
Height = 25
Top = 3
Width = 56
@ -629,12 +630,12 @@ object frmTRXControl: TfrmTRXControl
AnchorSideBottom.Control = pnlPower
Left = 0
Height = 30
Top = 80
Width = 190
Top = 50
Width = 180
Anchors = [akLeft, akRight, akBottom]
BevelOuter = bvNone
ClientHeight = 30
ClientWidth = 190
ClientWidth = 180
TabOrder = 13
Visible = False
object btnUsr1: TButton
@ -647,7 +648,7 @@ object frmTRXControl: TfrmTRXControl
Width = 56
BorderSpacing.Left = 6
Caption = 'USR1'
OnClick = btnUsr1Click
OnClick = btnUsrClick
TabOrder = 0
end
object btnUsr2: TButton
@ -655,12 +656,12 @@ object frmTRXControl: TfrmTRXControl
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = pnlUsr
AnchorSideTop.Side = asrCenter
Left = 67
Left = 62
Height = 25
Top = 3
Width = 56
Caption = 'USR2'
OnClick = btnUsr2Click
OnClick = btnUsrClick
TabOrder = 1
end
object btnUsr3: TButton
@ -669,14 +670,14 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = pnlUsr
AnchorSideRight.Side = asrBottom
Left = 128
Left = 118
Height = 25
Top = 3
Width = 56
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Caption = 'USR3'
OnClick = btnUsr3Click
OnClick = btnUsrClick
TabOrder = 2
end
end
@ -688,47 +689,58 @@ object frmTRXControl: TfrmTRXControl
AnchorSideBottom.Control = pnlMain
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 26
Top = 275
Width = 194
Height = 27
Top = 247
Width = 184
Align = alBottom
BorderSpacing.Top = 2
BorderSpacing.Bottom = 3
BevelOuter = bvNone
ClientHeight = 26
ClientWidth = 194
ClientHeight = 27
ClientWidth = 184
ParentBidiMode = False
TabOrder = 2
object rbRadio1: TRadioButton
object cmbRig: TComboBox
AnchorSideLeft.Control = pnlRig
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = pnlRig
Left = 7
Height = 23
Top = 1
Width = 56
BorderSpacing.Left = 7
BorderSpacing.Top = 1
Caption = 'RIG: '
Checked = True
OnClick = rbRadio1Click
ParentBidiMode = False
AnchorSideTop.Side = asrCenter
AnchorSideBottom.Control = pnlRig
AnchorSideBottom.Side = asrBottom
Left = 27
Height = 27
Top = 0
Width = 130
Anchors = [akTop, akLeft, akBottom]
ItemHeight = 0
ItemIndex = 0
Items.Strings = (
'1'
'2'
'3'
'4'
'5'
'6'
)
OnChange = cmbRigChange
OnGetItems = cmbRigGetItems
Style = csDropDownList
TabOrder = 0
TabStop = True
Text = '1'
end
object rbRadio2: TRadioButton
object lblInitRig: TLabel
AnchorSideLeft.Control = pnlRig
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = pnlRig
AnchorSideRight.Control = pnlRig
AnchorSideRight.Side = asrBottom
Left = 131
Height = 23
Top = 1
Width = 56
Anchors = [akTop, akRight]
BidiMode = bdRightToLeft
BorderSpacing.Top = 1
BorderSpacing.Right = 7
Caption = 'RIG: '
OnClick = rbRadio2Click
ParentBidiMode = False
TabOrder = 1
AnchorSideTop.Side = asrCenter
Left = 52
Height = 17
Top = 5
Width = 80
Alignment = taCenter
Caption = 'Please wait!'
ParentColor = False
Visible = False
end
end
object gbInfo: TGroupBox
@ -738,14 +750,14 @@ object frmTRXControl: TfrmTRXControl
Left = 1
Height = 46
Top = 68
Width = 192
Width = 182
Align = alTop
BorderSpacing.Left = 1
BorderSpacing.Top = 3
BorderSpacing.Right = 1
Caption = 'Mem Info'
ClientHeight = 28
ClientWidth = 190
ClientWidth = 180
TabOrder = 3
Visible = False
object edtMemNr: TEdit
@ -757,7 +769,7 @@ object frmTRXControl: TfrmTRXControl
Left = 6
Height = 27
Top = 0
Width = 178
Width = 168
Anchors = [akTop, akLeft, akRight]
AutoSize = False
AutoSelect = False
@ -775,7 +787,7 @@ object frmTRXControl: TfrmTRXControl
AnchorSideTop.Control = pnlMain
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 196
Left = 186
Height = 48
Top = 0
Width = 78

View File

@ -56,6 +56,7 @@ type
btnUsr1 : TButton;
btPstby : TButton;
btnUsr3 : TButton;
cmbRig: TComboBox;
edtFreqInput : TEdit;
edtMemNr : TEdit;
gbBand : TGroupBox;
@ -64,6 +65,7 @@ type
gbInfo : TGroupBox;
gbVfo : TGroupBox;
GroupBox4 : TGroupBox;
lblInitRig: TLabel;
lblFreq : TLabel;
mnuShowUsr : TMenuItem;
mnuShowInfo : TMenuItem;
@ -78,8 +80,6 @@ type
pnlRig : TPanel;
pnlMain : TPanel;
pnlPower : TPanel;
rbRadio1 : TRadioButton;
rbRadio2 : TRadioButton;
tmrRadio : TTimer;
procedure acAddModMemExecute(Sender : TObject);
procedure btnMemWriClick(Sender : TObject);
@ -90,9 +90,9 @@ type
procedure btPoffClick(Sender : TObject);
procedure btPonClick(Sender : TObject);
procedure btPstbyClick(Sender : TObject);
procedure btnUsr1Click(Sender : TObject);
procedure btnUsr2Click(Sender : TObject);
procedure btnUsr3Click(Sender : TObject);
procedure btnUsrClick(Sender : TObject);
procedure cmbRigChange(Sender: TObject);
procedure cmbRigGetItems(Sender: TObject);
procedure edtFreqInputKeyPress(Sender : TObject; var Key : Char);
procedure edtFreqInputKeyUp(Sender : TObject; var Key : Word; Shift : TShiftState);
procedure edtFreqInputMouseLeave(Sender : TObject);
@ -100,6 +100,7 @@ type
Shift : TShiftState; X, Y : Integer);
procedure edtFreqInputMouseWheel(Sender : TObject; Shift : TShiftState;
WheelDelta : Integer; MousePos : TPoint; var Handled : Boolean);
procedure FillRigNames(Sender: TObject);
procedure FormClose(Sender : TObject; var CloseAction : TCloseAction);
procedure FormCreate(Sender : TObject);
procedure FormDestroy(Sender : TObject);
@ -167,7 +168,7 @@ type
function GetModeFreqNewQSO(var mode, freq : String) : Boolean;
function GetBandWidth(mode : String) : Integer;
function GetModeBand(var mode, band : String) : Boolean;
function InicializeRig : Boolean;
function InitializeRig : Boolean;
function GetFreqHz : Double;
function GetFreqkHz : Double;
function GetFreqMHz : Double;
@ -188,6 +189,7 @@ type
procedure LoadBandButtons;
function ListModeClose : Boolean;
procedure HLTune(start : Boolean);
procedure FillRigNames;
end;
var
@ -393,10 +395,11 @@ function TfrmTRXControl.GetBandWidth(mode : String) : Integer;
var
section : String;
begin
if rbRadio1.Checked then
section := 'Band1'
else
section := 'Band2';
//ToDo fix this when cmbRig work elsewhere
// if rbRadio1.Checked then
section := 'Band1';
// else
// section := 'Band2';
Result := 500;
if (mode = 'LSB') or (mode = 'USB') then
mode := 'SSB';
@ -411,15 +414,28 @@ begin
if mode = 'FM' then
Result := (cqrini.ReadInteger(section, 'FM', 2500));
end;
procedure TfrmTRXControl.FillRigNames;
var
n:integer;
s,r:string;
Begin
for n:=0 to 5 do
Begin
s:=IntToStr(n+1);
r:=cqrini.ReadString('TRX'+s, 'Desc', '');
if r='' then r:=' None' else r:=' '+r;
cmbRig.Items[n]:=s + r;
end;
end;
procedure TfrmTRXControl.FormShow(Sender : TObject);
begin
LoadUsrButtonCaptions;
LoadButtonCaptions;
LoadBandButtons;
dmUtils.LoadWindowPos(frmTRXControl);
rbRadio1.Caption := cqrini.ReadString('TRX1', 'Desc', 'Radio 1');
rbRadio2.Caption := cqrini.ReadString('TRX2', 'Desc', 'Radio 2');
FillRigNames;
old_mode := '';
MemRelated := cqrini.ReadBool('TRX', 'MemModeRelated', False);
gbInfo.Visible := cqrini.ReadBool('TRX', 'MemShowInfo', gbInfo.Visible);
@ -700,13 +716,13 @@ end;
procedure TfrmTRXControl.rbRadio1Click(Sender : TObject);
begin
LoadUsrButtonCaptions;
InicializeRig;
InitializeRig;
end;
procedure TfrmTRXControl.rbRadio2Click(Sender : TObject);
begin
LoadUsrButtonCaptions;
InicializeRig;
InitializeRig;
end;
procedure TfrmTRXControl.tmrRadioTimer(Sender : TObject);
@ -872,47 +888,32 @@ begin
else
radio.UsrCmd(c);
end;
procedure TfrmTRXControl.btnUsr1Click(Sender : TObject);
procedure TfrmTRXControl.btnUsrClick(Sender : TObject);
var
r : Char;
b : Char;
r:string;
begin
if Assigned(radio) then
begin
if rbRadio1.Checked then r := '1'
else
r := '2';
UserButton(r, '1');
end;
if Sender = btnUsr1 then b:='1';
if Sender = btnUsr2 then b:='2';
if Sender = btnUsr3 then b:='3';
r:=IntToStr(cmbRig.ItemIndex+1);
UserButton(r[1], b);
end;
procedure TfrmTRXControl.btnUsr2Click(Sender : TObject);
var
r : Char;
procedure TfrmTRXControl.cmbRigChange(Sender: TObject);
begin
if Assigned(radio) then
begin
if rbRadio1.Checked then r := '1'
else
r := '2';
UserButton(r, '2');
end;
cmbRig.Visible:=False;
lblInitRig.Visible:=True;
InitializeRig;
lblInitRig.Visible:=False;
cmbRig.Visible:=True;
end;
procedure TfrmTRXControl.btnUsr3Click(Sender : TObject);
var
r : Char;
procedure TfrmTRXControl.cmbRigGetItems(Sender: TObject);
begin
if Assigned(radio) then
begin
if rbRadio1.Checked then r := '1'
else
r := '2';
UserButton(r, '3');
end;
FillRigNames;
end;
procedure TfrmTRXControl.edtFreqInputKeyPress(Sender : TObject; var Key : Char);
begin
if key = '.' then
@ -999,6 +1000,11 @@ begin
end;
end;
procedure TfrmTRXControl.FillRigNames(Sender: TObject);
begin
end;
procedure TfrmTRXControl.FormCreate(Sender : TObject);
begin
Radio := nil;
@ -1034,7 +1040,7 @@ begin
end;
end;
function TfrmTRXControl.InicializeRig : Boolean;
function TfrmTRXControl.InitializeRig : Boolean;
var
n : String = '';
id : Integer = 0;
@ -1050,9 +1056,7 @@ begin
Sleep(500);
Application.ProcessMessages;
if rbRadio1.Checked then n := '1'
else
n := '2';
n:=IntToStr(cmbRig.ItemIndex+1);
radio := TRigControl.Create;
@ -1060,7 +1064,10 @@ begin
radio.DebugMode := True;
if not TryStrToInt(cqrini.ReadString('TRX' + n, 'model', ''), id) then
Begin
cmbRig.Items[cmbRig.ItemIndex]:= n + ' Not Set';
radio.RigId := 1
end
else
radio.RigId := id;
@ -1510,11 +1517,9 @@ end;
procedure TfrmTRXControl.LoadUsrButtonCaptions;
var
r : Char;
r : String;
begin
if rbRadio1.Checked then r := '1'
else
r := '2';
r:= IntToStr(cmbRig.ItemIndex+1);
btnUsr1.Caption := cqrini.ReadString('TRX' + r, 'usr1name', 'Usr1');
btnUsr2.Caption := cqrini.ReadString('TRX' + r, 'usr2name', 'Usr2');
btnUsr3.Caption := cqrini.ReadString('TRX' + r, 'usr3name', 'Usr3');