Peripheral API v1.1.0: Fix mapping D-pad on RPi for some controllers #10364
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some controllers send both a button press and an axis change when the D-pad is pressed. To compensate for this, I added a "cooldown" to Kodi so that input arriving within 50ms would be ignored.
A design decision I made in #8807 was to save the button map to the disk after every button press (it simplified the API). When the button map was saved, it would trigger a refresh, and Kodi would hit the disk another few times to calculate the updated button map. I suspect these disk accesses were adding up to >50ms, which is why Kodi wasn't ignoring the second driver input.
This PR adds a SaveButtonMap() function to the peripheral API and only saves the button map when the button-mapping wizard comes to an end.
Also included is a pot-pourri of improvements, some of which the v1.1.0 bump relies on.
Corresponds to https://github.com/kodi-game/peripheral.joystick/pull/50