feat: Lane assist
This commit is contained in:
parent
f5ec500343
commit
386bb50621
3 changed files with 33 additions and 12 deletions
|
@ -6,8 +6,10 @@ import android.bluetooth.BluetoothDevice
|
|||
import android.bluetooth.BluetoothSocket
|
||||
import android.util.Log
|
||||
import com.mapbox.navigation.tripdata.maneuver.model.Maneuver
|
||||
import eu.ztsh.garmin.data.Arrows
|
||||
import eu.ztsh.garmin.data.DataCache
|
||||
import eu.ztsh.garmin.data.GarminMapper
|
||||
import eu.ztsh.garmin.data.Lanes
|
||||
import eu.ztsh.garmin.data.MapboxMapper
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
@ -54,6 +56,14 @@ class Garmin(
|
|||
if (maybeItem != null) {
|
||||
Log.d(TAG, "mapAndSend (${currentThread().name}): got new")
|
||||
var changed = false
|
||||
if (cache.hasChanged(maybeItem.primary)) {
|
||||
changed = true
|
||||
Log.d(TAG, "mapAndSend: primary")
|
||||
send(GarminMapper.map(MapboxMapper.asDirection(maybeItem)))
|
||||
if (maybeItem.laneGuidance == null) {
|
||||
send(GarminMapper.map(Lanes(Arrows(setOf()), Arrows(setOf()))))
|
||||
}
|
||||
}
|
||||
if (cache.hasChanged(maybeItem.laneGuidance)) {
|
||||
changed = true
|
||||
Log.d(TAG, "mapAndSend: lanes")
|
||||
|
@ -64,11 +74,6 @@ class Garmin(
|
|||
Log.d(TAG, "mapAndSend: stepDistance")
|
||||
send(GarminMapper.map(MapboxMapper.asDistance(maybeItem)))
|
||||
}
|
||||
if (cache.hasChanged(maybeItem.primary)) {
|
||||
changed = true
|
||||
Log.d(TAG, "mapAndSend: primary")
|
||||
send(GarminMapper.map(MapboxMapper.asDirection(maybeItem)))
|
||||
}
|
||||
if (changed) {
|
||||
return maybeItem
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue