-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update pimoroni_trackball.py #1014
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intended solution is to make a completely custom handler:
class NewPointingHandler(TrackballHandler):
def handle(self, keyboard, trackball, x, y, switch, state):
if x:
AX.X.move(keyboard, x)
if y:
AX.Y.move(keyboard, y)
if switch == 1: # Button changed state
keyboard.tap(KC.ANY)
When we add a press
parameter, then we need parameters for up, down, left, right as well to be consistent, and then the existing implementations become pointless, etc...
Yes the handler implementation is stupid, I think someone just straight copied it from QMK.
In my opinion all this should be handled centrally by the keymap. Same issue with encoders and analog input.
Regardless, it should be on_press
instead of press
.
IMO while this particular trackball is indeed 2 magnetic encoders in a trench coat and each encoder is 2 switches in a trench coat, the action of rotating is conceptually different from the action of pressing. |
That one made me laugh out loud, thanks. |
Change variable names
YW!
|
I don't disagree. I wanted to point out that currently we're reimplementing a keymap (or "eventmap" if you want to address binary press/release events and continous movements equally) seperately for every peripheral, and I don't think that's a good solution. |
If you're referring to the encoder, yeah, encoder module can go and the encoder scanner can become the default way of interfacing with encoders. One caveat is that separate keymap makes user configs cleaner and should be re-implemented for scanners. For example, for each scanner we could add Side tangent to this side tangent: Now, pointing devices are their own thing entirely and can't be simplified into something along the lines of "if up mouse up" because of something to do with square roots... So how do we handle a device that can both be pointing device and an encoder and can switch its function in runtime? Preferably user config shouldn't get too cluttered as a result. |
There's the mid-term goal to directly use |
docs/en/pimoroni_trackball.md
Outdated
# on layer 1 and above use the default pointing behavior, left click when pressed | ||
PointingHandler(press=KC.MB_LMB), | ||
# use ScrollDirection.NATURAL (default) or REVERSE to change the scrolling direction, left click when pressed | ||
ScrollHandler(scroll_direction=ScrollDirection.NATURAL, press=KC.MB_LMB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs better documentation. It looks like the press
argument is required, and since no one is looking up the source code when using KMK for the first time, they will copy-paste anything without a care in the world.
Maybe a small subsection about existing handlers, their arguments and an example of a custom one? (That would also reduce the need for a customizable press event)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll amend the docs in the next PR.
Expose
press
variable in the constructors of of handlers that had it hardcoded