Unified with python var names

This commit is contained in:
Piotr Dec 2023-08-21 16:57:48 +02:00
parent 385234bfd9
commit 379dd7118a
No known key found for this signature in database
GPG key ID: ABD6CB83D6110D27
3 changed files with 22 additions and 28 deletions

View file

@ -41,6 +41,7 @@ class Garmin(
private inner class ProcessingThread(val maneuver: Maneuver) : Thread() {
override fun run() {
// TODO: check for equality before mapping!
send(ManeuverMapper.apply(maneuver))
}
@ -57,23 +58,23 @@ class Garmin(
private fun setDistance(state: eu.ztsh.garmin.State) {
connection.enqueue(intArrayOf(
0x03, asDigit(state.distance / 1000), asDigit(state.distance / 100), asDigit(state.distance / 10),
0x00, asDigit(state.distance), state.unit.data
0x00, asDigit(state.distance), state.unit.value
))
}
private fun setDirection(direction: Direction) {
val param1 = when (direction.outAngle) {
val param1: Int = when (direction.angle) {
OutAngle.LeftDown -> 0x10
OutAngle.RightDown -> 0x20
else -> direction.outType.data
else -> direction.out.value
}
val param2: Int = if (direction.outType == OutType.RightRoundabout
|| direction.outType == OutType.LeftRoundabout) {
if (direction.roundabout == OutAngle.AsDirection) direction.outAngle.data else direction.roundabout.data
val param2: Int = if (direction.out == OutType.RightRoundabout
|| direction.out == OutType.LeftRoundabout) {
if (direction.roundabout == OutAngle.AsDirection) direction.angle.value else direction.roundabout.value
} else {
0x00
}
val param3: Int = if (direction.outAngle == OutAngle.LeftDown || direction.outAngle == OutAngle.RightDown) 0x00 else direction.outAngle.data
val param3: Int = if (direction.angle == OutAngle.LeftDown || direction.angle == OutAngle.RightDown) 0x00 else direction.angle.value
connection.enqueue(intArrayOf(0x01, param1, param2, param3))
}