Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing events and custom key repetition frequency #261

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FlightStreamDeck.Core/TOGGLE_EVENT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,9 @@ public enum TOGGLE_EVENT
MOBIFLIGHT_AS1000_PFD_CRS_INC,
MOBIFLIGHT_AS1000_PFD_CRS_DEC,
MOBIFLIGHT_AS1000_PFD_CRS_PUSH,
MOBIFLIGHT_AS1000_PFD_HEADING_INC,
MOBIFLIGHT_AS1000_PFD_HEADING_DEC,
MOBIFLIGHT_AS1000_PFD_HEADING_SYNC,
MOBIFLIGHT_AS1000_PFD_SOFTKEYS_1,
MOBIFLIGHT_AS1000_PFD_SOFTKEYS_2,
MOBIFLIGHT_AS1000_PFD_SOFTKEYS_3,
Expand Down
19 changes: 18 additions & 1 deletion FlightStreamDeck.Logics/Actions/GenericToggleAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,31 @@ protected override Task OnKeyDown(ActionEventArgs<KeyPayload> args)

if (holdEvent.HasValue)
{
timer = new Timer { Interval = settings.HoldValueRepeat ? 400 : 1000 };
int frequency = GetRepeatFrequencyForMobiflightSettings(settings, 400);
timer = new Timer { Interval = settings.HoldValueRepeat ? frequency : 1000 };

timer.Elapsed += Timer_Elapsed;
timer.Start();
}

return Task.CompletedTask;
}

private int GetRepeatFrequencyForMobiflightSettings(GenericToggleSettings settings, int defaultFreq)
nguyenquyhy marked this conversation as resolved.
Show resolved Hide resolved
{
int frequency = 0;
if (settings.HoldValue.StartsWith("MOBIFLIGHT_"))
{
int.TryParse(settings.HoldValueData, out frequency);
}
if (frequency == 0)
{
frequency = defaultFreq;
}

return frequency;
}

protected override Task OnKeyUp(ActionEventArgs<KeyPayload> args)
{
if (settings.HoldValueSuppressToggle && !holdEventTriggerred)
Expand Down