Open
Conversation
on function
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I have been trying to get the explorerhat examples working on a Pi 3+ with little success, e.g. for some reason the drums example [1] was just hanging.
[1] https://github.com/pimoroni/explorer-hat/blob/a1f9e2100b1c7589c4a59e1879a14c79ddfa46cc/examples/drums.py
Diagnostics I tried
I checked using i2cget command and the underlying chip seemed to be working ok,
i2cget -y 1 0x28 0x00showed 0x00 normally and 0x01 after a press.I then tried using the smbus2 library directly which had good results.
I then tried cap1xxx library directly, and although
get_input_statuscorrectly detected pressed keys, for some reason adding a handler withonresulted in the handler never being called.After learning python and digging around it seems the issue is that the _poll function returns
None, which is falsey and causes the AsyncWorker to terminate after just one cycle.It seems to have been broken since 1.0.0 was released by this change
a559084#diff-f43d9811b15ccf64ed546598f09b8c89ae71f99b5651336f37d4bc8a327c6480R238
This PR
This PR adds an explicit
return Trueto ensure that the ASyncWorker can continue to poll, which fixes the issue locally and seems to be the correct fix (as I assume the above change that broke it was best practice from a linter or similar)If we prefer to revert the above to the explicit False check, then that would also be fine.