Skip to content

fix broken on function#24

Open
johnduffell wants to merge 1 commit intopimoroni:masterfrom
johnduffell:patch-1
Open

fix broken on function#24
johnduffell wants to merge 1 commit intopimoroni:masterfrom
johnduffell:patch-1

Conversation

@johnduffell
Copy link
Copy Markdown

@johnduffell johnduffell commented Apr 8, 2026

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 0x00 showed 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_status correctly detected pressed keys, for some reason adding a handler with on resulted 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 True to 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.

@johnduffell johnduffell changed the title stop listener polling stopping after one cycle fix broken on function Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant