Use core pmw33xx_set_cpi() function in keyball_set_cpi()

QMK's core PMW3360 driver uses the true CPI value internally, so we have
to translate the Keyball library's value to QMK's expected range.

QMK's core driver also caps the range internally to a valid CPI value,
so we don't need to do it here.
This commit is contained in:
James Young 2024-06-13 03:55:28 -07:00
parent 6d9c10235f
commit 3b2529ccd2
No known key found for this signature in database
GPG Key ID: 87CBD151019773A8

View File

@ -505,7 +505,15 @@ void keyball_set_cpi(uint8_t cpi) {
keyball.cpi_value = cpi;
keyball.cpi_changed = true;
if (keyball.this_have_ball) {
pmw3360_cpi_set(cpi == 0 ? CPI_DEFAULT - 1 : cpi - 1);
/**
* QMK's core PMW3360 driver uses the true CPI value internally, so we
* have to translate the Keyball library's value to QMK's expected
* range.
*
* QMK's core driver also caps the range internally to a valid CPI
* value, so we don't need to do it here.
*/
pmw33xx_set_cpi(0, (cpi + 1) * 100);
}
}