qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

Replace pimoroni trackball driver.

Open daskygit opened this issue 2 years ago • 3 comments

Description

WIP

Types of Changes

  • [x] Core
  • [ ] Bugfix
  • [ ] New feature
  • [ ] Enhancement/optimization
  • [ ] Keyboard (addition or update)
  • [ ] Keymap/layout/userspace (addition or update)
  • [x] Documentation

Issues Fixed or Closed by This PR

Checklist

  • [x] My code follows the code style of this project: C, Python
  • [x] I have read the PR Checklist document and have made the appropriate changes.
  • [x] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [ ] I have tested the changes and verified that they work and don't break anything (as well as I can manage).

daskygit avatar Sep 30 '22 17:09 daskygit

Tested it and it runs smoothly. Only problem is, the cursor moves so slow/less even if i turn up the settings in the Mac System Mouse preferences. Any solution for that?

BenRoe avatar Jan 04 '23 13:01 BenRoe

Tested it and it runs smoothly. Only problem is, the cursor moves so slow/less even if i turn up the settings in the Mac System Mouse preferences. Any solution for that?

@BenRoe I haven't pushed this any further as the driver behaves differently depending on how frequently the trackball is polled. A solution could be to limit the polling rate with #define POINTING_DEVICE_TASK_THROTTLE_MS 8 in config.h, would you mind testing this? It should accelerate with quick repeated trackball movements.

daskygit avatar Jan 04 '23 13:01 daskygit

#define POINTING_DEVICE_TASK_THROTTLE_MS 8

Hello, ~~i test it with Throttle_MS but it's jaggy.~~ [Used wrong branch] Works much better with #define POINTING_DEVICE_TASK_THROTTLE_MS 8 Also found out that the ball rolling mechanism was defective. Replaced it from an other Trackball module.

BenRoe avatar Jan 06 '23 14:01 BenRoe

Hi! This has completely changed my experience with the Pimoroni. The only downside is that I seem to have lost its LED functionality. Previously, I was using:

void keyboard_post_init_user(void) { pimoroni_trackball_set_rgbw(0,0,0,100); }

That code doesn't seem to work with your driver. Is there another way that I can talk to the LED or something that I am missing? Thanks!

podnaut avatar Jan 15 '23 19:01 podnaut

It should still be working, I did add a check so it'll only write if there's been a successful read. I guess there might be a condition on boot where the i2c read isn't successful. You mind trying this instead as a test? @mbissonn

void housekeeping_task_user(void) {
    pimoroni_trackball_set_rgbw(0,0,0,100);
}

The above code will run every loop.

daskygit avatar Jan 15 '23 19:01 daskygit

No luck with the LED, but running the command every loop did noticeably decrease the smoothness for me.

podnaut avatar Jan 15 '23 23:01 podnaut

No luck with the LED, but running the command every loop did noticeably decrease the smoothness for me.

Do you have discord? Probably better to do the troubleshooting on there if we can. https://discord.com/invite/Uq7gcHh

daskygit avatar Jan 17 '23 17:01 daskygit

I just tested this PR, and in order to use it with the rebased version of QMK it requires one change in line 80 of pimoroni_trackball.c:

pd_dprintf("Trackball READ i2c_status_t: %d L: %d R: %d Up: %d D: %d SW: %d\n", last_i2c_status, data->left, data->right, data->up, data->down, data->click);

Gotta say, it behaves MUCH better when using it in combination with #define POINTING_DEVICE_TASK_THROTTLE_MS 8.

Now my question is.. why is this not merged? Is there a problem/bug in it? I am not so well versed in this device but it looks good to me

lucacri avatar Feb 23 '23 00:02 lucacri

Mostly, it's just waiting on dasky to confirm that it's ready to go.

drashna avatar Mar 10 '23 07:03 drashna

I apologise for the delay, this has sat far too long now. I will be closing this PR without merge.

The expected behaviour only really works with a polling rate of 8ms as polling at faster rates reduces to the movement deltas to 1-2. I'll probably try for a simpler driver again at some point in the future.

daskygit avatar Aug 17 '23 21:08 daskygit