From 687245c1e1b89c3ec20cdcb28bc55bede7b48db5 Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 2 Apr 2024 11:56:05 +0300 Subject: [PATCH 01/14] Spitfire radio use output commands, remove imports --- .../Common/RepositorySerialized.cs | 3 +- src/DCSFlightpanels/MainWindow.xaml.cs | 1 - src/DCSFlightpanels/ProfileHandler.cs | 1 - .../Radios/RadiopanelPZ69SpitfireLFMkIX.cs | 124 +++++++++--------- 4 files changed, 62 insertions(+), 67 deletions(-) diff --git a/src/DCS-BIOS.Tests/Serialization/Common/RepositorySerialized.cs b/src/DCS-BIOS.Tests/Serialization/Common/RepositorySerialized.cs index 3fe9f1e52..64d660a42 100644 --- a/src/DCS-BIOS.Tests/Serialization/Common/RepositorySerialized.cs +++ b/src/DCS-BIOS.Tests/Serialization/Common/RepositorySerialized.cs @@ -1,5 +1,4 @@ -using System; -using Tests.Common; +using Tests.Common; namespace DCS_BIOS.Tests.Serialization.Common { internal class RepositorySerialized : RepositorySerializedBase diff --git a/src/DCSFlightpanels/MainWindow.xaml.cs b/src/DCSFlightpanels/MainWindow.xaml.cs index 2cb0de5d8..4250c0aab 100644 --- a/src/DCSFlightpanels/MainWindow.xaml.cs +++ b/src/DCSFlightpanels/MainWindow.xaml.cs @@ -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 { diff --git a/src/DCSFlightpanels/ProfileHandler.cs b/src/DCSFlightpanels/ProfileHandler.cs index bae4b5d73..c7cf177c1 100644 --- a/src/DCSFlightpanels/ProfileHandler.cs +++ b/src/DCSFlightpanels/ProfileHandler.cs @@ -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; diff --git a/src/NonVisuals/Radios/RadiopanelPZ69SpitfireLFMkIX.cs b/src/NonVisuals/Radios/RadiopanelPZ69SpitfireLFMkIX.cs index f975f1b71..f61e7c2c5 100644 --- a/src/NonVisuals/Radios/RadiopanelPZ69SpitfireLFMkIX.cs +++ b/src/NonVisuals/Radios/RadiopanelPZ69SpitfireLFMkIX.cs @@ -57,20 +57,21 @@ private enum CurrentSpitfireLFMkIXRadioMode */ private readonly object _lockHFRadioPresetDialObject1 = new(); private DCSBIOSOutput _hfRadioOffDcsbiosOutput; - private DCSBIOSOutput _hfRadioChannelAPresetDcsbiosOutput; - private DCSBIOSOutput _hfRadioChannelBPresetDcsbiosOutput; - private DCSBIOSOutput _hfRadioChannelCPresetDcsbiosOutput; - private DCSBIOSOutput _hfRadioChannelDPresetDcsbiosOutput; + private DCSBIOSOutput _hfChannelAPresetOutput; + private DCSBIOSOutput _hfChannelBPresetOutput; + private DCSBIOSOutput _hfChannelCPresetOutput; + private DCSBIOSOutput _hfChannelDPresetOutput; + private DCSBIOSOutput _hfOffOutput; private volatile uint _hfRadioOffCockpitButton = 1; - private volatile uint _hfRadioChannelACockpitButton; - private volatile uint _hfRadioChannelBCockpitButton; - private volatile uint _hfRadioChannelCCockpitButton; - private volatile uint _hfRadioChannelDCockpitButton; - private readonly ClickSkipper _hfRadioChannelPresetDialSkipper = new(2); + private volatile uint _hfChannelACockpitButton; + private volatile uint _hfChannelBCockpitButton; + private volatile uint _hfChannelCCockpitButton; + private volatile uint _hfChannelDCockpitButton; + private readonly ClickSkipper _hfChannelPresetDialSkipper = new(2); private const string HF_RADIO_LIGHT_SWITCH_COMMAND = "RCTRL_DIM TOGGLE\n"; private readonly object _lockHFRadioModeDialObject1 = new(); private volatile uint _hfRadioModeCockpitDialPosition = 1; - private DCSBIOSOutput _hfRadioModeDialPresetDcsbiosOutput; + private DCSBIOSOutput _hfRadioModeDialPresetOutput; private readonly ClickSkipper _hfRadioModePresetDialSkipper = new(2); /* @@ -83,7 +84,7 @@ private enum CurrentSpitfireLFMkIXRadioMode private DCSBIOSOutput _iffDiffDcsbiosOutputDial; private volatile uint _iffBiffCockpitDialPos = 1; private volatile uint _iffDiffCockpitDialPos; - private readonly ClickSkipper _iffBiffDialSkipper = new(2); + private readonly ClickSkipper _iffBiffDialSkipper = new(2); private readonly ClickSkipper _iffDiffDialSkipper = new(2); private const string IFFB_COMMAND_INC = "IFF_B INC\n"; private const string IFFB_COMMAND_DEC = "IFF_B DEC\n"; @@ -94,7 +95,7 @@ private enum CurrentSpitfireLFMkIXRadioMode public RadioPanelPZ69SpitfireLFMkIX(HIDSkeleton hidSkeleton) : base(hidSkeleton) - {} + { } private bool _disposed; // Protected implementation of Dispose pattern. @@ -121,11 +122,12 @@ public override void InitPanel() // COM1 _hfRadioOffDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_OFF"); - _hfRadioChannelAPresetDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_A"); - _hfRadioChannelBPresetDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_B"); - _hfRadioChannelCPresetDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_C"); - _hfRadioChannelDPresetDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_D"); - _hfRadioModeDialPresetDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_T_MODE"); + _hfChannelAPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_A"); + _hfChannelBPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_B"); + _hfChannelCPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_C"); + _hfChannelDPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_D"); + _hfRadioModeDialPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_T_MODE"); + _hfOffOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_OFF"); // COM2 _iffBiffDcsbiosOutputDial = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("IFF_B"); _iffDiffDcsbiosOutputDial = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("IFF_D"); @@ -158,51 +160,51 @@ public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) } // HF Radio Channel A Button - if (_hfRadioChannelAPresetDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_hfChannelAPresetOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockHFRadioPresetDialObject1) { - _hfRadioChannelACockpitButton = _hfRadioChannelAPresetDcsbiosOutput.LastUIntValue; + _hfChannelACockpitButton = _hfChannelAPresetOutput.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } // HF Radio Channel B Button - if (_hfRadioChannelBPresetDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_hfChannelBPresetOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockHFRadioPresetDialObject1) { - _hfRadioChannelBCockpitButton = _hfRadioChannelBPresetDcsbiosOutput.LastUIntValue; + _hfChannelBCockpitButton = _hfChannelBPresetOutput.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } // HF Radio Channel C Button - if (_hfRadioChannelCPresetDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_hfChannelCPresetOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockHFRadioPresetDialObject1) { - _hfRadioChannelCCockpitButton = _hfRadioChannelCPresetDcsbiosOutput.LastUIntValue; + _hfChannelCCockpitButton = _hfChannelCPresetOutput.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } // HF Radio Channel B Button - if (_hfRadioChannelDPresetDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_hfChannelDPresetOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockHFRadioPresetDialObject1) { - _hfRadioChannelDCockpitButton = _hfRadioChannelDPresetDcsbiosOutput.LastUIntValue; + _hfChannelDCockpitButton = _hfChannelDPresetOutput.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } // HF Radio Mode - if (_hfRadioModeDialPresetDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_hfRadioModeDialPresetOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockHFRadioModeDialObject1) { - _hfRadioModeCockpitDialPosition = _hfRadioModeDialPresetDcsbiosOutput.LastUIntValue; + _hfRadioModeCockpitDialPosition = _hfRadioModeDialPresetOutput.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } @@ -327,7 +329,7 @@ protected override void PZ69KnobChanged(IEnumerable hashSet) case RadioPanelPZ69KnobsSpitfireLFMkIX.UPPER_FREQ_SWITCH: { - if (_currentLowerRadioMode == CurrentSpitfireLFMkIXRadioMode.HFRADIO) + if (_currentUpperRadioMode == CurrentSpitfireLFMkIXRadioMode.HFRADIO) { if (radioPanelKnob.IsOn) { @@ -438,7 +440,7 @@ private void AdjustFrequency(IEnumerable hashSet) case CurrentSpitfireLFMkIXRadioMode.HFRADIO: { // CHANNEL - _hfRadioChannelPresetDialSkipper.Click(GetHFRadioChannelStringCommand(true)); + _hfChannelPresetDialSkipper.Click(GetHFRadioChannelStringCommand(true)); break; } @@ -457,7 +459,7 @@ private void AdjustFrequency(IEnumerable hashSet) { case CurrentSpitfireLFMkIXRadioMode.HFRADIO: { - _hfRadioChannelPresetDialSkipper.Click(GetHFRadioChannelStringCommand(false)); + _hfChannelPresetDialSkipper.Click(GetHFRadioChannelStringCommand(false)); break; } @@ -514,7 +516,7 @@ private void AdjustFrequency(IEnumerable hashSet) { case CurrentSpitfireLFMkIXRadioMode.HFRADIO: { - _hfRadioChannelPresetDialSkipper.Click(GetHFRadioChannelStringCommand(true)); + _hfChannelPresetDialSkipper.Click(GetHFRadioChannelStringCommand(true)); break; } @@ -533,7 +535,7 @@ private void AdjustFrequency(IEnumerable hashSet) { case CurrentSpitfireLFMkIXRadioMode.HFRADIO: { - _hfRadioChannelPresetDialSkipper.Click(GetHFRadioChannelStringCommand(false)); + _hfChannelPresetDialSkipper.Click(GetHFRadioChannelStringCommand(false)); break; } @@ -588,19 +590,19 @@ private void ShowFrequenciesOnPanel() { channel = 0; } - else if (_hfRadioChannelACockpitButton == 1) + else if (_hfChannelACockpitButton == 1) { channel = 1; } - else if (_hfRadioChannelBCockpitButton == 1) + else if (_hfChannelBCockpitButton == 1) { channel = 2; } - else if (_hfRadioChannelCCockpitButton == 1) + else if (_hfChannelCCockpitButton == 1) { channel = 3; } - else if (_hfRadioChannelDCockpitButton == 1) + else if (_hfChannelDCockpitButton == 1) { channel = 4; } @@ -648,19 +650,19 @@ private void ShowFrequenciesOnPanel() { channel = 0; } - else if (_hfRadioChannelACockpitButton == 1) + else if (_hfChannelACockpitButton == 1) { channel = 1; } - else if (_hfRadioChannelBCockpitButton == 1) + else if (_hfChannelBCockpitButton == 1) { channel = 2; } - else if (_hfRadioChannelCCockpitButton == 1) + else if (_hfChannelCCockpitButton == 1) { channel = 3; } - else if (_hfRadioChannelDCockpitButton == 1) + else if (_hfChannelDCockpitButton == 1) { channel = 4; } @@ -745,54 +747,54 @@ private void SetLowerRadioMode(CurrentSpitfireLFMkIXRadioMode currentSpitfireLFM Logger.Error(ex); } } - + private string GetHFRadioChannelStringCommand(bool moveUp) { lock (_lockHFRadioPresetDialObject1) { if (moveUp) { - if ((_hfRadioOffCockpitButton == 1 || _hfRadioOffCockpitButton == 0) && _hfRadioChannelACockpitButton == 0 && _hfRadioChannelBCockpitButton == 0 - && _hfRadioChannelCCockpitButton == 0 && _hfRadioChannelDCockpitButton == 0) + if ((_hfRadioOffCockpitButton == 1 || _hfRadioOffCockpitButton == 0) && _hfChannelACockpitButton == 0 && _hfChannelBCockpitButton == 0 + && _hfChannelCCockpitButton == 0 && _hfChannelDCockpitButton == 0) { - return "RCTRL_A INC\n"; + return _hfChannelAPresetOutput.GetIncCommand(); } - if (_hfRadioChannelACockpitButton == 1) + if (_hfChannelACockpitButton == 1) { - return "RCTRL_B INC\n"; + return _hfChannelBPresetOutput.GetIncCommand(); } - if (_hfRadioChannelBCockpitButton == 1) + if (_hfChannelBCockpitButton == 1) { - return "RCTRL_C INC\n"; + return _hfChannelCPresetOutput.GetIncCommand(); } - if (_hfRadioChannelCCockpitButton == 1) + if (_hfChannelCCockpitButton == 1) { - return "RCTRL_D INC\n"; + return _hfChannelDPresetOutput.GetIncCommand(); } } else { - if (_hfRadioChannelDCockpitButton == 1) + if (_hfChannelDCockpitButton == 1) { - return "RCTRL_C INC\n"; + return _hfChannelCPresetOutput.GetIncCommand(); } - if (_hfRadioChannelCCockpitButton == 1) + if (_hfChannelCCockpitButton == 1) { - return "RCTRL_B INC\n"; + return _hfChannelBPresetOutput.GetIncCommand(); } - if (_hfRadioChannelBCockpitButton == 1) + if (_hfChannelBCockpitButton == 1) { - return "RCTRL_A INC\n"; + return _hfChannelAPresetOutput.GetIncCommand(); } - if (_hfRadioChannelACockpitButton == 1) + if (_hfChannelACockpitButton == 1) { - return "RCTRL_OFF INC\n"; + return _hfOffOutput.GetIncCommand(); } } } @@ -803,11 +805,7 @@ private string GetHFRadioModeStringCommand(bool moveUp) { lock (_lockHFRadioModeDialObject1) { - if (moveUp) - { - return "RCTRL_T_MODE " + (_hfRadioModeCockpitDialPosition + 1) + "\n"; - } - return "RCTRL_T_MODE " + (_hfRadioModeCockpitDialPosition - 1) + "\n"; + return _hfRadioModeDialPresetOutput.GetSetStateCommand(moveUp ? _hfRadioModeCockpitDialPosition + 1 : _hfRadioModeCockpitDialPosition - 1); } } From 382d1465ddbb4e00473659d3b0b870ceb3d4a3af Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 2 Apr 2024 12:14:10 +0300 Subject: [PATCH 02/14] Change comment spelling --- src/NonVisuals/Radios/RadioPanelPZ69A10C.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69F14B.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69F15E.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69F5E.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69JF17.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69T45C.cs | 4 ++-- src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs | 2 +- src/NonVisuals/Radios/RadiopanelPZ69Yak52.cs | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/NonVisuals/Radios/RadioPanelPZ69A10C.cs b/src/NonVisuals/Radios/RadioPanelPZ69A10C.cs index 62927563f..ec5a9ccad 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69A10C.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69A10C.cs @@ -3706,7 +3706,7 @@ protected override void PZ69KnobChanged(IEnumerable 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); } @@ -3724,7 +3724,7 @@ protected override void PZ69KnobChanged(IEnumerable 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); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs b/src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs index d780f0ee5..3e1246354 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs @@ -3769,7 +3769,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsA10CII.UPPER_FREQ_SWITCH); } @@ -3787,7 +3787,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsA10CII.LOWER_FREQ_SWITCH); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69F14B.cs b/src/NonVisuals/Radios/RadioPanelPZ69F14B.cs index bf3a58885..9fac8946e 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69F14B.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69F14B.cs @@ -3077,7 +3077,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsF14B.UPPER_FREQ_SWITCH); } @@ -3094,7 +3094,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsF14B.LOWER_FREQ_SWITCH); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69F15E.cs b/src/NonVisuals/Radios/RadioPanelPZ69F15E.cs index bf530b4b0..957104e79 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69F15E.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69F15E.cs @@ -656,7 +656,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 // Sync when user releases button SendFrequencyToDCSBIOS(RadioPanelKnobsF15E.UPPER_FREQ_SWITCH); } @@ -689,7 +689,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 // Sync when user releases button SendFrequencyToDCSBIOS(RadioPanelKnobsF15E.LOWER_FREQ_SWITCH); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69F5E.cs b/src/NonVisuals/Radios/RadioPanelPZ69F5E.cs index 0e36dcb17..3048757b9 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69F5E.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69F5E.cs @@ -1841,7 +1841,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsF5E.UPPER_FREQ_SWITCH); } @@ -1858,7 +1858,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsF5E.LOWER_FREQ_SWITCH); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs b/src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs index 10d60d0c4..48bf8abc8 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs @@ -1142,7 +1142,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsFA18C.UPPER_FREQ_SWITCH); } @@ -1170,7 +1170,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsFA18C.LOWER_FREQ_SWITCH); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69JF17.cs b/src/NonVisuals/Radios/RadioPanelPZ69JF17.cs index 678bdb7ef..cbbb45f15 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69JF17.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69JF17.cs @@ -641,7 +641,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 // Sync when user releases button SendFrequencyToDCSBIOS(RadioPanelKnobsJF17.UPPER_FREQ_SWITCH); } @@ -678,7 +678,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 // Sync when user releases button SendFrequencyToDCSBIOS(RadioPanelKnobsJF17.LOWER_FREQ_SWITCH); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs b/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs index b1f850466..b4c517b87 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs @@ -285,7 +285,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 DCSBIOS.Send(VHF1_RADIO_LIGHT_SWITCH_COMMAND); } @@ -305,7 +305,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 DCSBIOS.Send(VHF1_RADIO_LIGHT_SWITCH_COMMAND); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69T45C.cs b/src/NonVisuals/Radios/RadioPanelPZ69T45C.cs index f67efa712..6ac3d6769 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69T45C.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69T45C.cs @@ -2138,7 +2138,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsT45C.UPPER_FREQ_SWITCH); } @@ -2155,7 +2155,7 @@ protected override void PZ69KnobChanged(IEnumerable 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(RadioPanelPZ69KnobsT45C.LOWER_FREQ_SWITCH); } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs b/src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs index fb4309a69..0576e6534 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs @@ -303,7 +303,7 @@ public void DCSBIOSStringReceived(object sender, DCSBIOSStringDataEventArgs e) _vhfCommCockpitDial2Frequency = uint.Parse(e.StringData.Substring(4, 2)); // 975 - // Do not round this. Rounding means that the synch process thinks the frequency is OK which it isn't + // Do not round this. Rounding means that the sync process thinks the frequency is OK which it isn't if (tmp != _vhfCommCockpitDial2Frequency) { Interlocked.Increment(ref _doUpdatePanelLCD); diff --git a/src/NonVisuals/Radios/RadiopanelPZ69Yak52.cs b/src/NonVisuals/Radios/RadiopanelPZ69Yak52.cs index 645b4507e..c6761bc61 100644 --- a/src/NonVisuals/Radios/RadiopanelPZ69Yak52.cs +++ b/src/NonVisuals/Radios/RadiopanelPZ69Yak52.cs @@ -423,7 +423,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 DCSBIOS.Send(VHF_RADIO_SQUELCH_TOGGLE_COMMAND); } @@ -444,7 +444,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 DCSBIOS.Send(VHF_RADIO_SQUELCH_TOGGLE_COMMAND); } From 8dca74ff20900ba6a157525ac098d796a8f89698 Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 2 Apr 2024 12:15:43 +0300 Subject: [PATCH 03/14] GamingPanel variable name change --- src/NonVisuals/Panels/GamingPanel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NonVisuals/Panels/GamingPanel.cs b/src/NonVisuals/Panels/GamingPanel.cs index 60e94766f..d08393792 100644 --- a/src/NonVisuals/Panels/GamingPanel.cs +++ b/src/NonVisuals/Panels/GamingPanel.cs @@ -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; @@ -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; } From 3575cce8849f6a8266b5d9a7dffff65c4e30de32 Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 2 Apr 2024 12:18:57 +0300 Subject: [PATCH 04/14] Spelling synch to sync --- .../RadioPanelPZ69UserControlKa50.xaml.cs | 37 +------------------ src/NonVisuals/Radios/RadioPanelPZ69A10C.cs | 30 +++++++-------- src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs | 30 +++++++-------- src/NonVisuals/Radios/RadioPanelPZ69Base.cs | 4 +- src/NonVisuals/Radios/RadioPanelPZ69F14B.cs | 30 +++++++-------- src/NonVisuals/Radios/RadioPanelPZ69F5E.cs | 12 +++--- src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs | 6 +-- src/NonVisuals/Radios/RadioPanelPZ69Ka50.cs | 6 +-- src/NonVisuals/Radios/RadioPanelPZ69Mi24P.cs | 6 +-- src/NonVisuals/Radios/RadioPanelPZ69Mi8.cs | 12 +++--- src/NonVisuals/Radios/RadioPanelPZ69SA342.cs | 6 +-- src/NonVisuals/Radios/RadioPanelPZ69T45C.cs | 24 ++++++------ src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs | 34 ++++++++--------- 13 files changed, 101 insertions(+), 136 deletions(-) diff --git a/src/DCSFlightpanels/Radios/PreProgrammed/RadioPanelPZ69UserControlKa50.xaml.cs b/src/DCSFlightpanels/Radios/PreProgrammed/RadioPanelPZ69UserControlKa50.xaml.cs index cb93e05d5..7ee1a11c3 100644 --- a/src/DCSFlightpanels/Radios/PreProgrammed/RadioPanelPZ69UserControlKa50.xaml.cs +++ b/src/DCSFlightpanels/Radios/PreProgrammed/RadioPanelPZ69UserControlKa50.xaml.cs @@ -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; diff --git a/src/NonVisuals/Radios/RadioPanelPZ69A10C.cs b/src/NonVisuals/Radios/RadioPanelPZ69A10C.cs index ec5a9ccad..8ea223756 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69A10C.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69A10C.cs @@ -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 { @@ -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(); @@ -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 { @@ -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(); @@ -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 { @@ -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); @@ -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 { @@ -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(); @@ -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 { @@ -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 } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs b/src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs index 3e1246354..11afe7065 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69A10CII.cs @@ -865,12 +865,12 @@ private void SendARC210VhfToDCSBIOS() _shutdownARC210VHFThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownARC210VHFThread = false; - _arc210VhfSyncThread = new Thread(() => ARC210VhfSynchThreadMethod(desiredPositionDial1, desiredPositionDial2, desiredPositionDial3, desiredPositionDial4, desiredPositionDial5)); + _arc210VhfSyncThread = new Thread(() => ARC210VhfSyncThreadMethod(desiredPositionDial1, desiredPositionDial2, desiredPositionDial3, desiredPositionDial4, desiredPositionDial5)); _arc210VhfSyncThread.Start(); } private volatile bool _shutdownARC210VHFThread; - private void ARC210VhfSynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3, int desiredPositionDial4, int desiredPositionDial5) + private void ARC210VhfSyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3, int desiredPositionDial4, int desiredPositionDial5) { try { @@ -1051,7 +1051,7 @@ private void ARC210VhfSynchThreadMethod(int desiredPositionDial1, int desiredPos 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)) && !_shutdownARC210VHFThread); @@ -1221,12 +1221,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 { @@ -1448,7 +1448,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(); @@ -1532,12 +1532,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 { @@ -1685,7 +1685,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); @@ -1738,12 +1738,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 { @@ -1837,7 +1837,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(); @@ -1884,12 +1884,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 { @@ -2003,7 +2003,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 } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69Base.cs b/src/NonVisuals/Radios/RadioPanelPZ69Base.cs index 72d764799..bed8cdf34 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69Base.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69Base.cs @@ -37,10 +37,10 @@ public abstract class RadioPanelPZ69Base : SaitekPanel protected bool DataHasBeenReceivedFromDCSBIOS; /// - /// IMPORTANT WHEN SYNCHING DIALS + /// IMPORTANT WHEN SYNCING DIALS /// MSDN (DateTime.Now.Ticks : There are 10,000 ticks in a millisecond /// - public int SynchSleepTime { get; set; } = 300; + public int SyncSleepTime { get; set; } = 300; public long ResetSyncTimeout { get; set; } = 35000000; private long _syncOKDelayTimeout = 50000000; // 5s diff --git a/src/NonVisuals/Radios/RadioPanelPZ69F14B.cs b/src/NonVisuals/Radios/RadioPanelPZ69F14B.cs index 9fac8946e..80e599bbc 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69F14B.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69F14B.cs @@ -755,12 +755,12 @@ private void SendUHFToDCSBIOS() _shutdownUHFThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownUHFThread = false; - _uhfSyncThread = new Thread(() => UHFSynchThreadMethod(desiredDial1Value, desiredDial2Value, desiredDial3Value, desiredDial4Value)); + _uhfSyncThread = new Thread(() => UHFSyncThreadMethod(desiredDial1Value, desiredDial2Value, desiredDial3Value, desiredDial4Value)); _uhfSyncThread.Start(); } private volatile bool _shutdownUHFThread; - private void UHFSynchThreadMethod(int desiredValueDial1, int desiredValueDial2, int desiredValueDial3, int desiredValueDial4) + private void UHFSyncThreadMethod(int desiredValueDial1, int desiredValueDial2, int desiredValueDial3, int desiredValueDial4) { try { @@ -892,7 +892,7 @@ private void UHFSynchThreadMethod(int desiredValueDial1, int desiredValueDial2, 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)) && !_shutdownUHFThread); @@ -950,12 +950,12 @@ private void SendVUHFToDCSBIOS() _shutdownVUHFThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownVUHFThread = false; - _vuhfSyncThread = new Thread(() => VUHFSynchThreadMethod(desiredDial1Value, desiredDial2Value, desiredDial3Value, desiredDial4Value)); + _vuhfSyncThread = new Thread(() => VUHFSyncThreadMethod(desiredDial1Value, desiredDial2Value, desiredDial3Value, desiredDial4Value)); _vuhfSyncThread.Start(); } private volatile bool _shutdownVUHFThread; - private void VUHFSynchThreadMethod(int desiredValueDial1, int desiredValueDial2, int desiredValueDial3, int desiredValueDial4) + private void VUHFSyncThreadMethod(int desiredValueDial1, int desiredValueDial2, int desiredValueDial3, int desiredValueDial4) { try { @@ -1086,7 +1086,7 @@ private void VUHFSynchThreadMethod(int desiredValueDial1, int desiredValueDial2, dial4SendCount = 0; 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)) && !_shutdownVUHFThread); SwapCockpitStandbyFrequencyVuhf(); @@ -1119,12 +1119,12 @@ private void SendLink4ToDCSBIOS() _shutdownRIOLink4Thread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownRIOLink4Thread = false; - _rioLink4SyncThread = new Thread(() => RioDatalink4SynchThreadMethod(_rioLink4HundredsFrequencyStandby, dial2, dial3)); + _rioLink4SyncThread = new Thread(() => RioDatalink4SyncThreadMethod(_rioLink4HundredsFrequencyStandby, dial2, dial3)); _rioLink4SyncThread.Start(); } private volatile bool _shutdownRIOLink4Thread; - private void RioDatalink4SynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3) + private void RioDatalink4SyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3) { try { @@ -1227,7 +1227,7 @@ private void RioDatalink4SynchThreadMethod(int desiredPositionDial1, int desired dial3SendCount = 0; 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)) && !_shutdownRIOLink4Thread); SwapCockpitStandbyFrequencyDataLink4(); @@ -1273,12 +1273,12 @@ private void SendPilotTacanToDCSBIOS() _shutdownPilotTACANThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownPilotTACANThread = false; - _pilotTacanSyncThread = new Thread(() => PilotTacanSynchThreadMethod(_pilotTacanTensFrequencyStandby, _pilotTacanOnesFrequencyStandby, _pilotTacanXYStandby)); + _pilotTacanSyncThread = new Thread(() => PilotTacanSyncThreadMethod(_pilotTacanTensFrequencyStandby, _pilotTacanOnesFrequencyStandby, _pilotTacanXYStandby)); _pilotTacanSyncThread.Start(); } private volatile bool _shutdownPilotTACANThread; - private void PilotTacanSynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3) + private void PilotTacanSyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3) { try { @@ -1384,7 +1384,7 @@ private void PilotTacanSynchThreadMethod(int desiredPositionDial1, int desiredPo dial3SendCount = 0; 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)) && !_shutdownPilotTACANThread); SwapPilotCockpitStandbyFrequencyTacan(); @@ -1416,12 +1416,12 @@ private void SendRioTacanToDCSBIOS() _shutdownRIOTACANThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownRIOTACANThread = false; - _rioTacanSyncThread = new Thread(() => RioTacanSynchThreadMethod(_rioTacanTensFrequencyStandby, _rioTacanOnesFrequencyStandby, _rioTacanXYStandby)); + _rioTacanSyncThread = new Thread(() => RioTacanSyncThreadMethod(_rioTacanTensFrequencyStandby, _rioTacanOnesFrequencyStandby, _rioTacanXYStandby)); _rioTacanSyncThread.Start(); } private volatile bool _shutdownRIOTACANThread; - private void RioTacanSynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3) + private void RioTacanSyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2, int desiredPositionDial3) { try { @@ -1528,7 +1528,7 @@ private void RioTacanSynchThreadMethod(int desiredPositionDial1, int desiredPosi dial3SendCount = 0; 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)) && !_shutdownRIOTACANThread); SwapRioCockpitStandbyFrequencyTacan(); diff --git a/src/NonVisuals/Radios/RadioPanelPZ69F5E.cs b/src/NonVisuals/Radios/RadioPanelPZ69F5E.cs index 3048757b9..60c074b94 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69F5E.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69F5E.cs @@ -470,12 +470,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 { @@ -697,7 +697,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(); @@ -744,12 +744,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 { @@ -862,7 +862,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 } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs b/src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs index 48bf8abc8..d3d3ce113 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69FA18C.cs @@ -316,12 +316,12 @@ private void SendILSToDCSBIOS() _shutdownILSThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownILSThread = false; - _ilsSyncThread = new Thread(() => ILSSynchThreadMethod(_ilsChannelStandby)); + _ilsSyncThread = new Thread(() => ILSSyncThreadMethod(_ilsChannelStandby)); _ilsSyncThread.Start(); } private volatile bool _shutdownILSThread; - private void ILSSynchThreadMethod(uint standbyPosition) + private void ILSSyncThreadMethod(uint standbyPosition) { try { @@ -377,7 +377,7 @@ private void ILSSynchThreadMethod(uint standbyPosition) 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(dialOkTime) && !_shutdownILSThread); diff --git a/src/NonVisuals/Radios/RadioPanelPZ69Ka50.cs b/src/NonVisuals/Radios/RadioPanelPZ69Ka50.cs index eb4168495..722d423e0 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69Ka50.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69Ka50.cs @@ -447,7 +447,7 @@ private void SendR800L1ToDCSBIOS() _shutdownR800L1Thread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownR800L1Thread = false; - _r800L1SyncThread = new Thread(() => R800L1SynchThreadMethod()); + _r800L1SyncThread = new Thread(() => R800L1SyncThreadMethod()); _r800L1SyncThread.Start(); } catch (Exception ex) @@ -457,7 +457,7 @@ private void SendR800L1ToDCSBIOS() } private volatile bool _shutdownR800L1Thread; - private void R800L1SynchThreadMethod() + private void R800L1SyncThreadMethod() { try { @@ -646,7 +646,7 @@ private void R800L1SynchThreadMethod() 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)) && !_shutdownR800L1Thread); diff --git a/src/NonVisuals/Radios/RadioPanelPZ69Mi24P.cs b/src/NonVisuals/Radios/RadioPanelPZ69Mi24P.cs index 6ba733957..57345f0c0 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69Mi24P.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69Mi24P.cs @@ -536,7 +536,7 @@ private void SendYaDRO1AToDCSBIOS() _shutdownYaDRO1AThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownYaDRO1AThread = false; - _yadro1ASyncThread = new Thread(() => YaDRO1ASynchThreadMethod()); + _yadro1ASyncThread = new Thread(() => YaDRO1ASyncThreadMethod()); _yadro1ASyncThread.Start(); } catch (Exception ex) @@ -546,7 +546,7 @@ private void SendYaDRO1AToDCSBIOS() } private volatile bool _shutdownYaDRO1AThread; - private void YaDRO1ASynchThreadMethod() + private void YaDRO1ASyncThreadMethod() { try { @@ -697,7 +697,7 @@ private void YaDRO1ASynchThreadMethod() { dial4OkTime = DateTime.Now.Ticks; } - 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)) && !_shutdownYaDRO1AThread); SwapCockpitStandbyFrequencyYaDRO1A(); diff --git a/src/NonVisuals/Radios/RadioPanelPZ69Mi8.cs b/src/NonVisuals/Radios/RadioPanelPZ69Mi8.cs index 56c56434c..b043c8f03 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69Mi8.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69Mi8.cs @@ -719,7 +719,7 @@ private void SendR863ManualToDCSBIOS() _shutdownR863Thread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownR863Thread = false; - _r863ManualSyncThread = new Thread(R863ManualSynchThreadMethod); + _r863ManualSyncThread = new Thread(R863ManualSyncThreadMethod); _r863ManualSyncThread.Start(); } catch (Exception ex) @@ -729,7 +729,7 @@ private void SendR863ManualToDCSBIOS() } private volatile bool _shutdownR863Thread; - private void R863ManualSynchThreadMethod() + private void R863ManualSyncThreadMethod() { try { @@ -930,7 +930,7 @@ So only go down with it 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)) && !_shutdownR863Thread); } @@ -986,7 +986,7 @@ private void SendYaDRO1AToDCSBIOS() _shutdownYaDRO1AThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownYaDRO1AThread = false; - _yadro1ASyncThread = new Thread(YaDRO1ASynchThreadMethod); + _yadro1ASyncThread = new Thread(YaDRO1ASyncThreadMethod); _yadro1ASyncThread.Start(); } catch (Exception ex) @@ -995,7 +995,7 @@ private void SendYaDRO1AToDCSBIOS() } } - private void YaDRO1ASynchThreadMethod() + private void YaDRO1ASyncThreadMethod() { try { @@ -1154,7 +1154,7 @@ private void YaDRO1ASynchThreadMethod() dial4OkTime = DateTime.Now.Ticks; } - 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)) && !_shutdownYaDRO1AThread); diff --git a/src/NonVisuals/Radios/RadioPanelPZ69SA342.cs b/src/NonVisuals/Radios/RadioPanelPZ69SA342.cs index ee267e3fc..062c7c7b8 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69SA342.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69SA342.cs @@ -456,11 +456,11 @@ private void SendVhfAmToDCSBIOS() _shutdownVHFAMThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownVHFAMThread = false; - _vhfAmSyncThread = new Thread(() => VhfAmSynchThreadMethod(desiredPositionDialWholeNumbers, desiredPositionDecimals)); + _vhfAmSyncThread = new Thread(() => VhfAmSyncThreadMethod(desiredPositionDialWholeNumbers, desiredPositionDecimals)); _vhfAmSyncThread.Start(); } - private void VhfAmSynchThreadMethod(int desiredPositionDialWholeNumbers, int desiredPositionDialDecimals) + private void VhfAmSyncThreadMethod(int desiredPositionDialWholeNumbers, int desiredPositionDialDecimals) { try { @@ -565,7 +565,7 @@ private void VhfAmSynchThreadMethod(int desiredPositionDialWholeNumbers, int des 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(dial1Time) || IsTooShort(dial2Time)) && !_shutdownVHFAMThread); diff --git a/src/NonVisuals/Radios/RadioPanelPZ69T45C.cs b/src/NonVisuals/Radios/RadioPanelPZ69T45C.cs index 6ac3d6769..f2096d65d 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69T45C.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69T45C.cs @@ -526,12 +526,12 @@ private void SendVUHF1ToDCSBIOS() _shutdownVUHF1Thread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownVUHF1Thread = false; - _vuhf1SyncThread = new Thread(() => VUHF1SynchThreadMethod(desiredDial1Value, desiredDial2Value, desiredDial3Value, desiredDial4Value)); + _vuhf1SyncThread = new Thread(() => VUHF1SyncThreadMethod(desiredDial1Value, desiredDial2Value, desiredDial3Value, desiredDial4Value)); _vuhf1SyncThread.Start(); } private volatile bool _shutdownVUHF1Thread; - private void VUHF1SynchThreadMethod(int desiredValueDial1, int desiredValueDial2, int desiredValueDial3, int desiredValueDial4) + private void VUHF1SyncThreadMethod(int desiredValueDial1, int desiredValueDial2, int desiredValueDial3, int desiredValueDial4) { try { @@ -662,7 +662,7 @@ private void VUHF1SynchThreadMethod(int desiredValueDial1, int desiredValueDial2 dial4SendCount = 0; 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)) && !_shutdownVUHF1Thread); SwapCockpitStandbyFrequencyVuhf1(); @@ -719,12 +719,12 @@ private void SendVUHF2ToDCSBIOS() _shutdownVUHF2Thread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownVUHF2Thread = false; - _vuhf2SyncThread = new Thread(() => VUHF2SynchThreadMethod(desiredDial1Value, desiredDial2Value, desiredDial3Value, desiredDial4Value)); + _vuhf2SyncThread = new Thread(() => VUHF2SyncThreadMethod(desiredDial1Value, desiredDial2Value, desiredDial3Value, desiredDial4Value)); _vuhf2SyncThread.Start(); } private volatile bool _shutdownVUHF2Thread; - private void VUHF2SynchThreadMethod(int desiredValueDial1, int desiredValueDial2, int desiredValueDial3, int desiredValueDial4) + private void VUHF2SyncThreadMethod(int desiredValueDial1, int desiredValueDial2, int desiredValueDial3, int desiredValueDial4) { try { @@ -855,7 +855,7 @@ private void VUHF2SynchThreadMethod(int desiredValueDial1, int desiredValueDial2 dial4SendCount = 0; 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)) && !_shutdownVUHF2Thread); SwapCockpitStandbyFrequencyVuhf2(); @@ -897,12 +897,12 @@ private void SendTacanToDCSBIOS() _shutdownTACANThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownTACANThread = false; - _tacanSyncThread = new Thread(() => TacanSynchThreadMethod(_tacanTensFrequencyStandby, _tacanOnesFrequencyStandby)); + _tacanSyncThread = new Thread(() => TacanSyncThreadMethod(_tacanTensFrequencyStandby, _tacanOnesFrequencyStandby)); _tacanSyncThread.Start(); } private volatile bool _shutdownTACANThread; - private void TacanSynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2) + private void TacanSyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2) { try { @@ -977,7 +977,7 @@ private void TacanSynchThreadMethod(int desiredPositionDial1, int desiredPositio dial2SendCount = 0; 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)) && !_shutdownTACANThread); SwapCockpitStandbyFrequencyTacan(); @@ -1009,12 +1009,12 @@ private void SendVorToDCSBIOS() _shutdownVORThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownVORThread = false; - _vorSyncThread = new Thread(() => VorSynchThreadMethod(_vorMhzFrequencyStandby, _vorKhzFrequencyStandby)); + _vorSyncThread = new Thread(() => VorSyncThreadMethod(_vorMhzFrequencyStandby, _vorKhzFrequencyStandby)); _vorSyncThread.Start(); } private volatile bool _shutdownVORThread; - private void VorSynchThreadMethod(int desiredPositionDial1, int desiredPositionDial2) + private void VorSyncThreadMethod(int desiredPositionDial1, int desiredPositionDial2) { try { @@ -1091,7 +1091,7 @@ private void VorSynchThreadMethod(int desiredPositionDial1, int desiredPositionD dial2SendCount = 0; 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)) && !_shutdownVORThread); SwapStandbyFrequencyVor(); diff --git a/src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs b/src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs index 0576e6534..6ef893dcc 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69UH1H.cs @@ -689,11 +689,11 @@ private void SendIntercommToDCSBIOS() _intercommSyncThread.Aborttt(); } - _intercommSyncThread = new Thread(IntercommSynchThreadMethod); + _intercommSyncThread = new Thread(IntercommSyncThreadMethod); _intercommSyncThread.Start(); } - private void IntercommSynchThreadMethod() + private void IntercommSyncThreadMethod() { try { @@ -782,12 +782,12 @@ private void SendVhfCommToDCSBIOS() _shutdownVHFCommThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownVHFCommThread = false; - _vhfCommSyncThread = new Thread(VhfCommSynchThreadMethod); + _vhfCommSyncThread = new Thread(VhfCommSyncThreadMethod); _vhfCommSyncThread.Start(); } private volatile bool _shutdownVHFCommThread; - private void VhfCommSynchThreadMethod() + private void VhfCommSyncThreadMethod() { try { @@ -868,7 +868,7 @@ private void VhfCommSynchThreadMethod() 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)) && !_shutdownVHFCommThread); @@ -913,12 +913,12 @@ private void SendUhfToDCSBIOS() _shutdownUHFThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownUHFThread = false; - _uhfSyncThread = new Thread(UhfSynchThreadMethod); + _uhfSyncThread = new Thread(UhfSyncThreadMethod); _uhfSyncThread.Start(); } private volatile bool _shutdownUHFThread; - private void UhfSynchThreadMethod() + private void UhfSyncThreadMethod() { try { @@ -1037,7 +1037,7 @@ private void UhfSynchThreadMethod() 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)) && !_shutdownUHFThread); @@ -1070,12 +1070,12 @@ private void SendVhfNavToDCSBIOS() _shutdownVHFNavThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownVHFNavThread = false; - _vhfNavSyncThread = new Thread(VhfNavSynchThreadMethod); + _vhfNavSyncThread = new Thread(VhfNavSyncThreadMethod); _vhfNavSyncThread.Start(); } private volatile bool _shutdownVHFNavThread; - private void VhfNavSynchThreadMethod() + private void VhfNavSyncThreadMethod() { try { @@ -1166,7 +1166,7 @@ private void VhfNavSynchThreadMethod() 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)) && !_shutdownVHFNavThread); @@ -1199,11 +1199,11 @@ private void SendVhfFmToDCSBIOS() _shutdownVHFFMThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownVHFFMThread = false; - _vhfFmSyncThread = new Thread(VhfFmSynchThreadMethod); + _vhfFmSyncThread = new Thread(VhfFmSyncThreadMethod); _vhfFmSyncThread.Start(); } - private void VhfFmSynchThreadMethod() + private void VhfFmSyncThreadMethod() { try { @@ -1414,7 +1414,7 @@ private void VhfFmSynchThreadMethod() dial4SendCount = 0; 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); @@ -1441,12 +1441,12 @@ private void SendAdfBandChangeToDCSBIOS() _shutdownADFThread = true; Thread.Sleep(Constants.ThreadShutDownWaitTime); _shutdownADFThread = false; - _adfSyncThread = new Thread(AdfBandChangeSynchThreadMethod); + _adfSyncThread = new Thread(AdfBandChangeSyncThreadMethod); _adfSyncThread.Start(); } private volatile bool _shutdownADFThread; - private void AdfBandChangeSynchThreadMethod() + private void AdfBandChangeSyncThreadMethod() { try { @@ -1532,7 +1532,7 @@ private void AdfBandChangeSynchThreadMethod() 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 if (once) { From 85632af8c258efccd8f95a6a10a347ee173ca95c Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 2 Apr 2024 12:33:20 +0300 Subject: [PATCH 05/14] P-51D radio uses output commands --- src/DCSFPCommon | 2 +- src/NonVisuals/Radios/RadioPanelPZ69P51D.cs | 226 +++++++++----------- 2 files changed, 106 insertions(+), 122 deletions(-) diff --git a/src/DCSFPCommon b/src/DCSFPCommon index 29b6342cb..1687d481c 160000 --- a/src/DCSFPCommon +++ b/src/DCSFPCommon @@ -1 +1 @@ -Subproject commit 29b6342cbc86388097324976c368b1b3cd12fcdf +Subproject commit 1687d481c5d2e27df31000d1d849ff19a1bb798d diff --git a/src/NonVisuals/Radios/RadioPanelPZ69P51D.cs b/src/NonVisuals/Radios/RadioPanelPZ69P51D.cs index 139d8e891..416f46289 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69P51D.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69P51D.cs @@ -47,19 +47,19 @@ private enum CurrentP51DRadioMode // Large dial : Radio Mode // Small dial : Channel private readonly object _lockVhf1DialObject1 = new(); - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton0; - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton1; - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton2; - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton3; - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton4; - private volatile uint _vhf1CockpitPresetActiveButton; - private const string VHF1_VOLUME_KNOB_COMMAND_INC = "RADIO_VOLUME +2000\n"; - private const string VHF1_VOLUME_KNOB_COMMAND_DEC = "RADIO_VOLUME -2000\n"; + private DCSBIOSOutput _vhfOffOutput; + private DCSBIOSOutput _vhfChannelAOutput; + private DCSBIOSOutput _vhfChannelBOutput; + private DCSBIOSOutput _vhfChannelCOutput; + private DCSBIOSOutput _vhfChannelDOutput; + private volatile uint _vhfCockpitPresetActiveButton; + private DCSBIOSOutput _vhfVolumeOutput; + private const int VHF_VOLUME_CHANGE_VALUE = 2000; private readonly object _lockVHFRadioModeDialObject1 = new(); - private volatile uint _vhfRadioModeCockpitDial1Position = 1; - private DCSBIOSOutput _vhf1RadioModeDial1PresetDcsbiosOutput; - private volatile uint _vhfRadioModeCockpitDial2Position = 1; - private DCSBIOSOutput _vhf1RadioModeDial2PresetDcsbiosOutput; + private DCSBIOSOutput _vhfMode2Output; + private volatile uint _vhfMode2CockpitDialPosition = 1; + private DCSBIOSOutput _vhfMode3Output; + private volatile uint _vhfMode3CockpitDialPosition = 1; private readonly ClickSkipper _vhfRadioDialSkipper = new(2); private const string VHF_RADIO_LIGHT_SWITCH_COMMAND = "RADIO_LIGHTS_DIMMER TOGGLE\n"; @@ -111,13 +111,15 @@ public override void InitPanel() CreateRadioKnobs(); // VHF - _vhf1DcsbiosOutputPresetButton0 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_ON_OFF"); - _vhf1DcsbiosOutputPresetButton1 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_A"); - _vhf1DcsbiosOutputPresetButton2 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_B"); - _vhf1DcsbiosOutputPresetButton3 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_C"); - _vhf1DcsbiosOutputPresetButton4 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_D"); - _vhf1RadioModeDial1PresetDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_MODE2"); - _vhf1RadioModeDial2PresetDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_MODE3"); + _vhfOffOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_ON_OFF"); + _vhfChannelAOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_A"); + _vhfChannelBOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_B"); + _vhfChannelCOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_C"); + _vhfChannelDOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_D"); + _vhfMode2Output = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_MODE2"); + _vhfMode3Output = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_MODE3"); + _vhfVolumeOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_VOLUME"); + // LF DETROLA _lfRadioFrequencyDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("DETROLA_FREQUENCY"); _lfRadioVolumeDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("DETROLA_VOLUME"); @@ -141,91 +143,91 @@ public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) */ // VHF On Off - if (_vhf1DcsbiosOutputPresetButton0.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfOffOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton0.LastUIntValue == 1) + if (_vhfOffOutput.LastUIntValue == 1) { // Radio is off - _vhf1CockpitPresetActiveButton = 0; + _vhfCockpitPresetActiveButton = 0; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF A - if (_vhf1DcsbiosOutputPresetButton1.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfChannelAOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton1.LastUIntValue == 1) + if (_vhfChannelAOutput.LastUIntValue == 1) { // Radio is on A - _vhf1CockpitPresetActiveButton = 1; + _vhfCockpitPresetActiveButton = 1; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF B - if (_vhf1DcsbiosOutputPresetButton2.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfChannelBOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton2.LastUIntValue == 1) + if (_vhfChannelBOutput.LastUIntValue == 1) { // Radio is on A - _vhf1CockpitPresetActiveButton = 2; + _vhfCockpitPresetActiveButton = 2; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF C - if (_vhf1DcsbiosOutputPresetButton3.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfChannelCOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton3.LastUIntValue == 1) + if (_vhfChannelCOutput.LastUIntValue == 1) { // Radio is on A - _vhf1CockpitPresetActiveButton = 3; + _vhfCockpitPresetActiveButton = 3; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF D - if (_vhf1DcsbiosOutputPresetButton4.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfChannelDOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton4.LastUIntValue == 1) + if (_vhfChannelDOutput.LastUIntValue == 1) { // Radio is on A - _vhf1CockpitPresetActiveButton = 4; + _vhfCockpitPresetActiveButton = 4; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF MODE 1 - if (_vhf1RadioModeDial1PresetDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfMode2Output.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - _vhfRadioModeCockpitDial1Position = _vhf1RadioModeDial1PresetDcsbiosOutput.LastUIntValue; + _vhfMode2CockpitDialPosition = _vhfMode2Output.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF MODE 2 - if (_vhf1RadioModeDial2PresetDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfMode3Output.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - _vhfRadioModeCockpitDial2Position = _vhf1RadioModeDial2PresetDcsbiosOutput.LastUIntValue; + _vhfMode3CockpitDialPosition = _vhfMode3Output.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } @@ -357,7 +359,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 DCSBIOS.Send(VHF_RADIO_LIGHT_SWITCH_COMMAND); } @@ -377,7 +379,7 @@ protected override void PZ69KnobChanged(IEnumerable 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 DCSBIOS.Send(VHF_RADIO_LIGHT_SWITCH_COMMAND); } @@ -465,7 +467,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(VHF1_VOLUME_KNOB_COMMAND_INC); + DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); } else if (!_vhfRadioDialSkipper.ShouldSkip()) { @@ -491,7 +493,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(VHF1_VOLUME_KNOB_COMMAND_DEC); + DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE * -1)); } else if (!_vhfRadioDialSkipper.ShouldSkip()) { @@ -553,7 +555,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(VHF1_VOLUME_KNOB_COMMAND_INC); + DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); } else if (!_vhfRadioDialSkipper.ShouldSkip()) { @@ -579,7 +581,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(VHF1_VOLUME_KNOB_COMMAND_DEC); + DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE * -1)); } else if (!_vhfRadioDialSkipper.ShouldSkip()) { @@ -643,10 +645,10 @@ private void ShowFrequenciesOnPanel() string channelAsString; lock (_lockVhf1DialObject1) { - channelAsString = _vhf1CockpitPresetActiveButton.ToString(); + channelAsString = _vhfCockpitPresetActiveButton.ToString(); } - SetPZ69DisplayBytesUnsignedInteger(ref bytes, _vhfRadioModeCockpitDial1Position, PZ69LCDPosition.UPPER_ACTIVE_LEFT); + SetPZ69DisplayBytesUnsignedInteger(ref bytes, _vhfMode2CockpitDialPosition, PZ69LCDPosition.UPPER_ACTIVE_LEFT); SetPZ69DisplayBytesUnsignedInteger(ref bytes, Convert.ToUInt32(channelAsString), PZ69LCDPosition.UPPER_STBY_RIGHT); break; } @@ -681,10 +683,10 @@ private void ShowFrequenciesOnPanel() string channelAsString; lock (_lockVhf1DialObject1) { - channelAsString = _vhf1CockpitPresetActiveButton.ToString(); + channelAsString = _vhfCockpitPresetActiveButton.ToString(); } - SetPZ69DisplayBytesUnsignedInteger(ref bytes, _vhfRadioModeCockpitDial1Position, PZ69LCDPosition.LOWER_ACTIVE_LEFT); + SetPZ69DisplayBytesUnsignedInteger(ref bytes, _vhfMode2CockpitDialPosition, PZ69LCDPosition.LOWER_ACTIVE_LEFT); SetPZ69DisplayBytesUnsignedInteger(ref bytes, Convert.ToUInt32(channelAsString), PZ69LCDPosition.LOWER_STBY_RIGHT); break; } @@ -721,29 +723,29 @@ private void SendIncVHFPresetCommand() Interlocked.Increment(ref _doUpdatePanelLCD); lock (_lockVhf1DialObject1) { - switch (_vhf1CockpitPresetActiveButton) + switch (_vhfCockpitPresetActiveButton) { case 0: { - DCSBIOS.Send("VHF_RADIO_CHAN_A 1\n"); + DCSBIOS.Send(_vhfChannelAOutput.GetIncCommand()); break; } case 1: { - DCSBIOS.Send("VHF_RADIO_CHAN_B 1\n"); + DCSBIOS.Send(_vhfChannelBOutput.GetIncCommand()); break; } case 2: { - DCSBIOS.Send("VHF_RADIO_CHAN_C 1\n"); + DCSBIOS.Send(_vhfChannelCOutput.GetIncCommand()); break; } case 3: { - DCSBIOS.Send("VHF_RADIO_CHAN_D 1\n"); + DCSBIOS.Send(_vhfChannelDOutput.GetIncCommand()); break; } @@ -755,7 +757,45 @@ private void SendIncVHFPresetCommand() } } + private void SendDecVHFPresetCommand() + { + Interlocked.Increment(ref _doUpdatePanelLCD); + lock (_lockVhf1DialObject1) + { + switch (_vhfCockpitPresetActiveButton) + { + case 0: + { + break; + } + + case 1: + { + DCSBIOS.Send(_vhfOffOutput.GetIncCommand()); + break; + } + + case 2: + { + DCSBIOS.Send(_vhfChannelAOutput.GetIncCommand()); + break; + } + + case 3: + { + DCSBIOS.Send(_vhfChannelBOutput.GetIncCommand()); + break; + } + case 4: + { + DCSBIOS.Send(_vhfChannelCOutput.GetIncCommand()); + break; + } + } + } + } + private void SendLFFrequencyCommand(bool increase) { DCSBIOS.Send(GetDetrolaFrequencyStringCommand(increase, _lfFrequencyDialChangeMonitor.ClickAndCheck() ? _lfFrequencyChangeValue * 10 : _lfFrequencyChangeValue)); @@ -813,64 +853,25 @@ private string GetHFRadioModeStringCommand(bool moveUp) */ if (moveUp) { - return _vhfRadioModeCockpitDial1Position switch + return _vhfMode2CockpitDialPosition switch { - 0 => "RADIO_MODE3 DEC\n", - 1 => "RADIO_MODE2 INC\n", + 0 => _vhfMode3Output.GetDecCommand(), + 1 => _vhfMode2Output.GetIncCommand(), 2 => null, _ => null }; } - return _vhfRadioModeCockpitDial1Position switch + return _vhfMode2CockpitDialPosition switch { 0 => null, - 1 => "RADIO_MODE3 DEC\n", - 2 => "RADIO_MODE3 DEC\n RADIO_MODE3 DEC\n", + 1 => _vhfMode3Output.GetDecCommand(), + 2 => _vhfMode3Output.GetDecCommand() + _vhfMode3Output.GetDecCommand(), _ => null }; } } - private void SendDecVHFPresetCommand() - { - Interlocked.Increment(ref _doUpdatePanelLCD); - lock (_lockVhf1DialObject1) - { - switch (_vhf1CockpitPresetActiveButton) - { - case 0: - { - break; - } - - case 1: - { - DCSBIOS.Send("VHF_RADIO_ON_OFF 1\n"); - break; - } - - case 2: - { - DCSBIOS.Send("VHF_RADIO_CHAN_A 1\n"); - break; - } - - case 3: - { - DCSBIOS.Send("VHF_RADIO_CHAN_B 1\n"); - break; - } - - case 4: - { - DCSBIOS.Send("VHF_RADIO_CHAN_C 1\n"); - break; - } - } - } - } - public override void ClearSettings(bool setIsDirty = false) { } public override DcsOutputAndColorBinding CreateDcsOutputAndColorBinding(SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor, DCSBIOSOutput dcsBiosOutput) @@ -910,28 +911,11 @@ private void SetLowerRadioMode(CurrentP51DRadioMode currentP51DRadioMode) } } - public override void RemoveSwitchFromList(object controlList, PanelSwitchOnOff panelSwitchOnOff) - { - } - - public override void AddOrUpdateKeyStrokeBinding(PanelSwitchOnOff panelSwitchOnOff, string keyPress, KeyPressLength keyPressLength) - { - } - - public override void AddOrUpdateSequencedKeyBinding(PanelSwitchOnOff panelSwitchOnOff, string description, SortedList keySequence) - { - } - - public override void AddOrUpdateDCSBIOSBinding(PanelSwitchOnOff panelSwitchOnOff, List dcsbiosInputs, string description, bool isSequenced) - { - } - - public override void AddOrUpdateBIPLinkBinding(PanelSwitchOnOff panelSwitchOnOff, BIPLinkBase bipLink) - { - } - - public override void AddOrUpdateOSCommandBinding(PanelSwitchOnOff panelSwitchOnOff, OSCommand operatingSystemCommand) - { - } + public override void RemoveSwitchFromList(object controlList, PanelSwitchOnOff panelSwitchOnOff) { } + public override void AddOrUpdateKeyStrokeBinding(PanelSwitchOnOff panelSwitchOnOff, string keyPress, KeyPressLength keyPressLength) { } + public override void AddOrUpdateSequencedKeyBinding(PanelSwitchOnOff panelSwitchOnOff, string description, SortedList keySequence) { } + public override void AddOrUpdateDCSBIOSBinding(PanelSwitchOnOff panelSwitchOnOff, List dcsbiosInputs, string description, bool isSequenced) { } + public override void AddOrUpdateBIPLinkBinding(PanelSwitchOnOff panelSwitchOnOff, BIPLinkBase bipLink) { } + public override void AddOrUpdateOSCommandBinding(PanelSwitchOnOff panelSwitchOnOff, OSCommand operatingSystemCommand) { } } } From dfe059b8de0ab2102a64e95256b3b30da5b4f17b Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 2 Apr 2024 12:46:47 +0300 Subject: [PATCH 06/14] Mosquito radio uses output commands --- .../Radios/RadioPanelPZ69Mosquito.cs | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs b/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs index b4c517b87..12fa5ca6f 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs @@ -45,25 +45,25 @@ private enum CurrentMosquitoRadioMode // Large dial 1-4 [step of 1] // Small dial volume control private readonly object _lockVhf1DialObject1 = new(); - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton0; - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton1; - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton2; - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton3; - private DCSBIOSOutput _vhf1DcsbiosOutputPresetButton4; - private volatile uint _vhf1CockpitPresetActiveButton; - private const string VHF1_VOLUME_KNOB_COMMAND_INC = "RADIO_VOL +2000\n"; - private const string VHF1_VOLUME_KNOB_COMMAND_DEC = "RADIO_VOL -2000\n"; - private const string VHF1_RADIO_LIGHT_SWITCH_COMMAND = "RADIO_L_DIM TOGGLE\n"; + private DCSBIOSOutput _vhfOffOutput; + private DCSBIOSOutput _vhfChannelAOutput; + private DCSBIOSOutput _vhfChannelBOutput; + private DCSBIOSOutput _vhfChannelCOutput; + private DCSBIOSOutput _vhfChannelDOutput; + private volatile uint _vhfCockpitPresetActiveButton; + private DCSBIOSOutput _vhfVolumeOutput; + private const int VHF_VOLUME_CHANGE_VALUE = 2000; + private const string VHF_RADIO_LIGHT_SWITCH_COMMAND = "RADIO_L_DIM TOGGLE\n"; private readonly object _lockHFRadioModeDialObject1 = new(); private volatile uint _vhfRadioModeCockpitPosition = 1; - private DCSBIOSOutput _vhfRadioModeDcsbiosOutput; + private DCSBIOSOutput _vhfModeOutput; private readonly ClickSkipper _vhfDialChangeSkipper = new(2); private readonly object _lockShowFrequenciesOnPanelObject = new(); private long _doUpdatePanelLCD; public RadioPanelPZ69Mosquito(HIDSkeleton hidSkeleton) : base(hidSkeleton) - {} + { } private bool _disposed; // Protected implementation of Dispose pattern. @@ -89,13 +89,14 @@ public override void InitPanel() CreateRadioKnobs(); // VHF - _vhf1DcsbiosOutputPresetButton0 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_OFF"); - _vhf1DcsbiosOutputPresetButton1 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_A"); - _vhf1DcsbiosOutputPresetButton2 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_B"); - _vhf1DcsbiosOutputPresetButton3 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_C"); - _vhf1DcsbiosOutputPresetButton4 = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_D"); - _vhfRadioModeDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_T_MODE"); - + _vhfOffOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_OFF"); + _vhfChannelAOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_A"); + _vhfChannelBOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_B"); + _vhfChannelCOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_C"); + _vhfChannelDOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_D"); + _vhfModeOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_T_MODE"); + _vhfVolumeOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_VOL"); + BIOSEventHandler.AttachDataListener(this); StartListeningForHidPanelChanges(); } @@ -115,81 +116,81 @@ public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) */ // VHF On Off - if (_vhf1DcsbiosOutputPresetButton0.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfOffOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton0.LastUIntValue == 1) + if (_vhfOffOutput.LastUIntValue == 1) { // Radio is off - _vhf1CockpitPresetActiveButton = 0; + _vhfCockpitPresetActiveButton = 0; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF A - if (_vhf1DcsbiosOutputPresetButton1.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfChannelAOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton1.LastUIntValue == 1) + if (_vhfChannelAOutput.LastUIntValue == 1) { // Radio is on A - _vhf1CockpitPresetActiveButton = 1; + _vhfCockpitPresetActiveButton = 1; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF B - if (_vhf1DcsbiosOutputPresetButton2.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfChannelBOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton2.LastUIntValue == 1) + if (_vhfChannelBOutput.LastUIntValue == 1) { // Radio is on A - _vhf1CockpitPresetActiveButton = 2; + _vhfCockpitPresetActiveButton = 2; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF C - if (_vhf1DcsbiosOutputPresetButton3.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfChannelCOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton3.LastUIntValue == 1) + if (_vhfChannelCOutput.LastUIntValue == 1) { // Radio is on A - _vhf1CockpitPresetActiveButton = 3; + _vhfCockpitPresetActiveButton = 3; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // VHF D - if (_vhf1DcsbiosOutputPresetButton4.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfChannelDOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockVhf1DialObject1) { - if (_vhf1DcsbiosOutputPresetButton4.GetUIntValue(e.Data) == 1) + if (_vhfChannelDOutput.GetUIntValue(e.Data) == 1) { // Radio is on A - _vhf1CockpitPresetActiveButton = 4; + _vhfCockpitPresetActiveButton = 4; } Interlocked.Increment(ref _doUpdatePanelLCD); } } // HF Radio Mode - if (_vhfRadioModeDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_vhfModeOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockHFRadioModeDialObject1) { - _vhfRadioModeCockpitPosition = _vhfRadioModeDcsbiosOutput.LastUIntValue; + _vhfRadioModeCockpitPosition = _vhfModeOutput.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } @@ -287,7 +288,7 @@ protected override void PZ69KnobChanged(IEnumerable hashSet) { // Do not sync if user has pressed the button to configure the radio // Do when user releases button - DCSBIOS.Send(VHF1_RADIO_LIGHT_SWITCH_COMMAND); + DCSBIOS.Send(VHF_RADIO_LIGHT_SWITCH_COMMAND); } _upperButtonPressedAndDialRotated = false; @@ -307,7 +308,7 @@ protected override void PZ69KnobChanged(IEnumerable hashSet) { // Do not sync if user has pressed the button to configure the radio // Do when user releases button - DCSBIOS.Send(VHF1_RADIO_LIGHT_SWITCH_COMMAND); + DCSBIOS.Send(VHF_RADIO_LIGHT_SWITCH_COMMAND); } _lowerButtonPressedAndDialRotated = false; @@ -369,7 +370,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(VHF1_VOLUME_KNOB_COMMAND_INC); + DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); } else if (!_vhfDialChangeSkipper.ShouldSkip()) { @@ -390,7 +391,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(VHF1_VOLUME_KNOB_COMMAND_DEC); + DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE * -1)); } else if (!_vhfDialChangeSkipper.ShouldSkip()) { @@ -425,9 +426,9 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(VHF1_VOLUME_KNOB_COMMAND_INC); + DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); } - else if (!_vhfDialChangeSkipper.ShouldSkip()) + else if (!_vhfDialChangeSkipper.ShouldSkip()) { SendIncVHFPresetCommand(); } @@ -446,9 +447,9 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(VHF1_VOLUME_KNOB_COMMAND_DEC); + DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE * -1)); } - else if (!_vhfDialChangeSkipper.ShouldSkip()) + else if (!_vhfDialChangeSkipper.ShouldSkip()) { SendDecVHFPresetCommand(); } @@ -505,7 +506,7 @@ private void ShowFrequenciesOnPanel() string channelAsString; lock (_lockVhf1DialObject1) { - channelAsString = _vhf1CockpitPresetActiveButton.ToString(); + channelAsString = _vhfCockpitPresetActiveButton.ToString(); } SetPZ69DisplayBytesUnsignedInteger(ref bytes, Convert.ToUInt32(channelAsString), PZ69LCDPosition.UPPER_STBY_RIGHT); @@ -536,7 +537,7 @@ private void ShowFrequenciesOnPanel() string channelAsString; lock (_lockVhf1DialObject1) { - channelAsString = _vhf1CockpitPresetActiveButton.ToString(); + channelAsString = _vhfCockpitPresetActiveButton.ToString(); } SetPZ69DisplayBytesUnsignedInteger(ref bytes, Convert.ToUInt32(channelAsString), PZ69LCDPosition.LOWER_STBY_RIGHT); @@ -566,11 +567,10 @@ private string GetHFRadioModeStringCommand(bool moveUp) { lock (_lockHFRadioModeDialObject1) { - if (moveUp) - { - return "RADIO_T_MODE " + (_vhfRadioModeCockpitPosition + 1) + "\n"; - } - return "RADIO_T_MODE " + (_vhfRadioModeCockpitPosition - 1) + "\n"; + + return _vhfModeOutput.GetSetStateCommand(moveUp + ? _vhfRadioModeCockpitPosition + 1 + : _vhfRadioModeCockpitPosition - 1); } } @@ -579,29 +579,29 @@ private void SendIncVHFPresetCommand() Interlocked.Increment(ref _doUpdatePanelLCD); lock (_lockVhf1DialObject1) { - switch (_vhf1CockpitPresetActiveButton) + switch (_vhfCockpitPresetActiveButton) { case 0: { - DCSBIOS.Send("RADIO_A 1\n"); + DCSBIOS.Send(_vhfChannelAOutput.GetIncCommand()); break; } case 1: { - DCSBIOS.Send("RADIO_B 1\n"); + DCSBIOS.Send(_vhfChannelBOutput.GetIncCommand()); break; } case 2: { - DCSBIOS.Send("RADIO_C 1\n"); + DCSBIOS.Send(_vhfChannelCOutput.GetIncCommand()); break; } case 3: { - DCSBIOS.Send("RADIO_D 1\n"); + DCSBIOS.Send(_vhfChannelDOutput.GetIncCommand()); break; } @@ -618,7 +618,7 @@ private void SendDecVHFPresetCommand() Interlocked.Increment(ref _doUpdatePanelLCD); lock (_lockVhf1DialObject1) { - switch (_vhf1CockpitPresetActiveButton) + switch (_vhfCockpitPresetActiveButton) { case 0: { @@ -627,25 +627,25 @@ private void SendDecVHFPresetCommand() case 1: { - DCSBIOS.Send("RADIO_OFF 1\n"); + DCSBIOS.Send(_vhfOffOutput.GetIncCommand()); break; } case 2: { - DCSBIOS.Send("RADIO_A 1\n"); + DCSBIOS.Send(_vhfChannelAOutput.GetIncCommand()); break; } case 3: { - DCSBIOS.Send("RADIO_B 1\n"); + DCSBIOS.Send(_vhfChannelBOutput.GetIncCommand()); break; } case 4: { - DCSBIOS.Send("RADIO_C 1\n"); + DCSBIOS.Send(_vhfChannelCOutput.GetIncCommand()); break; } } From a9042bfb08b8e0a448d74e329f54d47b12cce248 Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 2 Apr 2024 15:21:01 +0300 Subject: [PATCH 07/14] Spelling exception dicionary update --- src/DCSFlightpanels.sln.DotSettings | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DCSFlightpanels.sln.DotSettings b/src/DCSFlightpanels.sln.DotSettings index 75c6ef827..2c2fca29f 100644 --- a/src/DCSFlightpanels.sln.DotSettings +++ b/src/DCSFlightpanels.sln.DotSettings @@ -2,6 +2,7 @@ ABRIS ADF AH + AIFF AJS ALL API From 1733f2b56e49a17f743c452b60855c6ef150e561 Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Tue, 2 Apr 2024 16:16:54 +0300 Subject: [PATCH 08/14] Radios use DCSBIOSCommand class --- src/DCSFPCommon | 2 +- .../Radios/RadioPanelPZ69Mosquito.cs | 48 +++++----- src/NonVisuals/Radios/RadioPanelPZ69P51D.cs | 71 ++++++++------- src/NonVisuals/Radios/RadiopanelPZ69P47D.cs | 64 +++++++------ .../Radios/RadiopanelPZ69SpitfireLFMkIX.cs | 89 ++++++++++--------- 5 files changed, 153 insertions(+), 121 deletions(-) diff --git a/src/DCSFPCommon b/src/DCSFPCommon index 1687d481c..4515e6ca1 160000 --- a/src/DCSFPCommon +++ b/src/DCSFPCommon @@ -1 +1 @@ -Subproject commit 1687d481c5d2e27df31000d1d849ff19a1bb798d +Subproject commit 4515e6ca19b19b8aa6446f6acd7a52a07f9f5e50 diff --git a/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs b/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs index 12fa5ca6f..ffbebadab 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69Mosquito.cs @@ -1,4 +1,5 @@ using ClassLibraryCommon; +using DCS_BIOS.misc; using NonVisuals.BindingClasses.BIP; namespace NonVisuals.Radios @@ -46,17 +47,24 @@ private enum CurrentMosquitoRadioMode // Small dial volume control private readonly object _lockVhf1DialObject1 = new(); private DCSBIOSOutput _vhfOffOutput; + private DCSBIOSCommand _vhfOffCommand; private DCSBIOSOutput _vhfChannelAOutput; + private DCSBIOSCommand _vhfChannelACommand; private DCSBIOSOutput _vhfChannelBOutput; + private DCSBIOSCommand _vhfChannelBCommand; private DCSBIOSOutput _vhfChannelCOutput; + private DCSBIOSCommand _vhfChannelCCommand; private DCSBIOSOutput _vhfChannelDOutput; + private DCSBIOSCommand _vhfChannelDCommand; private volatile uint _vhfCockpitPresetActiveButton; private DCSBIOSOutput _vhfVolumeOutput; + private DCSBIOSCommand _vhfVolumeCommand; private const int VHF_VOLUME_CHANGE_VALUE = 2000; private const string VHF_RADIO_LIGHT_SWITCH_COMMAND = "RADIO_L_DIM TOGGLE\n"; private readonly object _lockHFRadioModeDialObject1 = new(); private volatile uint _vhfRadioModeCockpitPosition = 1; private DCSBIOSOutput _vhfModeOutput; + private DCSBIOSCommand _vhfModeCommand; private readonly ClickSkipper _vhfDialChangeSkipper = new(2); private readonly object _lockShowFrequenciesOnPanelObject = new(); @@ -89,13 +97,13 @@ public override void InitPanel() CreateRadioKnobs(); // VHF - _vhfOffOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_OFF"); - _vhfChannelAOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_A"); - _vhfChannelBOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_B"); - _vhfChannelCOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_C"); - _vhfChannelDOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_D"); - _vhfModeOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_T_MODE"); - _vhfVolumeOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_VOL"); + (_vhfOffCommand, _vhfOffOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RADIO_OFF"); + (_vhfChannelACommand, _vhfChannelAOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RADIO_A"); + (_vhfChannelBCommand, _vhfChannelBOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RADIO_B"); + (_vhfChannelCCommand, _vhfChannelCOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RADIO_C"); + (_vhfChannelDCommand, _vhfChannelDOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RADIO_D"); + (_vhfModeCommand, _vhfModeOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RADIO_T_MODE"); + _vhfVolumeCommand = DCSBIOSControlLocator.GetCommand("RADIO_VOL"); BIOSEventHandler.AttachDataListener(this); StartListeningForHidPanelChanges(); @@ -370,7 +378,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); } else if (!_vhfDialChangeSkipper.ShouldSkip()) { @@ -391,7 +399,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE * -1)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE, true)); } else if (!_vhfDialChangeSkipper.ShouldSkip()) { @@ -426,7 +434,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); } else if (!_vhfDialChangeSkipper.ShouldSkip()) { @@ -447,7 +455,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE * -1)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE, true)); } else if (!_vhfDialChangeSkipper.ShouldSkip()) { @@ -568,7 +576,7 @@ private string GetHFRadioModeStringCommand(bool moveUp) lock (_lockHFRadioModeDialObject1) { - return _vhfModeOutput.GetSetStateCommand(moveUp + return _vhfModeCommand.GetSetStateCommand(moveUp ? _vhfRadioModeCockpitPosition + 1 : _vhfRadioModeCockpitPosition - 1); } @@ -583,25 +591,25 @@ private void SendIncVHFPresetCommand() { case 0: { - DCSBIOS.Send(_vhfChannelAOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelACommand.GetIncCommand()); break; } case 1: { - DCSBIOS.Send(_vhfChannelBOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelBCommand.GetIncCommand()); break; } case 2: { - DCSBIOS.Send(_vhfChannelCOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelCCommand.GetIncCommand()); break; } case 3: { - DCSBIOS.Send(_vhfChannelDOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelDCommand.GetIncCommand()); break; } @@ -627,25 +635,25 @@ private void SendDecVHFPresetCommand() case 1: { - DCSBIOS.Send(_vhfOffOutput.GetIncCommand()); + DCSBIOS.Send(_vhfOffCommand.GetIncCommand()); break; } case 2: { - DCSBIOS.Send(_vhfChannelAOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelACommand.GetIncCommand()); break; } case 3: { - DCSBIOS.Send(_vhfChannelBOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelBCommand.GetIncCommand()); break; } case 4: { - DCSBIOS.Send(_vhfChannelCOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelCCommand.GetIncCommand()); break; } } diff --git a/src/NonVisuals/Radios/RadioPanelPZ69P51D.cs b/src/NonVisuals/Radios/RadioPanelPZ69P51D.cs index 416f46289..a4c6af578 100644 --- a/src/NonVisuals/Radios/RadioPanelPZ69P51D.cs +++ b/src/NonVisuals/Radios/RadioPanelPZ69P51D.cs @@ -48,17 +48,24 @@ private enum CurrentP51DRadioMode // Small dial : Channel private readonly object _lockVhf1DialObject1 = new(); private DCSBIOSOutput _vhfOffOutput; + private DCSBIOSCommand _vhfOffCommand; private DCSBIOSOutput _vhfChannelAOutput; + private DCSBIOSCommand _vhfChannelACommand; private DCSBIOSOutput _vhfChannelBOutput; + private DCSBIOSCommand _vhfChannelBCommand; private DCSBIOSOutput _vhfChannelCOutput; + private DCSBIOSCommand _vhfChannelCCommand; private DCSBIOSOutput _vhfChannelDOutput; + private DCSBIOSCommand _vhfChannelDCommand; private volatile uint _vhfCockpitPresetActiveButton; - private DCSBIOSOutput _vhfVolumeOutput; + private DCSBIOSCommand _vhfVolumeCommand; private const int VHF_VOLUME_CHANGE_VALUE = 2000; private readonly object _lockVHFRadioModeDialObject1 = new(); private DCSBIOSOutput _vhfMode2Output; + private DCSBIOSCommand _vhfMode2Command; private volatile uint _vhfMode2CockpitDialPosition = 1; private DCSBIOSOutput _vhfMode3Output; + private DCSBIOSCommand _vhfMode3Command; private volatile uint _vhfMode3CockpitDialPosition = 1; private readonly ClickSkipper _vhfRadioDialSkipper = new(2); private const string VHF_RADIO_LIGHT_SWITCH_COMMAND = "RADIO_LIGHTS_DIMMER TOGGLE\n"; @@ -71,7 +78,9 @@ private enum CurrentP51DRadioMode private readonly object _lockLFRadioFrequencyDialObject1 = new(); private readonly object _lockLFRadioVolumeDialObject1 = new(); private DCSBIOSOutput _lfRadioFrequencyDcsbiosOutput; + private DCSBIOSCommand _lfFrequencyCommand; private DCSBIOSOutput _lfRadioVolumeDcsbiosOutput; + private DCSBIOSCommand _lfVolumeCommand; private volatile uint _lfRadioFrequencyDCSBIOSValue = 1; private volatile uint _lfRadioVolumeDCSBIOSValue; private volatile uint _lfRadioFrequencyCockpitValue = 1; @@ -111,18 +120,18 @@ public override void InitPanel() CreateRadioKnobs(); // VHF - _vhfOffOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_ON_OFF"); - _vhfChannelAOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_A"); - _vhfChannelBOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_B"); - _vhfChannelCOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_C"); - _vhfChannelDOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("VHF_RADIO_CHAN_D"); - _vhfMode2Output = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_MODE2"); - _vhfMode3Output = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_MODE3"); - _vhfVolumeOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RADIO_VOLUME"); + (_vhfOffCommand,_vhfOffOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("VHF_RADIO_ON_OFF"); + (_vhfChannelACommand,_vhfChannelAOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("VHF_RADIO_CHAN_A"); + (_vhfChannelBCommand, _vhfChannelBOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("VHF_RADIO_CHAN_B"); + (_vhfChannelCCommand, _vhfChannelCOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("VHF_RADIO_CHAN_C"); + (_vhfChannelDCommand, _vhfChannelDOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("VHF_RADIO_CHAN_D"); + (_vhfMode2Command, _vhfMode2Output) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RADIO_MODE2"); + (_vhfMode3Command, _vhfMode3Output) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RADIO_MODE3"); + _vhfVolumeCommand = DCSBIOSControlLocator.GetCommand("RADIO_VOLUME"); // LF DETROLA - _lfRadioFrequencyDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("DETROLA_FREQUENCY"); - _lfRadioVolumeDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("DETROLA_VOLUME"); + (_lfFrequencyCommand,_lfRadioFrequencyDcsbiosOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("DETROLA_FREQUENCY"); + (_lfVolumeCommand, _lfRadioVolumeDcsbiosOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("DETROLA_VOLUME"); BIOSEventHandler.AttachDataListener(this); StartListeningForHidPanelChanges(); @@ -467,7 +476,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); } else if (!_vhfRadioDialSkipper.ShouldSkip()) { @@ -493,7 +502,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE * -1)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE, true)); } else if (!_vhfRadioDialSkipper.ShouldSkip()) { @@ -555,7 +564,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE)); } else if (!_vhfRadioDialSkipper.ShouldSkip()) { @@ -581,7 +590,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE * -1)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableCommand(VHF_VOLUME_CHANGE_VALUE, true)); } else if (!_vhfRadioDialSkipper.ShouldSkip()) { @@ -727,25 +736,25 @@ private void SendIncVHFPresetCommand() { case 0: { - DCSBIOS.Send(_vhfChannelAOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelACommand.GetIncCommand()); break; } case 1: { - DCSBIOS.Send(_vhfChannelBOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelBCommand.GetIncCommand()); break; } case 2: { - DCSBIOS.Send(_vhfChannelCOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelCCommand.GetIncCommand()); break; } case 3: { - DCSBIOS.Send(_vhfChannelDOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelDCommand.GetIncCommand()); break; } @@ -771,25 +780,25 @@ private void SendDecVHFPresetCommand() case 1: { - DCSBIOS.Send(_vhfOffOutput.GetIncCommand()); + DCSBIOS.Send(_vhfOffCommand.GetIncCommand()); break; } case 2: { - DCSBIOS.Send(_vhfChannelAOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelACommand.GetIncCommand()); break; } case 3: { - DCSBIOS.Send(_vhfChannelBOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelBCommand.GetIncCommand()); break; } case 4: { - DCSBIOS.Send(_vhfChannelCOutput.GetIncCommand()); + DCSBIOS.Send(_vhfChannelCCommand.GetIncCommand()); break; } } @@ -815,11 +824,11 @@ private string GetDetrolaFrequencyStringCommand(bool moveUp, uint changeValue) if (moveUp) { newValue = _lfRadioFrequencyDCSBIOSValue + changeValue > 0xFFFF ? 0xFFFF : _lfRadioFrequencyDCSBIOSValue + changeValue; - return $"DETROLA_FREQUENCY {newValue}\n"; + return _lfFrequencyCommand.GetSetStateCommand(newValue); } newValue = _lfRadioFrequencyDCSBIOSValue < changeValue ? 0 : _lfRadioFrequencyDCSBIOSValue - changeValue; - return $"DETROLA_FREQUENCY {newValue}\n"; + return _lfFrequencyCommand.GetSetStateCommand(newValue); } } @@ -831,11 +840,11 @@ private string GetDetrolaVolumeStringCommand(bool moveUp, uint changeValue) if (moveUp) { newValue = _lfRadioVolumeDCSBIOSValue + changeValue > 0xFFFF ? 0xFFFF : _lfRadioVolumeDCSBIOSValue + changeValue; - return $"DETROLA_VOLUME {newValue}\n"; + return _lfVolumeCommand.GetSetStateCommand(newValue); } newValue = _lfRadioVolumeDCSBIOSValue < changeValue ? 0 : _lfRadioVolumeDCSBIOSValue - changeValue; - return $"DETROLA_VOLUME {newValue}\n"; + return _lfVolumeCommand.GetSetStateCommand(newValue); } } @@ -855,8 +864,8 @@ private string GetHFRadioModeStringCommand(bool moveUp) { return _vhfMode2CockpitDialPosition switch { - 0 => _vhfMode3Output.GetDecCommand(), - 1 => _vhfMode2Output.GetIncCommand(), + 0 => _vhfMode3Command.GetDecCommand(), + 1 => _vhfMode2Command.GetIncCommand(), 2 => null, _ => null }; @@ -865,8 +874,8 @@ private string GetHFRadioModeStringCommand(bool moveUp) return _vhfMode2CockpitDialPosition switch { 0 => null, - 1 => _vhfMode3Output.GetDecCommand(), - 2 => _vhfMode3Output.GetDecCommand() + _vhfMode3Output.GetDecCommand(), + 1 => _vhfMode3Command.GetDecCommand(), + 2 => _vhfMode3Command.GetDecCommand() + _vhfMode3Command.GetDecCommand(), _ => null }; } diff --git a/src/NonVisuals/Radios/RadiopanelPZ69P47D.cs b/src/NonVisuals/Radios/RadiopanelPZ69P47D.cs index d34e95510..b006b839f 100644 --- a/src/NonVisuals/Radios/RadiopanelPZ69P47D.cs +++ b/src/NonVisuals/Radios/RadiopanelPZ69P47D.cs @@ -51,11 +51,16 @@ private enum CurrentP47DRadioMode */ private readonly object _lockVHFPresetDialObject1 = new(); private DCSBIOSOutput _vhfOffOutput; + private DCSBIOSCommand _vhfOffCommand; private DCSBIOSOutput _vhfChannelAPresetOutput; + private DCSBIOSCommand _vhfChannelACommand; private DCSBIOSOutput _vhfChannelBPresetOutput; + private DCSBIOSCommand _vhfChannelBCommand; private DCSBIOSOutput _vhfChannelCPresetOutput; + private DCSBIOSCommand _vhfChannelCCommand; private DCSBIOSOutput _vhfChannelDPresetOutput; - private DCSBIOSOutput _vhfVolumeOutput; + private DCSBIOSCommand _vhfChannelDCommand; + private DCSBIOSCommand _vhfVolumeCommand; private volatile uint _vhfOffCockpitButton = 1; private volatile uint _vhfChannelACockpitButton; private volatile uint _vhfChannelBCockpitButton; @@ -66,6 +71,7 @@ private enum CurrentP47DRadioMode private readonly object _lockVHFRadioModeDialObject1 = new(); private volatile uint _vhfModeCockpitDialPosition = 1; private DCSBIOSOutput _vhfModeDialPresetOutput; + private DCSBIOSCommand _vhfModeDialCommand; private readonly ClickSkipper _vhfModePresetDialSkipper = new(2); /* @@ -76,7 +82,9 @@ private enum CurrentP47DRadioMode private readonly object _lockLFRadioFrequencyDialObject1 = new(); private readonly object _lockLFRadioVolumeDialObject1 = new(); private DCSBIOSOutput _lfRadioFrequencyDcsbiosOutput; + private DCSBIOSCommand _lfFrequencyCommand; private DCSBIOSOutput _lfRadioVolumeDcsbiosOutput; + private DCSBIOSCommand _lfVolumeCommand; private volatile uint _lfRadioFrequencyDCSBIOSValue = 1; private volatile uint _lfRadioVolumeDCSBIOSValue; private volatile uint _lfRadioFrequencyCockpitValue = 1; @@ -117,17 +125,17 @@ public override void InitPanel() CreateRadioKnobs(); // VHF - _vhfOffOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_OFF"); - _vhfChannelAPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_A"); - _vhfChannelBPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_B"); - _vhfChannelCPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_C"); - _vhfChannelDPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_D"); - _vhfModeDialPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_T_MODE"); - _vhfVolumeOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_VOL"); + (_vhfOffCommand, _vhfOffOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_OFF"); + (_vhfChannelACommand, _vhfChannelAPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_A"); + (_vhfChannelBCommand, _vhfChannelBPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_B"); + (_vhfChannelCCommand, _vhfChannelCPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_C"); + (_vhfChannelDCommand, _vhfChannelDPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_D"); + (_vhfModeDialCommand, _vhfModeDialPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_T_MODE"); + _vhfVolumeCommand = DCSBIOSControlLocator.GetCommand("RCTRL_VOL"); // LF DETROLA - _lfRadioFrequencyDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("DETROLA_FREQU_SEL"); - _lfRadioVolumeDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("DETROLA_VOL"); + (_lfFrequencyCommand, _lfRadioFrequencyDcsbiosOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("DETROLA_FREQU_SEL"); + (_lfVolumeCommand, _lfRadioVolumeDcsbiosOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("DETROLA_VOL"); BIOSEventHandler.AttachDataListener(this); StartListeningForHidPanelChanges(); @@ -455,7 +463,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableDefaultCommand(true)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableDefaultCommand(true)); } else { @@ -481,7 +489,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_upperButtonPressed) { _upperButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableDefaultCommand(false)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableDefaultCommand(false)); } else { @@ -543,7 +551,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableDefaultCommand(true)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableDefaultCommand(true)); } else { @@ -569,7 +577,7 @@ private void AdjustFrequency(IEnumerable hashSet) if (_lowerButtonPressed) { _lowerButtonPressedAndDialRotated = true; - DCSBIOS.Send(_vhfVolumeOutput.GetVariableDefaultCommand(false)); + DCSBIOS.Send(_vhfVolumeCommand.GetVariableDefaultCommand(false)); } else { @@ -801,44 +809,44 @@ private string GetHFRadioChannelStringCommand(bool moveUp) if ((_vhfOffCockpitButton == 1 || _vhfOffCockpitButton == 0) && _vhfChannelACockpitButton == 0 && _vhfChannelBCockpitButton == 0 && _vhfChannelCCockpitButton == 0 && _vhfChannelDCockpitButton == 0) { - return _vhfChannelAPresetOutput.GetIncCommand(); + return _vhfChannelACommand.GetIncCommand(); } if (_vhfChannelACockpitButton == 1) { - return _vhfChannelBPresetOutput.GetIncCommand(); + return _vhfChannelBCommand.GetIncCommand(); } if (_vhfChannelBCockpitButton == 1) { - return _vhfChannelCPresetOutput.GetIncCommand(); + return _vhfChannelCCommand.GetIncCommand(); } if (_vhfChannelCCockpitButton == 1) { - return _vhfChannelDPresetOutput.GetIncCommand(); + return _vhfChannelDCommand.GetIncCommand(); } } else { if (_vhfChannelDCockpitButton == 1) { - return _vhfChannelCPresetOutput.GetIncCommand(); + return _vhfChannelCCommand.GetIncCommand(); } if (_vhfChannelCCockpitButton == 1) { - return _vhfChannelBPresetOutput.GetIncCommand(); + return _vhfChannelBCommand.GetIncCommand(); } if (_vhfChannelBCockpitButton == 1) { - return _vhfChannelAPresetOutput.GetIncCommand(); + return _vhfChannelACommand.GetIncCommand(); } if (_vhfChannelACockpitButton == 1) { - return _vhfOffOutput.GetIncCommand(); + return _vhfOffCommand.GetIncCommand(); } } } @@ -851,9 +859,9 @@ private string GetHFRadioModeStringCommand(bool moveUp) { if (moveUp) { - return _vhfModeDialPresetOutput.GetSetStateCommand(_vhfModeCockpitDialPosition + 1); + return _vhfModeDialCommand.GetSetStateCommand(_vhfModeCockpitDialPosition + 1); } - return _vhfModeDialPresetOutput.GetSetStateCommand(_vhfModeCockpitDialPosition - 1); + return _vhfModeDialCommand.GetSetStateCommand(_vhfModeCockpitDialPosition - 1); } } @@ -866,11 +874,11 @@ private string GetDetrolaFrequencyStringCommand(bool moveUp, uint changeValue) { newValue = _lfRadioFrequencyDCSBIOSValue + changeValue > 0xFFFF ? 0xFFFF : _lfRadioFrequencyDCSBIOSValue + changeValue; - return _lfRadioFrequencyDcsbiosOutput.GetSetStateCommand(newValue); + return _lfFrequencyCommand.GetSetStateCommand(newValue); } newValue = _lfRadioFrequencyDCSBIOSValue < changeValue ? 0 : _lfRadioFrequencyDCSBIOSValue - changeValue; - return _lfRadioFrequencyDcsbiosOutput.GetSetStateCommand(newValue); + return _lfFrequencyCommand.GetSetStateCommand(newValue); } } @@ -882,11 +890,11 @@ private string GetDetrolaVolumeStringCommand(bool moveUp, uint changeValue) if (moveUp) { newValue = _lfRadioVolumeDCSBIOSValue + changeValue > 0xFFFF ? 0xFFFF : _lfRadioVolumeDCSBIOSValue + changeValue; - return _lfRadioVolumeDcsbiosOutput.GetSetStateCommand(newValue); + return _lfVolumeCommand.GetSetStateCommand(newValue); } newValue = _lfRadioVolumeDCSBIOSValue < changeValue ? 0 : _lfRadioVolumeDCSBIOSValue - changeValue; - return _lfRadioVolumeDcsbiosOutput.GetSetStateCommand(newValue); + return _lfVolumeCommand.GetSetStateCommand(newValue); } } diff --git a/src/NonVisuals/Radios/RadiopanelPZ69SpitfireLFMkIX.cs b/src/NonVisuals/Radios/RadiopanelPZ69SpitfireLFMkIX.cs index f61e7c2c5..d73f0f082 100644 --- a/src/NonVisuals/Radios/RadiopanelPZ69SpitfireLFMkIX.cs +++ b/src/NonVisuals/Radios/RadiopanelPZ69SpitfireLFMkIX.cs @@ -18,6 +18,7 @@ namespace NonVisuals.Radios using Helpers; using DCS_BIOS.Serialized; using DCS_BIOS.ControlLocator; + using DCS_BIOS.misc; @@ -56,13 +57,17 @@ private enum CurrentSpitfireLFMkIXRadioMode * Freq. Selector Light Switch */ private readonly object _lockHFRadioPresetDialObject1 = new(); - private DCSBIOSOutput _hfRadioOffDcsbiosOutput; + private DCSBIOSOutput _hfOffDcsbiosOutput; + private DCSBIOSCommand _hfOffCommand; private DCSBIOSOutput _hfChannelAPresetOutput; + private DCSBIOSCommand _hfChannelACommand; private DCSBIOSOutput _hfChannelBPresetOutput; + private DCSBIOSCommand _hfChannelBCommand; private DCSBIOSOutput _hfChannelCPresetOutput; + private DCSBIOSCommand _hfChannelCCommand; private DCSBIOSOutput _hfChannelDPresetOutput; - private DCSBIOSOutput _hfOffOutput; - private volatile uint _hfRadioOffCockpitButton = 1; + private DCSBIOSCommand _hfChannelDCommand; + private volatile uint _hfOffCockpitButton = 1; private volatile uint _hfChannelACockpitButton; private volatile uint _hfChannelBCockpitButton; private volatile uint _hfChannelCCockpitButton; @@ -70,18 +75,21 @@ private enum CurrentSpitfireLFMkIXRadioMode private readonly ClickSkipper _hfChannelPresetDialSkipper = new(2); private const string HF_RADIO_LIGHT_SWITCH_COMMAND = "RCTRL_DIM TOGGLE\n"; private readonly object _lockHFRadioModeDialObject1 = new(); - private volatile uint _hfRadioModeCockpitDialPosition = 1; - private DCSBIOSOutput _hfRadioModeDialPresetOutput; - private readonly ClickSkipper _hfRadioModePresetDialSkipper = new(2); + private volatile uint _hfModeCockpitDialPosition = 1; + private DCSBIOSOutput _hfModeDialPresetOutput; + private DCSBIOSCommand _hfModeCommand; + private readonly ClickSkipper _hfModePresetDialSkipper = new(2); /* - * COM2 Large IFF Circuit D - * COM2 Small IFF Circuit B - * COM2 ACT/STBY IFF Destruction - */ + * COM2 Large IFF Circuit D + * COM2 Small IFF Circuit B + * COM2 ACT/STBY IFF Destruction + */ private readonly object _lockIFFDialObject1 = new(); private DCSBIOSOutput _iffBiffDcsbiosOutputDial; + private DCSBIOSCommand _iffBDialCommand; private DCSBIOSOutput _iffDiffDcsbiosOutputDial; + private DCSBIOSCommand _iffDDialCommand; private volatile uint _iffBiffCockpitDialPos = 1; private volatile uint _iffDiffCockpitDialPos; private readonly ClickSkipper _iffBiffDialSkipper = new(2); @@ -121,16 +129,15 @@ public override void InitPanel() CreateRadioKnobs(); // COM1 - _hfRadioOffDcsbiosOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_OFF"); - _hfChannelAPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_A"); - _hfChannelBPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_B"); - _hfChannelCPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_C"); - _hfChannelDPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_D"); - _hfRadioModeDialPresetOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_T_MODE"); - _hfOffOutput = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("RCTRL_OFF"); + (_hfOffCommand ,_hfOffDcsbiosOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_OFF"); + (_hfChannelACommand, _hfChannelAPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_A"); + (_hfChannelBCommand, _hfChannelBPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_B"); + (_hfChannelCCommand, _hfChannelCPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_C"); + (_hfChannelDCommand, _hfChannelDPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_D"); + (_hfModeCommand, _hfModeDialPresetOutput) = DCSBIOSControlLocator.GetUIntCommandAndOutput("RCTRL_T_MODE"); // COM2 - _iffBiffDcsbiosOutputDial = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("IFF_B"); - _iffDiffDcsbiosOutputDial = DCSBIOSControlLocator.GetUIntDCSBIOSOutput("IFF_D"); + (_iffBDialCommand, _iffBiffDcsbiosOutputDial) = DCSBIOSControlLocator.GetUIntCommandAndOutput("IFF_B"); + (_iffDDialCommand, _iffDiffDcsbiosOutputDial) = DCSBIOSControlLocator.GetUIntCommandAndOutput("IFF_D"); BIOSEventHandler.AttachDataListener(this); StartListeningForHidPanelChanges(); @@ -150,11 +157,11 @@ public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) */ // HF Radio Off Button - if (_hfRadioOffDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_hfOffDcsbiosOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockHFRadioPresetDialObject1) { - _hfRadioOffCockpitButton = _hfRadioOffDcsbiosOutput.LastUIntValue; + _hfOffCockpitButton = _hfOffDcsbiosOutput.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } @@ -200,11 +207,11 @@ public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) } // HF Radio Mode - if (_hfRadioModeDialPresetOutput.UIntValueHasChanged(e.Address, e.Data)) + if (_hfModeDialPresetOutput.UIntValueHasChanged(e.Address, e.Data)) { lock (_lockHFRadioModeDialObject1) { - _hfRadioModeCockpitDialPosition = _hfRadioModeDialPresetOutput.LastUIntValue; + _hfModeCockpitDialPosition = _hfModeDialPresetOutput.LastUIntValue; Interlocked.Increment(ref _doUpdatePanelLCD); } } @@ -395,7 +402,7 @@ private void AdjustFrequency(IEnumerable hashSet) { case CurrentSpitfireLFMkIXRadioMode.HFRADIO: { - _hfRadioModePresetDialSkipper.Click(GetHFRadioModeStringCommand(true)); + _hfModePresetDialSkipper.Click(GetHFRadioModeStringCommand(true)); break; } @@ -420,7 +427,7 @@ private void AdjustFrequency(IEnumerable hashSet) case CurrentSpitfireLFMkIXRadioMode.HFRADIO: { // MODE - _hfRadioModePresetDialSkipper.Click(GetHFRadioModeStringCommand(false)); + _hfModePresetDialSkipper.Click(GetHFRadioModeStringCommand(false)); break; } @@ -478,7 +485,7 @@ private void AdjustFrequency(IEnumerable hashSet) { case CurrentSpitfireLFMkIXRadioMode.HFRADIO: { - _hfRadioModePresetDialSkipper.Click(GetHFRadioModeStringCommand(true)); + _hfModePresetDialSkipper.Click(GetHFRadioModeStringCommand(true)); break; } @@ -497,7 +504,7 @@ private void AdjustFrequency(IEnumerable hashSet) { case CurrentSpitfireLFMkIXRadioMode.HFRADIO: { - _hfRadioModePresetDialSkipper.Click(GetHFRadioModeStringCommand(false)); + _hfModePresetDialSkipper.Click(GetHFRadioModeStringCommand(false)); break; } @@ -586,7 +593,7 @@ private void ShowFrequenciesOnPanel() uint channel = 0; lock (_lockHFRadioPresetDialObject1) { - if (_hfRadioOffCockpitButton == 1) + if (_hfOffCockpitButton == 1) { channel = 0; } @@ -608,7 +615,7 @@ private void ShowFrequenciesOnPanel() } } - SetPZ69DisplayBytesUnsignedInteger(ref bytes, _hfRadioModeCockpitDialPosition, PZ69LCDPosition.UPPER_ACTIVE_LEFT); + SetPZ69DisplayBytesUnsignedInteger(ref bytes, _hfModeCockpitDialPosition, PZ69LCDPosition.UPPER_ACTIVE_LEFT); SetPZ69DisplayBytesUnsignedInteger(ref bytes, channel, PZ69LCDPosition.UPPER_STBY_RIGHT); break; } @@ -646,7 +653,7 @@ private void ShowFrequenciesOnPanel() uint channel = 0; lock (_lockHFRadioPresetDialObject1) { - if (_hfRadioOffCockpitButton == 1) + if (_hfOffCockpitButton == 1) { channel = 0; } @@ -668,7 +675,7 @@ private void ShowFrequenciesOnPanel() } } - SetPZ69DisplayBytesUnsignedInteger(ref bytes, _hfRadioModeCockpitDialPosition, PZ69LCDPosition.LOWER_ACTIVE_LEFT); + SetPZ69DisplayBytesUnsignedInteger(ref bytes, _hfModeCockpitDialPosition, PZ69LCDPosition.LOWER_ACTIVE_LEFT); SetPZ69DisplayBytesUnsignedInteger(ref bytes, channel, PZ69LCDPosition.LOWER_STBY_RIGHT); break; } @@ -754,47 +761,47 @@ private string GetHFRadioChannelStringCommand(bool moveUp) { if (moveUp) { - if ((_hfRadioOffCockpitButton == 1 || _hfRadioOffCockpitButton == 0) && _hfChannelACockpitButton == 0 && _hfChannelBCockpitButton == 0 + if ((_hfOffCockpitButton == 1 || _hfOffCockpitButton == 0) && _hfChannelACockpitButton == 0 && _hfChannelBCockpitButton == 0 && _hfChannelCCockpitButton == 0 && _hfChannelDCockpitButton == 0) { - return _hfChannelAPresetOutput.GetIncCommand(); + return _hfChannelACommand.GetIncCommand(); } if (_hfChannelACockpitButton == 1) { - return _hfChannelBPresetOutput.GetIncCommand(); + return _hfChannelBCommand.GetIncCommand(); } if (_hfChannelBCockpitButton == 1) { - return _hfChannelCPresetOutput.GetIncCommand(); + return _hfChannelCCommand.GetIncCommand(); } if (_hfChannelCCockpitButton == 1) { - return _hfChannelDPresetOutput.GetIncCommand(); + return _hfChannelDCommand.GetIncCommand(); } } else { if (_hfChannelDCockpitButton == 1) { - return _hfChannelCPresetOutput.GetIncCommand(); + return _hfChannelCCommand.GetIncCommand(); } if (_hfChannelCCockpitButton == 1) { - return _hfChannelBPresetOutput.GetIncCommand(); + return _hfChannelBCommand.GetIncCommand(); } if (_hfChannelBCockpitButton == 1) { - return _hfChannelAPresetOutput.GetIncCommand(); + return _hfChannelACommand.GetIncCommand(); } if (_hfChannelACockpitButton == 1) { - return _hfOffOutput.GetIncCommand(); + return _hfOffCommand.GetIncCommand(); } } } @@ -805,7 +812,7 @@ private string GetHFRadioModeStringCommand(bool moveUp) { lock (_lockHFRadioModeDialObject1) { - return _hfRadioModeDialPresetOutput.GetSetStateCommand(moveUp ? _hfRadioModeCockpitDialPosition + 1 : _hfRadioModeCockpitDialPosition - 1); + return _hfModeCommand.GetSetStateCommand(moveUp ? _hfModeCockpitDialPosition + 1 : _hfModeCockpitDialPosition - 1); } } From 2a5bc9415b3175882100c128bddddb6070ed53c2 Mon Sep 17 00:00:00 2001 From: Jerker Dahlblom Date: Wed, 3 Apr 2024 11:33:13 +0300 Subject: [PATCH 09/14] Spelling dictionary --- src/DCSFlightpanels.sln.DotSettings | 6 ++++++ .../PanelUserControls/FarmingPanelUserControl.xaml | 1 - src/NonVisuals/Radios/RadioPanelPZ69SA342.cs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/DCSFlightpanels.sln.DotSettings b/src/DCSFlightpanels.sln.DotSettings index 2c2fca29f..4b808a013 100644 --- a/src/DCSFlightpanels.sln.DotSettings +++ b/src/DCSFlightpanels.sln.DotSettings @@ -11,6 +11,7 @@ ARN AV BIOS + BIP BIPS BLUE BNA @@ -61,6 +62,7 @@ OLE OS OSCOMMANDS + PAN PURPLE PZ RED @@ -91,8 +93,10 @@ API BIP BIPLED + CCW CDU CTRL + CW DCS DCSBIOS DME @@ -105,7 +109,9 @@ OK OS PZ + SRS TPM + UC UI USB XPDR diff --git a/src/DCSFlightpanels/PanelUserControls/FarmingPanelUserControl.xaml b/src/DCSFlightpanels/PanelUserControls/FarmingPanelUserControl.xaml index f046a8b93..3b2c92e5c 100644 --- a/src/DCSFlightpanels/PanelUserControls/FarmingPanelUserControl.xaml +++ b/src/DCSFlightpanels/PanelUserControls/FarmingPanelUserControl.xaml @@ -124,7 +124,6 @@