-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bugs where forwarded events wouldn't be recognised
- Loading branch information
1 parent
34a906a
commit a71873c
Showing
6 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
|
||
// Spell checker | ||
"cSpell.words": [ | ||
"buttondatastrat", | ||
"capsys", | ||
"deinitialise", | ||
"dicttools", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
from common.types import eventData | ||
from controlsurfaces import IValueStrategy | ||
|
||
|
||
class HammerButtonStrat(IValueStrategy): | ||
""" | ||
Strategy for buttons on Hammer 88 Pro | ||
Since it mashes events together we need a special way to get the data | ||
""" | ||
def __init__(self, on: int) -> None: | ||
""" | ||
Create Hammer 88 Pro button value strategy | ||
### Args: | ||
* `on` (`int`): value interpreted as a press (all others will be | ||
interpreted as a release) | ||
""" | ||
self._on = on | ||
super().__init__() | ||
|
||
def getValueFromEvent(self, event: eventData): | ||
return event.data2 == self._on | ||
|
||
def getValueFromFloat(self, f: float): | ||
return f == 1.0 | ||
|
||
def getFloatFromValue(self, value) -> float: | ||
return 1.0 if value else 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters