Close

[C] Scrolling and per-hand north offset

A project log for WK-50 Trackball Keyboard

Reverse-engineering a bat-shaped, hot-swappable keyboard with a 38mm trackball and RGB-backlit encoder.

kelvinakelvinA 09/05/2024 at 10:290 Comments

The good news is that I've got vertical scrolling. The bad news is that, due to an issue resulting in Code 10, I can't enable horizontal scrolling. At least I know that I need to power-cycle for boot.py to even apply in the first place:

What I've decided to do instead is vertical scrolling with a slower mouse X movement so that I can scroll and still move the cursor, such as if the mouse landed in another scrollable area (e.g. a scrollable text field on a website).

I found out how to make custom keys and made keys for push to scroll and toggle scroll. I've also added keys to have left / right hand north offset correction, and I've put them on tap-dance keys in POG:

Left Hand:  KC.TD(KC.TB_LHA,KC.TB_NOR)

Right Hand: KC.TD(KC.TB_RHA,KC.TB_NOR)

Like with 3DxPoint, I've tweaked the code to store the fractional remainder from integers sent to the host. This way, the north angle corrections should be as accurate as possible. I then used the same logic to implement scrolling. So that the fractional numbers aren't something like 0.2999999, I've used multiple-of-two divisors for the speed reduction:

scroll_speed = [1/2, 1/16]

 1/16th is a good 1 : 1 speed to the trackball, making scrolling look as smooth as it feels, but the physical angle change is rather small. 1/64 is the same speed as the scroll wheel on my G300S. 1/32nd speed feels like a middle ground. However, all this is based on the scroll setting being at 4:

Choose how many lines to scroll each time

When this is set at 1, 1/16th scroll is buttery smooth. Then, precision scrolling can be done on the scroll wheel. Alternatively, code for a toggle could be written where the speed switches between 1/16 and 1/64.

Conclusions

Like with an optical cursor square on UMPCs, I feel like the issue is that there's only a single trackball; the ideal would be dual trackballs or a spacemouse trackball. That exists, BTW, and with this 180g stainless ball, it would've been sweet.

Discussions