From 0e22c02da3ca476cf542ceaa9192e1353bc90ceb Mon Sep 17 00:00:00 2001 From: Piotr Dec Date: Thu, 1 Aug 2024 01:14:16 +0200 Subject: [PATCH] fix: Distance comma fixed --- app/src/main/java/eu/ztsh/garmin/data/GarminMapper.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/ztsh/garmin/data/GarminMapper.kt b/app/src/main/java/eu/ztsh/garmin/data/GarminMapper.kt index 11757f5..7367a25 100644 --- a/app/src/main/java/eu/ztsh/garmin/data/GarminMapper.kt +++ b/app/src/main/java/eu/ztsh/garmin/data/GarminMapper.kt @@ -81,14 +81,14 @@ class GarminMapper { } private fun setDistance(distance: Double, unit: Unit = Unit.Any): IntArray { - val isDecimal = (distance * 10).toInt() == (distance.toInt() * 10) + val isDecimal = (distance * 10).toInt() != (distance.toInt() * 10) val distanceValue = if (isDecimal) distance * 10 else distance return intArrayOf( 0x03, asDigit(distanceValue / 1000), // position 1 asDigit(distanceValue / 100), // position 2 asDigit(distanceValue / 10), // position 3 - if (isDecimal) 0x00 else 0xff, // comma + if (isDecimal) 0xff else 0x00, // comma asDigit(distanceValue), // position 4 unit.value // unit )