rules: Test: Fix divergence between crown and wheel

All wheel tests return signed rotation amounts so that they can share
the same rule to multiply the rotation, as per the example rules in the
documentation.

However, this doesn't apply to crown tests, which makes no sense as they
also return rotation amount. Hence, do the same for crown tests.

Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
Rongrong 2026-05-26 02:27:10 +08:00
parent a6a861bfc0
commit a499e8d676
No known key found for this signature in database
GPG Key ID: 1C2D45D45AB7FE94
1 changed files with 16 additions and 4 deletions

View File

@ -414,10 +414,22 @@ def charging(f, r, d, _a):
TESTS = {
"crown_right": [lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and d[1] < 128 and d[1], False],
"crown_left": [lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and d[1] >= 128 and 256 - d[1], False],
"crown_right_ratchet": [lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and d[2] < 128 and d[2], False],
"crown_left_ratchet": [lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and d[2] >= 128 and 256 - d[2], False],
"crown_right": [
lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and signed(d[1:2]) > 0 and signed(d[1:2]),
False,
],
"crown_left": [
lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and signed(d[1:2]) < 0 and signed(d[1:2]),
False,
],
"crown_right_ratchet": [
lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and signed(d[2:3]) > 0 and signed(d[2:3]),
False,
],
"crown_left_ratchet": [
lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and signed(d[2:3]) < 0 and signed(d[2:3]),
False,
],
"crown_tap": [lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and d[5] == 0x01 and True, False],
"crown_start_press": [lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and d[6] == 0x01 and True, False],
"crown_end_press": [lambda f, r, d, a: f == SupportedFeature.CROWN and r == 0 and d[6] == 0x05 and True, False],