From 245243eeddb7dc7d77fc9badec3a493b5b7fcd6e Mon Sep 17 00:00:00 2001 From: timklge <2026103+timklge@users.noreply.github.com> Date: Thu, 6 Mar 2025 23:17:34 +0100 Subject: [PATCH] Fix distance to destination retrieval (#63) --- app/manifest.json | 2 +- app/src/main/kotlin/de/timklge/karooheadwind/DataStore.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/manifest.json b/app/manifest.json index 2362ab8..5da264e 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -7,5 +7,5 @@ "latestVersionCode": 15, "developer": "timklge", "description": "Provides headwind direction, wind speed and other weather data fields", - "releaseNotes": "* Forecast weather along route in fixed intervals if route is loaded\n* Show current weather in app menu\n*Add individual forecast fields" + "releaseNotes": "* Add individual forecast fields\n* Fix forecast along route distance update" } \ No newline at end of file diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/DataStore.kt b/app/src/main/kotlin/de/timklge/karooheadwind/DataStore.kt index d1aab68..0b1fdc1 100644 --- a/app/src/main/kotlin/de/timklge/karooheadwind/DataStore.kt +++ b/app/src/main/kotlin/de/timklge/karooheadwind/DataStore.kt @@ -118,8 +118,7 @@ fun KarooSystemService.streamUpcomingRoute(): Flow { emit(null) streamDataFlow(DataType.Type.DISTANCE_TO_DESTINATION) - .map { (it as? StreamState.Streaming)?.dataPoint?.singleValue } - .filter { it != 0.0 } // FIXME why is 0 sometimes emitted if no route is loaded? + .map { (it as? StreamState.Streaming)?.dataPoint?.values?.get(DataType.Field.DISTANCE_TO_DESTINATION) } .collect { emit(it) } }