-
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 1 reply
-
It sounds like what you need is an ADC source for buttons, along the lines of the nudge source. Something like:
I think it would be straightforward to implement, since it's so similar to how the nudge source works, just using a different source of analog input. (Just to clarify, this would be a new feature - it's not something that exists today.) |
Beta Was this translation helpful? Give feedback.
-
If you want to take a stab at it, a good starting point should be class Button::NudgeDeviceSource (defined firmware/buttons.h and .cpp). The ADC source should work roughly the same way. The analog data would come from a class ADC object, which you'd find by via adcManager.Enumerate() (you'd enumerate the available devices and match them against the name specified in the config). |
Beta Was this translation helpful? Give feedback.
-
Thanks for the pointers. I have made a start, will see how far I get over the weekend. |
Beta Was this translation helpful? Give feedback.
-
Progress, I have something that works locally after a bit of messing about. I couldn't get the GUI to rebuild due to some issue with the NuGet packages missing but fortunately the current one still allows for unknown config to be applied so I could test out my changes. In the Button tab view I can see the cursor keys being activated, they just come up as Unkown source. The work-in-progress commit is markadr@95680bc Still to be worked on is an updated reference section for this new source and teaching the GUI about the new syntax, need to get the GUI to build to test this. Feedback welcomed.... A snip of the config, I set the button of the joystick to be a classic GPIO and then added my new adc based source for the rest:
With some debug enabled
|
Beta Was this translation helpful? Give feedback.
-
Worked out how to rebuild the UI so I updated the reference docs and checked that also worked when saving the updated config. Latest bits are in my branch - https://github.com/markadr/PinscapePico/tree/button-source-adc |
Beta Was this translation helpful? Give feedback.
-
@mjrgh any obections if I was to turn this into a pull request? |
Beta Was this translation helpful? Give feedback.
-
Definitely no objection! This would be a useful feature to add the base code. |
Beta Was this translation helpful? Give feedback.
-
Now avaliable as part of https://github.com/mjrgh/PinscapePico/releases/tag/v0.1.18 |
Beta Was this translation helpful? Give feedback.
Now avaliable as part of https://github.com/mjrgh/PinscapePico/releases/tag/v0.1.18