Bugfix: cycling sensors report wheel count as UINT32.

Garmin Speed Sensor 2 actually counts forward: it was an UINT16 overflow problem (removed workaround).

Fixes #810.
This commit is contained in:
Dennis Guse
2021-06-10 21:22:40 +02:00
parent 2f0449c420
commit 40188774b1
5 changed files with 32 additions and 14 deletions
@@ -0,0 +1,23 @@
package de.dennisguse.opentracks.util;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class UintUtilsTest {
@Test
public void diff() {
assertEquals(0, UintUtils.diff(1, 1, UintUtils.UINT16_MAX));
assertEquals(1, UintUtils.diff(2, 1, UintUtils.UINT16_MAX));
assertEquals(3, UintUtils.diff(5, 2, UintUtils.UINT16_MAX));
assertEquals(65534, UintUtils.diff(1, 2, UintUtils.UINT16_MAX));
assertEquals(65530, UintUtils.diff(UintUtils.UINT16_MAX, 5, UintUtils.UINT16_MAX));
}
@Test
public void realData() {
assertEquals(3, UintUtils.diff(381616, 381615, UintUtils.UINT32_MAX));
}
}