-
Notifications
You must be signed in to change notification settings - Fork 50
Description
Hello Peter,
I am working on a project involving a Pico 2 W, a custom Micropython build (to give me more Bluetooth client connections), a Pimoroni Pico Display 2.8 and an AdaFruit I2C rotary encoder module - https://www.adafruit.com/product/4991
What is your recommended method to add support for this encoder?
I've read the other issues relating to rotary encoders. Well, this one is cheap, popular and well documented.
I have attempted an implementation using the VButton class, where I have implemented gui_op_id's 0, 1 and 2 for prev, select and next.
When I call the display constructor, I have passed my device instance in as follows:
display = Display(ssd, *(VButton(dfr) for x in range(5)))
However, when I run your slider_label demo, whilst I can change between gui elements and even exit the app, I am unable to adjust the slider value. I notice that the gui reports that it is 'Using 5 switches', which I guess it would!
But I don't have 5 switches. I have three. I am guessing this is my problem - the gui is expecting widget value adjustments using the increment and decrement buttons (which I don't have).
So I tried constructing the Display as follows:
increase = None
decrease = None
display = Display(ssd, *(VButton(dfr) for x in range(3)), increase, decrease)
...but that just hangs without displaying anything. Is that a bug or 'by design'? Shouldn't I be able to run a mixture of buttons, VButtons and no buttons? My assumption of the problem here is that when using VButton, the system always assumes that you will implement 5 buttons using VButtons, and that less than a 5 buttons implementation is not supported. Furthermore, this approach was not intended to be mixed with physical buttons.
If the above approach is never going to work, I would be happy to write my own primitive for this piece of hardware. But I am somewhat put-off this approach, having seen the pull request where it seems necessary to modify the core code to add what is really a plug-in. Is the pull request OTT to solve the problem? Or is it possible to create a new primitive for my chosen hardware without modifying the core code?
Thanks for any advice.
Stephen Done