Compare commits
4 Commits
1f27a33b64
...
1b450c00d9
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b450c00d9 | |||
|
|
e7d11c2000 | ||
|
|
1fe7eb1a16 | ||
|
|
917770e45a |
@ -34,7 +34,7 @@ After installing this app on your Karoo and opening it once from the main menu,
|
||||
The app can use OpenMeteo or OpenWeatherMap as providers for live weather data.
|
||||
|
||||
- OpenMeteo is the default provider and does not require any configuration. Wind speed will be reported in km/h if your karoo is set to metric units or mph if set to imperial.
|
||||
- OpenWeatherMap can provide more accurate data for some locations. Forecasts along the loaded route are not available using OpenWeatherMap. OpenWeatherMap is free for personal use, but you need to register at https://openweathermap.org/home/sign_in and obtain a one call API key (e. g. by subscribing to "One Call API 3.0" from the [pricing page](https://openweathermap.org/price)). You can enter your API key in the app settings. Please note that it can take a few hours before OpenWeatherMap enables the key. You can check if your key is enabled by entering it in the app settings and pressing "Test API Key". Wind speed will be reported in meters per second if your Karoo is set to metric units and miles per hour if set to imperial.
|
||||
- OpenWeatherMap can provide more accurate data for some locations. Forecasts along the loaded route are not available using OpenWeatherMap. OpenWeatherMap is free for personal use, but you need to register at https://openweathermap.org/home/sign_in and obtain a one call API key (e. g. by subscribing to "One Call API 3.0" from the [pricing page](https://openweathermap.org/price)). You can enter your API key in the app settings. Please note that it can take a few hours before OpenWeatherMap enables the key. You can check if your key is enabled by entering it in the app settings and pressing "Test API Key". Wind speed will be reported in km/h if your Karoo is set to metric units and miles per hour if set to imperial.
|
||||
|
||||
The app will automatically attempt to download weather data from the selected data provider once your device has acquired a GPS fix. Your location is rounded to approximately three kilometers to maintain privacy.
|
||||
New weather data is downloaded when you ride more than three kilometers from the location where the weather data was downloaded for or after one hour at the latest.
|
||||
|
||||
@ -72,7 +72,7 @@ tasks.register("generateManifest") {
|
||||
"latestVersionCode" to android.defaultConfig.versionCode,
|
||||
"developer" to "github.com/timklge",
|
||||
"description" to "Open-source extension that provides headwind direction, wind speed, forecast and other weather data fields.",
|
||||
"releaseNotes" to "* Add UV-index datafield (thx @saversux!)\n* Readd a datafield that shows headwind direction and absolute wind speed datafield\n* Split wind forecast field into wind and headwind forecast fields",
|
||||
"releaseNotes" to "* Fix unit of plain wind gust / speed datafield\n* Fix headwind forecast preview\n* Add UV-index datafield (thx @saversux!)\n* Readd a datafield that shows headwind direction and absolute wind speed datafield",
|
||||
"screenshotUrls" to listOf(
|
||||
"$baseUrl/preview1.png",
|
||||
"$baseUrl/preview3.png",
|
||||
|
||||
@ -55,7 +55,6 @@ class HeadwindForecastDataType(karooSystem: KarooSystemService) : LineGraphForec
|
||||
}
|
||||
|
||||
val headwindPoints = try {
|
||||
if (upcomingRoute != null){
|
||||
(0..<HEADWIND_SAMPLE_COUNT).mapNotNull { i ->
|
||||
val t = i / HEADWIND_SAMPLE_COUNT.toDouble()
|
||||
|
||||
@ -67,6 +66,11 @@ class HeadwindForecastDataType(karooSystem: KarooSystemService) : LineGraphForec
|
||||
y = headwindSpeed)
|
||||
}
|
||||
|
||||
if (upcomingRoute == null) {
|
||||
Log.e(KarooHeadwindExtension.TAG, "Upcoming route is null")
|
||||
return@mapNotNull null
|
||||
}
|
||||
|
||||
val beforeLineData = lineData.getOrNull(floor((lineData.size) * t).toInt().coerceAtLeast(0)) ?: lineData.firstOrNull()
|
||||
val afterLineData = lineData.getOrNull(ceil((lineData.size) * t).toInt().coerceAtLeast(0)) ?: lineData.lastOrNull()
|
||||
|
||||
@ -115,9 +119,6 @@ class HeadwindForecastDataType(karooSystem: KarooSystemService) : LineGraphForec
|
||||
y = headwindSpeedInUserUnit.toFloat()
|
||||
)
|
||||
}
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
} catch(e: Exception) {
|
||||
Log.e(KarooHeadwindExtension.TAG, "Error calculating headwind points", e)
|
||||
emptyList()
|
||||
|
||||
@ -3,10 +3,15 @@ package de.timklge.karooheadwind.datatypes
|
||||
import android.content.Context
|
||||
import de.timklge.karooheadwind.weatherprovider.WeatherData
|
||||
import io.hammerhead.karooext.KarooSystemService
|
||||
import io.hammerhead.karooext.models.DataType
|
||||
import io.hammerhead.karooext.models.UserProfile
|
||||
|
||||
class WindGustsDataType(karooSystemService: KarooSystemService, context: Context) : BaseDataType(karooSystemService, context, "windGusts"){
|
||||
override fun getValue(data: WeatherData, userProfile: UserProfile): Double {
|
||||
return data.windGusts
|
||||
}
|
||||
|
||||
override fun getFormatDataType(): String {
|
||||
return DataType.Type.SPEED
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,15 @@ package de.timklge.karooheadwind.datatypes
|
||||
import android.content.Context
|
||||
import de.timklge.karooheadwind.weatherprovider.WeatherData
|
||||
import io.hammerhead.karooext.KarooSystemService
|
||||
import io.hammerhead.karooext.models.DataType
|
||||
import io.hammerhead.karooext.models.UserProfile
|
||||
|
||||
class WindSpeedDataType(karooSystemService: KarooSystemService, context: Context) : BaseDataType(karooSystemService, context, "windSpeed"){
|
||||
override fun getValue(data: WeatherData, userProfile: UserProfile): Double {
|
||||
return data.windSpeed
|
||||
}
|
||||
|
||||
override fun getFormatDataType(): String {
|
||||
return DataType.Type.SPEED
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user