Fix distance to destination retrieval (#63)

This commit is contained in:
timklge 2025-03-06 23:17:34 +01:00 committed by GitHub
parent aaeb1204bf
commit 245243eedd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -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"
}

View File

@ -118,8 +118,7 @@ fun KarooSystemService.streamUpcomingRoute(): Flow<UpcomingRoute?> {
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) }
}