Skip to content

Commit

Permalink
Spitfire radio use output commands, remove imports (#512)
Browse files Browse the repository at this point in the history
* Spitfire radio use output commands, remove imports

* Change comment spelling

* GamingPanel variable name change

* Spelling synch to sync

* P-51D radio uses output commands

* Mosquito radio uses output commands

* Spelling exception dicionary update

* Radios use DCSBIOSCommand class

* Spelling dictionary
  • Loading branch information
jdahlblom authored Apr 3, 2024
1 parent 16ed53a commit 5a57f95
Show file tree
Hide file tree
Showing 27 changed files with 448 additions and 466 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Tests.Common;
using Tests.Common;

namespace DCS_BIOS.Tests.Serialization.Common {
internal class RepositorySerialized : RepositorySerializedBase
Expand Down
7 changes: 7 additions & 0 deletions src/DCSFlightpanels.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<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/=AIFF/@EntryIndexedValue">AIFF</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>
Expand All @@ -10,6 +11,7 @@
<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/=BIP/@EntryIndexedValue">BIP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BIPS/@EntryIndexedValue">BIPS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BLUE/@EntryIndexedValue">BLUE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BNA/@EntryIndexedValue">BNA</s:String>
Expand Down Expand Up @@ -60,6 +62,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OLE/@EntryIndexedValue">OLE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OS/@EntryIndexedValue">OS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OSCOMMANDS/@EntryIndexedValue">OSCOMMANDS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PAN/@EntryIndexedValue">PAN</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PURPLE/@EntryIndexedValue">PURPLE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PZ/@EntryIndexedValue">PZ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RED/@EntryIndexedValue">RED</s:String>
Expand Down Expand Up @@ -90,8 +93,10 @@
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=API/@EntryIndexedValue">API</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=BIP/@EntryIndexedValue">BIP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=BIPLED/@EntryIndexedValue">BIPLED</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=CCW/@EntryIndexedValue">CCW</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=CDU/@EntryIndexedValue">CDU</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=CTRL/@EntryIndexedValue">CTRL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=CW/@EntryIndexedValue">CW</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=DCS/@EntryIndexedValue">DCS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=DCSBIOS/@EntryIndexedValue">DCSBIOS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=DME/@EntryIndexedValue">DME</s:String>
Expand All @@ -104,7 +109,9 @@
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=OK/@EntryIndexedValue">OK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=OS/@EntryIndexedValue">OS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=PZ/@EntryIndexedValue">PZ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=SRS/@EntryIndexedValue">SRS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=TPM/@EntryIndexedValue">TPM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=UC/@EntryIndexedValue">UC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=USB/@EntryIndexedValue">USB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=XPDR/@EntryIndexedValue">XPDR</s:String>
Expand Down
1 change: 0 additions & 1 deletion src/DCSFlightpanels/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ ADF AJS ALL ALT APR BIOS BIP BIPS COM CRS DB DCS DCSBIOS DCSBIOSJSON DME DRO HDG
using NonVisuals.HID;
using DCS_BIOS.Serialized;
using DCS_BIOS.ControlLocator;
using System.Windows.Threading;

public partial class MainWindow : IGamingPanelListener, IDcsBiosConnectionListener, ISettingsModifiedListener, IProfileHandlerListener, IDisposable, IHardwareConflictResolver, IPanelEventListener, IForwardPanelEventListener, IDCSBIOSStringListener
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@

<TextBlock HorizontalAlignment="Stretch" Text="Double-click in the key command boxes to erase them. Right-click to set timings." TextWrapping="Wrap" Background="#FFF5ECEC" />
<Button Content="Clear all" Height="23" HorizontalAlignment="Center" x:Name="ButtonClearAll" Width="75" Click="ButtonClearAllClick" Margin="0,20,0,0" />
<Button Content="DEV" Height="25" HorizontalAlignment="Center" Name="ButtonDEV" Width="75" Visibility="Collapsed" Click="ButtonDEV_OnClick" Margin="5,0" />
</StackPanel>
</GroupBox>

Expand Down
1 change: 0 additions & 1 deletion src/DCSFlightpanels/ProfileHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using ClassLibraryCommon;
using DCS_BIOS.ControlLocator;
using DCSFlightpanels.Properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,42 +435,7 @@ private void ComboBoxFreqKnobSensitivity_OnSelectionChangedComboBoxFreqKnobSensi
Common.ShowErrorMessageBox( ex);
}
}

private void ComboBoxSynchSleepTime_OnSelectionChangedComboBoxSynchSleepTime_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (UserControlLoaded)
{
/*Settings.Default.BAKDialSynchSleepTime = int.Parse(ComboBoxSynchSleepTime.SelectedValue.ToString());
_radioPanelPZ69.SynchSleepTime = int.Parse(ComboBoxSynchSleepTime.SelectedValue.ToString());
Settings.Default.Save();*/
}
}
catch (Exception ex)
{
Common.ShowErrorMessageBox( ex);
}
}

private void ComboBoxSynchResetTimeout_OnSelectionChangedComboBoxSynchResetTimeout_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (UserControlLoaded)
{
/*Settings.Default.BAKDialResetSyncTimeout = int.Parse(ComboBoxSynchResetTimeout.SelectedValue.ToString());
_radioPanelPZ69.ResetSyncTimeout = int.Parse(ComboBoxSynchResetTimeout.SelectedValue.ToString());
Settings.Default.Save();*/
}
}
catch (Exception ex)
{
Common.ShowErrorMessageBox( ex);
}
}



private void HideAllImages()
{
TopLeftCom1.Visibility = Visibility.Collapsed;
Expand Down
6 changes: 3 additions & 3 deletions src/NonVisuals/Panels/GamingPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class GamingPanel : IProfileHandlerListener, IDcsBiosDataListene
private Exception _lastException;
private string _randomBindingHash = string.Empty;
private uint _count;
private bool _synchedOnce;
private bool _hasSyncOnce;
protected bool Closed { get; set; }
protected bool FirstReportHasBeenRead = false;
protected readonly HIDSkeleton HIDSkeletonBase;
Expand Down Expand Up @@ -133,10 +133,10 @@ protected void UpdateCounter(uint address, uint data)
if (_updateCounterDCSBIOSOutput != null && _updateCounterDCSBIOSOutput.Address == address)
{
var newCount = _updateCounterDCSBIOSOutput.GetUIntValue(data);
if (!_synchedOnce)
if (!_hasSyncOnce)
{
_count = newCount;
_synchedOnce = true;
_hasSyncOnce = true;
return;
}

Expand Down
34 changes: 17 additions & 17 deletions src/NonVisuals/Radios/RadioPanelPZ69A10C.cs
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,12 @@ private void SendVhfAmToDCSBIOS()
_shutdownVHFAMThread = true;
Thread.Sleep(Constants.ThreadShutDownWaitTime);
_shutdownVHFAMThread = false;
_vhfAmSyncThread = new Thread(() => VhfAmSynchThreadMethod(desiredPositionDial1, desiredPositionDial2, desiredPositionDial3, desiredPositionDial4));
_vhfAmSyncThread = new Thread(() => VhfAmSyncThreadMethod(desiredPositionDial1, desiredPositionDial2, desiredPositionDial3, desiredPositionDial4));
_vhfAmSyncThread.Start();
}

private volatile bool _shutdownVHFAMThread;
private void VhfAmSynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3, int desiredPositionDial4)
private void VhfAmSyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3, int desiredPositionDial4)
{
try
{
Expand Down Expand Up @@ -967,7 +967,7 @@ private void VhfAmSynchThreadMethod(int desiredPositionDial1, int desiredPositio
Thread.Sleep(5000);
}

Thread.Sleep(SynchSleepTime); // Should be enough to get an update cycle from DCS-BIOS
Thread.Sleep(SyncSleepTime); // Should be enough to get an update cycle from DCS-BIOS
}
while ((IsTooShort(dial1OkTime) || IsTooShort(dial2OkTime) || IsTooShort(dial3OkTime) || IsTooShort(dial4OkTime)) && !_shutdownVHFAMThread);
SwapCockpitStandbyFrequencyVhfAm();
Expand Down Expand Up @@ -1136,12 +1136,12 @@ private void SendUhfToDCSBIOS()
_shutdownUHFThread = true;
Thread.Sleep(Constants.ThreadShutDownWaitTime);
_shutdownUHFThread = false;
_uhfSyncThread = new Thread(() => UhfSynchThreadMethod(freqDial1, freqDial2, freqDial3, freqDial4, freqDial5));
_uhfSyncThread = new Thread(() => UhfSyncThreadMethod(freqDial1, freqDial2, freqDial3, freqDial4, freqDial5));
_uhfSyncThread.Start();
}

private volatile bool _shutdownUHFThread;
private void UhfSynchThreadMethod(int desiredPosition1, int desiredPosition2, int desiredPosition3, int desiredPosition4, int desiredPosition5)
private void UhfSyncThreadMethod(int desiredPosition1, int desiredPosition2, int desiredPosition3, int desiredPosition4, int desiredPosition5)
{
try
{
Expand Down Expand Up @@ -1363,7 +1363,7 @@ private void UhfSynchThreadMethod(int desiredPosition1, int desiredPosition2, in
Thread.Sleep(5000);
}

Thread.Sleep(SynchSleepTime); // Should be enough to get an update cycle from DCS-BIOS
Thread.Sleep(SyncSleepTime); // Should be enough to get an update cycle from DCS-BIOS
}
while ((IsTooShort(dial1OkTime) || IsTooShort(dial2OkTime) || IsTooShort(dial3OkTime) || IsTooShort(dial4OkTime) || IsTooShort(dial5OkTime)) && !_shutdownUHFThread);
SwapCockpitStandbyFrequencyUhf();
Expand Down Expand Up @@ -1447,12 +1447,12 @@ private void SendVhfFmToDCSBIOS()
_shutdownVHFFMThread = true;
Thread.Sleep(Constants.ThreadShutDownWaitTime);
_shutdownVHFFMThread = false;
_vhfFmSyncThread = new Thread(() => VhfFmSynchThreadMethod(desiredPositionDial1, desiredPositionDial2, desiredPositionDial3, desiredPositionDial4));
_vhfFmSyncThread = new Thread(() => VhfFmSyncThreadMethod(desiredPositionDial1, desiredPositionDial2, desiredPositionDial3, desiredPositionDial4));
_vhfFmSyncThread.Start();
}

private volatile bool _shutdownVHFFMThread;
private void VhfFmSynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3, int frequencyDial4)
private void VhfFmSyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3, int frequencyDial4)
{
try
{
Expand Down Expand Up @@ -1600,7 +1600,7 @@ private void VhfFmSynchThreadMethod(int desiredPositionDial1, int desiredPositio
Thread.Sleep(5000);
}

Thread.Sleep(SynchSleepTime); // Should be enough to get an update cycle from DCS-BIOS
Thread.Sleep(SyncSleepTime); // Should be enough to get an update cycle from DCS-BIOS

}
while ((IsTooShort(dial1OkTime) || IsTooShort(dial2OkTime) || IsTooShort(dial3OkTime) || IsTooShort(dial4OkTime)) && !_shutdownVHFFMThread);
Expand Down Expand Up @@ -1653,12 +1653,12 @@ private void SendILSToDCSBIOS()
_shutdownILSThread = true;
Thread.Sleep(Constants.ThreadShutDownWaitTime);
_shutdownILSThread = false;
_ilsSyncThread = new Thread(() => ILSSynchThreadMethod(freqDial1, freqDial2));
_ilsSyncThread = new Thread(() => ILSSyncThreadMethod(freqDial1, freqDial2));
_ilsSyncThread.Start();
}

private volatile bool _shutdownILSThread;
private void ILSSynchThreadMethod(int position1, int position2)
private void ILSSyncThreadMethod(int position1, int position2)
{
try
{
Expand Down Expand Up @@ -1752,7 +1752,7 @@ private void ILSSynchThreadMethod(int position1, int position2)
Thread.Sleep(5000);
}

Thread.Sleep(SynchSleepTime); // Should be enough to get an update cycle from DCS-BIOS
Thread.Sleep(SyncSleepTime); // Should be enough to get an update cycle from DCS-BIOS
}
while ((IsTooShort(dial1OkTime) || IsTooShort(dial2OkTime)) && !_shutdownILSThread);
SwapCockpitStandbyFrequencyIls();
Expand Down Expand Up @@ -1799,12 +1799,12 @@ private void SendTacanToDCSBIOS()
_shutdownTACANThread = true;
Thread.Sleep(Constants.ThreadShutDownWaitTime);
_shutdownTACANThread = false;
_tacanSyncThread = new Thread(() => TacanSynchThreadMethod(_tacanBigFrequencyStandby, _tacanSmallFrequencyStandby, _tacanXYStandby));
_tacanSyncThread = new Thread(() => TacanSyncThreadMethod(_tacanBigFrequencyStandby, _tacanSmallFrequencyStandby, _tacanXYStandby));
_tacanSyncThread.Start();
}

private volatile bool _shutdownTACANThread;
private void TacanSynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3)
private void TacanSyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3)
{
try
{
Expand Down Expand Up @@ -1918,7 +1918,7 @@ private void TacanSynchThreadMethod(int desiredPositionDial1, int desiredPositio
Thread.Sleep(5000);
}

Thread.Sleep(SynchSleepTime); // Should be enough to get an update cycle from DCS-BIOS
Thread.Sleep(SyncSleepTime); // Should be enough to get an update cycle from DCS-BIOS


}
Expand Down Expand Up @@ -3706,7 +3706,7 @@ protected override void PZ69KnobChanged(IEnumerable<object> hashSet)
{
if (!_upperButtonPressedAndDialRotated)
{
// Do not synch if user has pressed the button to configure the radio
// Do not sync if user has pressed the button to configure the radio
// Do when user releases button
SendFrequencyToDCSBIOS(RadioPanelPZ69KnobsA10C.UPPER_FREQ_SWITCH);
}
Expand All @@ -3724,7 +3724,7 @@ protected override void PZ69KnobChanged(IEnumerable<object> hashSet)
{
if (!_lowerButtonPressedAndDialRotated)
{
// Do not synch if user has pressed the button to configure the radio
// Do not sync if user has pressed the button to configure the radio
// Do when user releases button
SendFrequencyToDCSBIOS(RadioPanelPZ69KnobsA10C.LOWER_FREQ_SWITCH);
}
Expand Down
Loading

0 comments on commit 5a57f95

Please sign in to comment.