Skip to content

Commit

Permalink
Yak52 radio and significant radio code refactoring (#351)
Browse files Browse the repository at this point in the history
* vhf radio added to pz69

* Front and rear ADF added. Optimized usage imports in solution.

* Imports optimized

* Yak-52 GMK and refactoring

Radios now display what mode they are in after the first report. Clicking, turning any dial will do this.
Refactored radio OO structure for this to work and some syntax refactoring overall done.

* Update DCSFPOpenMacroBoardMetaProject

* Added ClickSkipper to all radio classes.

* ClickSkipper.Click(dcsbiosCommand) now used in radios to lessen code
  • Loading branch information
jdahlblom authored Jul 18, 2023
1 parent a073c5c commit 4b88b9f
Show file tree
Hide file tree
Showing 58 changed files with 2,701 additions and 3,151 deletions.
4 changes: 1 addition & 3 deletions Source/ControlReference/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Diagnostics;
using System.Threading;
using System;
using System;
using System.Windows;
using ControlReference.Properties;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Media;
using System.Windows;
using System.Windows.Controls;
Expand Down
1 change: 0 additions & 1 deletion Source/DCS-BIOS/DCSBIOSCommon.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

Expand Down
3 changes: 1 addition & 2 deletions Source/DCS-BIOS/DCSBIOSOutput.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics;
using DCS_BIOS.Json;
using DCS_BIOS.Json;

namespace DCS_BIOS
{
Expand Down
2 changes: 1 addition & 1 deletion Source/DCSFPOpenMacroBoardMetaProject
6 changes: 6 additions & 0 deletions Source/DCSFlightpanels.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ABRIS/@EntryIndexedValue">ABRIS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ADF/@EntryIndexedValue">ADF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AH/@EntryIndexedValue">AH</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AJS/@EntryIndexedValue">AJS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ALL/@EntryIndexedValue">ALL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=API/@EntryIndexedValue">API</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=APX/@EntryIndexedValue">APX</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ARC/@EntryIndexedValue">ARC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ARN/@EntryIndexedValue">ARN</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AV/@EntryIndexedValue">AV</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BIOS/@EntryIndexedValue">BIOS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BIPS/@EntryIndexedValue">BIPS</s:String>
Expand All @@ -25,6 +28,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FM/@EntryIndexedValue">FM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FR/@EntryIndexedValue">FR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FUG/@EntryIndexedValue">FUG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GMK/@EntryIndexedValue">GMK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GREEN/@EntryIndexedValue">GREEN</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HCU/@EntryIndexedValue">HCU</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HF/@EntryIndexedValue">HF</s:String>
Expand Down Expand Up @@ -62,6 +66,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=USB/@EntryIndexedValue">USB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VHF/@EntryIndexedValue">VHF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VHFAM/@EntryIndexedValue">VHFAM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VHFFM/@EntryIndexedValue">VHFFM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VID/@EntryIndexedValue">VID</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VOR/@EntryIndexedValue">VOR</s:String>
Expand Down Expand Up @@ -96,6 +101,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=ABRIS/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Backlit/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=BIPLED/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ctrlref/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DCSBIOSJSON/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DCSFP/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DETROLA/@EntryIndexedValue">True</s:Boolean>
Expand Down
Binary file added Source/DCSFlightpanels/Images/YAK52_ADF.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source/DCSFlightpanels/Images/YAK52_VHF.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions Source/DCSFlightpanels/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using DCS_BIOS.Json;

namespace DCSFlightpanels
namespace DCSFlightpanels
{
/*
Custom Resharper Naming abbreviations
Expand Down Expand Up @@ -798,6 +796,16 @@ private void CreatePanel(HIDSkeleton hidSkeleton)

AppEventHandler.PanelEvent(this, hidSkeleton.HIDInstance, hidSkeleton, PanelEventType.Created);
}
else if (DCSAircraft.IsYak52(_profileHandler.DCSAircraft) && !_profileHandler.DCSAircraft.UseGenericRadio)
{
var radioPanelPZ69UserControl = new RadioPanelPZ69UserControlYak52(hidSkeleton);
_panelUserControls.Add(radioPanelPZ69UserControl);
tabItem.Content = radioPanelPZ69UserControl;
TabControlPanels.Items.Add(tabItem);
_profileFileHIDInstances.Add(new KeyValuePair<string, GamingPanelEnum>(hidSkeleton.HIDInstance, hidSkeleton.GamingPanelType));

AppEventHandler.PanelEvent(this, hidSkeleton.HIDInstance, hidSkeleton, PanelEventType.Created);
}
else
{
var radioPanelPZ69UserControl = new RadioPanelPZ69UserControlGeneric(hidSkeleton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

using Bills;
using CustomControls;
using Shared;

using MEF;
using NLog;
using NonVisuals.Interfaces;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<panelUserControls:UserControlBase x:Class="DCSFlightpanels.Radios.PreProgrammed.RadioPanelPZ69UserControlYak52"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:panelUserControls="clr-namespace:DCSFlightpanels.PanelUserControls"
mc:Ignorable="d"
d:DesignHeight="750" d:DesignWidth="1000" Loaded="RadioPanelPZ69UserControlYak52_OnLoaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="240" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80*" />
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="80*" />
<ColumnDefinition Width="80*"/>
<ColumnDefinition Width="80*"/>
<ColumnDefinition Width="97*" />
<ColumnDefinition Width="301*" />
</Grid.ColumnDefinitions>
<Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="5">
<Image Height="226" Stretch="None" Source="/dcsfp;component/Images/PZ69_Radiopanel_Transp.png" />

<!-- UPPER LEFT SELECTOR -->
<Image Height="76" Name="TopLeftCom1" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="65" Canvas.Top="34" />
<Image Height="76" Name="TopLeftCom2" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="54" Canvas.Top="36" />
<Image Height="76" Name="TopLeftNav1" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="46" Canvas.Top="45" />
<Image Height="76" Name="TopLeftNav2" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="43" Canvas.Top="57" />
<Image Height="76" Name="TopLeftADF" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="46" Canvas.Top="69" />
<Image Height="76" Name="TopLeftDME" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="56" Canvas.Top="77" />
<Image Height="76" Name="TopLeftXPDR" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="66" Canvas.Top="81" />

<!-- LOWER LEFT SELECTOR -->
<Image Height="76" Name="LowerLeftCom1" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="65" Canvas.Top="112" />
<Image Height="76" Name="LowerLeftCom2" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="54" Canvas.Top="114" />
<Image Height="76" Name="LowerLeftNav1" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="45" Canvas.Top="122" />
<Image Height="76" Name="LowerLeftNav2" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="43" Canvas.Top="134" />
<Image Height="76" Name="LowerLeftADF" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="46" Canvas.Top="147" />
<Image Height="76" Name="LowerLeftDME" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="56" Canvas.Top="156" />
<Image Height="76" Name="LowerLeftXPDR" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="66" Canvas.Top="159" />

<!-- UPPER LCD KNOB -->
<Image Height="76" Name="UpperSmallerLCDKnobInc" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="484" Canvas.Top="60" />
<Image Height="76" Name="UpperSmallerLCDKnobDec" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="469" Canvas.Top="60" />
<Image Height="76" Name="UpperLargerLCDKnobInc" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="498" Canvas.Top="60" />
<Image Height="76" Name="UpperLargerLCDKnobDec" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="447" Canvas.Top="60" />

<!-- LOWER LCD KNOB -->
<Image Height="76" Name="LowerSmallerLCDKnobInc" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="484" Canvas.Top="136" />
<Image Height="76" Name="LowerSmallerLCDKnobDec" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="469" Canvas.Top="136" />
<Image Height="76" Name="LowerLargerLCDKnobInc" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="498" Canvas.Top="136" />
<Image Height="76" Name="LowerLargerLCDKnobDec" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="447" Canvas.Top="136" />

<!-- Right Switches -->
<Image Height="76" Name="UpperRightSwitch" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="562" Canvas.Top="58" />
<Image Height="76" Name="LowerRightSwitch" Source="/dcsfp;component/Images/dot.jpg" Stretch="None" Canvas.Left="562" Canvas.Top="131" />

<Button Name="ButtonGetIdentify" Content="Identify" HorizontalAlignment="Left" VerticalAlignment="Top" Width="76" Canvas.Left="430" Canvas.Top="12" Click="ButtonGetIdentify_OnClick"/>
<Button Name="ButtonGetId" Content="ID" HorizontalAlignment="Left" VerticalAlignment="Top" Width="76" Canvas.Left="520" Canvas.Top="12" Click="ButtonGetId_OnClick"/>
</Canvas>
<GroupBox Header="Selector Knobs" Name="GroupUpperSelectorKnob" FontSize="14" FontWeight="Bold" Grid.Column="0" Grid.Row="1" Grid.RowSpan="3" Grid.ColumnSpan="3" >
<StackPanel >
<TextBlock FontSize="10" FontWeight="Bold">
COM 1 VHF = <LineBreak/>
<TextBlock Margin="15,0,0,0">
Large Dial : Mhz Dial
<LineBreak/>
Small Dial : Khz Dial
<LineBreak/>
ACT/STBY + Small Dial : Volume
<LineBreak/>
ACT/STBY : Squelch ON/OFF
<LineBreak/>
</TextBlock>
</TextBlock>
<TextBlock FontSize="10" FontWeight="Bold">
ADF : FRONT ADF = <LineBreak/>
<TextBlock Margin="15,0,0,0">
Large Dial : Volume
<LineBreak/>
Small Dial : Channel
<LineBreak/>
</TextBlock>
</TextBlock>
<TextBlock FontSize="10" FontWeight="Bold">
DME : REAR ADF = <LineBreak/>
<TextBlock Margin="15,0,0,0">
Large Dial : Volume
<LineBreak/>
Small Dial : Channel
<LineBreak/>
</TextBlock>
</TextBlock>
</StackPanel>
</GroupBox>

<GroupBox Header="Settings" FontSize="10" FontWeight="Bold" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="3" Grid.RowSpan="2" >
<StackPanel >
<Label Content="Frequency Knobs sensitivity"></Label>
<ComboBox Name="ComboBoxFreqKnobSensitivity" Width="100" HorizontalAlignment="Left" Margin="5,5,0,0" SelectedIndex="0" SelectedValuePath="Content" IsReadOnly="True" SelectionChanged="ComboBoxFreqKnobSensitivity_OnSelectionChanged">
<ComboBoxItem >0</ComboBoxItem>
<ComboBoxItem >-1</ComboBoxItem>
<ComboBoxItem >-2</ComboBoxItem>
</ComboBox>
<Label Content="ACT to STBY transfer of freq. delay (ms)"></Label>
<ComboBox Name="ComboBoxSyncOKDelayTimeout" Width="100" HorizontalAlignment="Left" Margin="5,5,0,0" SelectedIndex="0" SelectedValuePath="Content" IsReadOnly="True" SelectionChanged="ComboBoxSyncOKDelayTimeout_OnSelectionChanged">
<ComboBoxItem >1000</ComboBoxItem>
<ComboBoxItem >1500</ComboBoxItem>
<ComboBoxItem >2000</ComboBoxItem>
<ComboBoxItem >2500</ComboBoxItem>
<ComboBoxItem >3000</ComboBoxItem>
<ComboBoxItem >3500</ComboBoxItem>
<ComboBoxItem >4000</ComboBoxItem>
<ComboBoxItem >5000</ComboBoxItem>
<ComboBoxItem >6000</ComboBoxItem>
<ComboBoxItem >7000</ComboBoxItem>
<ComboBoxItem >8000</ComboBoxItem>
<ComboBoxItem >9000</ComboBoxItem>
</ComboBox>
</StackPanel>
</GroupBox>

<StackPanel Grid.Column="3" Grid.Row="1" Grid.ColumnSpan="3" Grid.RowSpan="6">
<Label Content="Radio" FontWeight="Bold"/>
<Image Height="300" Source="/dcsfp;component/Images/YAK52_VHF.jpg" />
</StackPanel>
<StackPanel Grid.Column="6" Grid.Row="0" Grid.ColumnSpan="1" Grid.RowSpan="5">
<Label Name="LabelAirframe" Content="Yak-52" FontSize="30" FontWeight="Bold" Grid.Column="4" Grid.Row="0"/>
<Label Content="ADF" FontWeight="Bold"/>
<Image Height="300" Source="/dcsfp;component/Images/YAK52_ADF.jpg" />
</StackPanel>
<DockPanel Grid.Column="6" Grid.Row="4" Grid.RowSpan="3" >
<GroupBox DockPanel.Dock="Bottom" Header="Log" FontSize="10" Margin="0,0.5,0,-1">
<TextBox x:Name="TextBoxLogPZ69" VerticalScrollBarVisibility="Visible" VerticalAlignment="Stretch" TextWrapping="Wrap" HorizontalAlignment="Stretch" Height="140"/>
</GroupBox>
</DockPanel>
</Grid>
</panelUserControls:UserControlBase>
Loading

0 comments on commit 4b88b9f

Please sign in to comment.