From 068256488261d5cf83520799ff98f54189cb3f3d Mon Sep 17 00:00:00 2001 From: joekolodz Date: Sun, 31 Mar 2024 00:15:39 -0500 Subject: [PATCH] POV buttons are handled like other buttons now (allows inherited maps) --- src/Models/HOTASQueue.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Models/HOTASQueue.cs b/src/Models/HOTASQueue.cs index e2c3111..c83a3d5 100644 --- a/src/Models/HOTASQueue.cs +++ b/src/Models/HOTASQueue.cs @@ -207,9 +207,8 @@ private async Task HandlePovButton(JoystickOffset offset, int value) var success = _lastPovButton.TryRemove(offset, out var translatedOffset); if (!success) return; - if (!(GetMap(translatedOffset) is HOTASButton map)) return; - HandleButtonReleased(map, translatedOffset); - OnButtonRelease(translatedOffset); + + await HandleStandardButton(translatedOffset, (int)JoystickOffsetValues.ButtonState.ButtonReleased); } else { @@ -218,10 +217,7 @@ private async Task HandlePovButton(JoystickOffset offset, int value) _lastPovButton.TryAdd(offset, translatedOffset); Logging.Log.Debug($"Pressing POV button: {offset} - {value}"); - if (!(GetMap(translatedOffset) is HOTASButton map)) return; - - await HandleButtonPressed(map, translatedOffset); - OnButtonPress(translatedOffset); + await HandleStandardButton(translatedOffset, (int)JoystickOffsetValues.ButtonState.ButtonPressed); } } @@ -244,7 +240,7 @@ private async Task HandleStandardButton(int offset, int value) _modeActivationButtons[_mode].InheritFromMode > 0) { map = GetMapFromParentMode(_modeActivationButtons[_mode].InheritFromMode, offset) as HOTASButton; - if (map != null) + ;if (map != null) { await HandleButtonPressed(map, offset); }