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
@@ -11,14 +11,14 @@ public class UintUtils {
/**
* Computes a - b for UINT with overflow (b < a).
*
* @return diff or -1 (invalid)
* @return diff
*/
public static long diff(long a, long b, final long UINT_MAX) {
if (a < 0 || b < 0) {
return -1;
throw new RuntimeException("a or b cannot be less than zero.");
}
if (a > UINT_MAX || b > UINT_MAX) {
return -1;
throw new RuntimeException("a or b are outside of the allowed range." + a + " " + b);
}
if (a >= b) {