Skip to content

Commit

Permalink
[F15E] Add TGP laser code setting
Browse files Browse the repository at this point in the history
  • Loading branch information
the-paid-actor committed Feb 7, 2024
1 parent 6542c73 commit e314901
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
24 changes: 24 additions & 0 deletions dcs-dtc/New/Presets/V2/Aircrafts/F15E/Systems/MiscSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class MiscSystem
public bool TACANToBeUpdated { get; set; }
public decimal ILSFrequency { get; set; }
public bool ILSToBeUpdated { get; set; }
public bool LaserSettingsToBeUpdated { get; set; }
public int TGPCode { get; set; }

public MiscSystem()
{
Expand All @@ -33,8 +35,30 @@ public MiscSystem()
TACANChannel = 1;
TACANBand = TACANBands.X;
ILSFrequency = 108.10M;
TGPCode = 1688;
}

public string SetTGPCode(string txt)
{
if (int.TryParse(txt, out int val))
{
if
(
txt.Length == 4 &&
(txt.Substring(0, 1) == "1" || txt.Substring(0, 1) == "2") &&
int.Parse(txt.Substring(1, 1)) >= 1 &&
int.Parse(txt.Substring(1, 1)) <= 8 &&
int.Parse(txt.Substring(2, 1)) >= 1 &&
int.Parse(txt.Substring(2, 1)) <= 8 &&
int.Parse(txt.Substring(3, 1)) >= 1 &&
int.Parse(txt.Substring(3, 1)) <= 8
)
{
TGPCode = val;
}
}
return TGPCode.ToString();
}

public string SetILSFrequency(string txt)
{
Expand Down
21 changes: 21 additions & 0 deletions dcs-dtc/New/UI/Aircrafts/F15E/Systems/MiscPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@ public MiscPage(F15EPage parent) : base(parent, nameof(parent.Configuration.Misc
}));
}

//Laser settings
{
left = padding;
top += padding + rowHeight;
this.Controls.Add(DTCCheckBox.Make(left, top, chkWidth, rowHeight, this.misc.LaserSettingsToBeUpdated, (chk) =>
{
this.misc.LaserSettingsToBeUpdated = chk.Checked;
this.SavePreset();
}));

left += padding + chkWidth;
this.Controls.Add(DTCLabel.Make("TGP Code", left, top, colWidth, rowHeight));

left += padding + colWidth;
this.Controls.AddRange(MakeTGPCodeControls(left, top, rowHeight, this.misc.TGPCode.ToString(), (txt) =>
{
this.misc.SetTGPCode(txt);
this.SavePreset();
}));
}

//TACAN
{
left = padding;
Expand Down
2 changes: 1 addition & 1 deletion dcs-dtc/New/Uploader/Aircrafts/F15E/F15EUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public void Execute()

this.BuildWaypoints();
this.BuildSmartWeapons();
this.BuildDisplays();
this.BuildRadios();
this.BuildMisc();
this.BuildDisplays();

Cmd(RestoreCockpitFrontRearState());

Expand Down
25 changes: 25 additions & 0 deletions dcs-dtc/New/Uploader/Aircrafts/F15E/Systems/Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@ private void BuildMisc()
}
EndIf();
}

if (config.Misc.LaserSettingsToBeUpdated)
{
StartIf(InFrontCockpit());
{
BuildTGPCode(UFC_PILOT, FLMPD);
}
EndIf();
StartIf(InRearCockpit());
{
BuildTGPCode(UFC_WSO, RLMPD);
}
EndIf();
}
}

private void BuildTGPCode(Device ufc, Device display)
{
NavigateToMainMenu(display);
Cmd(display.GetCommand("PB12"));
Cmd(ufc.GetCommand("CLR"));
Cmd(ufc.GetCommand("CLR"));
Cmd(ufc.GetCommand("MENU"));
Cmd(Digits(ufc, config.Misc.TGPCode.ToString()));
Cmd(display.GetCommand("PB19"));
}

private void BuildBullseye(Device ufc)
Expand Down

0 comments on commit e314901

Please sign in to comment.