fix: Distance comma fixed
This commit is contained in:
parent
bbfeabc0e4
commit
0e22c02da3
1 changed files with 2 additions and 2 deletions
|
@ -81,14 +81,14 @@ class GarminMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setDistance(distance: Double, unit: Unit = Unit.Any): IntArray {
|
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
|
val distanceValue = if (isDecimal) distance * 10 else distance
|
||||||
return intArrayOf(
|
return intArrayOf(
|
||||||
0x03,
|
0x03,
|
||||||
asDigit(distanceValue / 1000), // position 1
|
asDigit(distanceValue / 1000), // position 1
|
||||||
asDigit(distanceValue / 100), // position 2
|
asDigit(distanceValue / 100), // position 2
|
||||||
asDigit(distanceValue / 10), // position 3
|
asDigit(distanceValue / 10), // position 3
|
||||||
if (isDecimal) 0x00 else 0xff, // comma
|
if (isDecimal) 0xff else 0x00, // comma
|
||||||
asDigit(distanceValue), // position 4
|
asDigit(distanceValue), // position 4
|
||||||
unit.value // unit
|
unit.value // unit
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue