fix(behaviors): correctly handle sensor rotation remainder (#3084)

The original condition was always true, this commit fixes the condition
to correctly handle the remainder for sensor rotation behaviors by using
abs().

Co-authored-by: schuay <schuay@users.noreply.github.com>
This commit is contained in:
Jakob Linke 2025-12-10 09:49:34 +01:00 committed by GitHub
parent 3c0f0af947
commit 958fa78806
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -34,7 +34,7 @@ int zmk_behavior_sensor_rotate_common_accept_data(
remainder.val1 += value.val1;
remainder.val2 += value.val2;
if (remainder.val2 >= 1000000 || remainder.val2 <= 1000000) {
if (abs(remainder.val2) >= 1000000) {
remainder.val1 += remainder.val2 / 1000000;
remainder.val2 %= 1000000;
}