mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-19 20:45:18 -05:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user