diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index dfe393f..727a8b4 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -15,8 +15,8 @@ android {
applicationId = "de.timklge.karooheadwind"
minSdk = 26
targetSdk = 35
- versionCode = 11
- versionName = "1.2.3"
+ versionCode = 12
+ versionName = "1.2.4"
}
signingConfigs {
diff --git a/app/manifest.json b/app/manifest.json
index a225906..31276bb 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -3,9 +3,9 @@
"packageName": "de.timklge.karooheadwind",
"iconUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/karoo-headwind.png",
"latestApkUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/app-release.apk",
- "latestVersion": "1.2.3",
- "latestVersionCode": 11,
+ "latestVersion": "1.2.4",
+ "latestVersionCode": 12,
"developer": "timklge",
"description": "Provides headwind direction, wind speed and other weather data fields",
- "releaseNotes": "Update gps bearing retrieval, data type exposure for other extensions, optimize build"
+ "releaseNotes": "Add sealevel pressure data type"
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/KarooHeadwindExtension.kt b/app/src/main/kotlin/de/timklge/karooheadwind/KarooHeadwindExtension.kt
index 58c53cd..a88db23 100644
--- a/app/src/main/kotlin/de/timklge/karooheadwind/KarooHeadwindExtension.kt
+++ b/app/src/main/kotlin/de/timklge/karooheadwind/KarooHeadwindExtension.kt
@@ -11,6 +11,7 @@ import de.timklge.karooheadwind.datatypes.WindGustsDataType
import de.timklge.karooheadwind.datatypes.HeadwindSpeedDataType
import de.timklge.karooheadwind.datatypes.TailwindAndRideSpeedDataType
import de.timklge.karooheadwind.datatypes.HeadwindDirectionDataType
+import de.timklge.karooheadwind.datatypes.SealevelPressureDataType
import de.timklge.karooheadwind.datatypes.TemperatureDataType
import de.timklge.karooheadwind.datatypes.UserWindSpeedDataType
import de.timklge.karooheadwind.datatypes.WeatherDataType
@@ -42,7 +43,7 @@ import kotlin.math.absoluteValue
import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.minutes
-class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.2.3") {
+class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.2.4") {
companion object {
const val TAG = "karoo-headwind"
}
@@ -68,6 +69,7 @@ class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.2.3") {
WindDirectionDataType(karooSystem, applicationContext),
PrecipitationDataType(applicationContext),
SurfacePressureDataType(applicationContext),
+ SealevelPressureDataType(applicationContext),
UserWindSpeedDataType(karooSystem, applicationContext)
)
}
diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/OpenMeteo.kt b/app/src/main/kotlin/de/timklge/karooheadwind/OpenMeteo.kt
index a1add54..a800908 100644
--- a/app/src/main/kotlin/de/timklge/karooheadwind/OpenMeteo.kt
+++ b/app/src/main/kotlin/de/timklge/karooheadwind/OpenMeteo.kt
@@ -24,8 +24,8 @@ suspend fun KarooSystemService.makeOpenMeteoHttpRequest(gpsCoordinates: GpsCoord
val temperatureUnit = if (profile?.preferredUnit?.temperature != UserProfile.PreferredUnit.UnitType.IMPERIAL) TemperatureUnit.CELSIUS else TemperatureUnit.FAHRENHEIT
return callbackFlow {
- // https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t=surface_pressure,temperature_2m,relative_humidity_2m,precipitation,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&hourly=temperature_2m,precipitation_probability,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timeformat=unixtime&past_hours=1&forecast_days=1&forecast_hours=12
- val url = "https://api.open-meteo.com/v1/forecast?latitude=${gpsCoordinates.lat}&longitude=${gpsCoordinates.lon}¤t=surface_pressure,temperature_2m,relative_humidity_2m,precipitation,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&hourly=temperature_2m,precipitation_probability,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timeformat=unixtime&past_hours=0&forecast_days=1&forecast_hours=12&wind_speed_unit=${settings.windUnit.id}&precipitation_unit=${precipitationUnit.id}&temperature_unit=${temperatureUnit.id}"
+ // https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t=surface_pressure,pressure_msl,temperature_2m,relative_humidity_2m,precipitation,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&hourly=temperature_2m,precipitation_probability,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timeformat=unixtime&past_hours=1&forecast_days=1&forecast_hours=12
+ val url = "https://api.open-meteo.com/v1/forecast?latitude=${gpsCoordinates.lat}&longitude=${gpsCoordinates.lon}¤t=surface_pressure,pressure_msl,temperature_2m,relative_humidity_2m,precipitation,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&hourly=temperature_2m,precipitation_probability,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timeformat=unixtime&past_hours=0&forecast_days=1&forecast_hours=12&wind_speed_unit=${settings.windUnit.id}&precipitation_unit=${precipitationUnit.id}&temperature_unit=${temperatureUnit.id}"
Log.d(KarooHeadwindExtension.TAG, "Http request to ${url}...")
diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/OpenMeteoData.kt b/app/src/main/kotlin/de/timklge/karooheadwind/OpenMeteoData.kt
index 0408dd1..c960c5a 100644
--- a/app/src/main/kotlin/de/timklge/karooheadwind/OpenMeteoData.kt
+++ b/app/src/main/kotlin/de/timklge/karooheadwind/OpenMeteoData.kt
@@ -11,6 +11,7 @@ data class OpenMeteoData(
@SerialName("precipitation") val precipitation: Double,
@SerialName("cloud_cover") val cloudCover: Int,
@SerialName("surface_pressure") val surfacePressure: Double,
+ @SerialName("pressure_msl") val sealevelPressure: Double,
@SerialName("wind_speed_10m") val windSpeed: Double,
@SerialName("wind_direction_10m") val windDirection: Double,
@SerialName("wind_gusts_10m") val windGusts: Double,
diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/SealevelPressureDataType.kt b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/SealevelPressureDataType.kt
new file mode 100644
index 0000000..00cb370
--- /dev/null
+++ b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/SealevelPressureDataType.kt
@@ -0,0 +1,10 @@
+package de.timklge.karooheadwind.datatypes
+
+import android.content.Context
+import de.timklge.karooheadwind.OpenMeteoCurrentWeatherResponse
+
+class SealevelPressureDataType(context: Context) : BaseDataType(context, "sealevelPressure"){
+ override fun getValue(data: OpenMeteoCurrentWeatherResponse): Double {
+ return data.current.sealevelPressure
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/WeatherDataType.kt b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/WeatherDataType.kt
index 1abeb7a..625938b 100644
--- a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/WeatherDataType.kt
+++ b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/WeatherDataType.kt
@@ -80,7 +80,7 @@ class WeatherDataType(
while (true){
emit(StreamData(
OpenMeteoCurrentWeatherResponse(
- OpenMeteoData(Instant.now().epochSecond, 0, 20.0, 50, 3.0, 0, 1013.25, 15.0, 30.0, 30.0, WeatherInterpretation.getKnownWeatherCodes().random()),
+ OpenMeteoData(Instant.now().epochSecond, 0, 20.0, 50, 3.0, 0, 1013.25, 980.0, 15.0, 30.0, 30.0, WeatherInterpretation.getKnownWeatherCodes().random()),
0.0, 0.0, "Europe/Berlin", 30.0, 0,
null
diff --git a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/WeatherForecastDataType.kt b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/WeatherForecastDataType.kt
index 04d7b18..0fcd683 100644
--- a/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/WeatherForecastDataType.kt
+++ b/app/src/main/kotlin/de/timklge/karooheadwind/datatypes/WeatherForecastDataType.kt
@@ -131,7 +131,7 @@ class WeatherForecastDataType(
emit(
StreamData(
OpenMeteoCurrentWeatherResponse(
- OpenMeteoData(Instant.now().epochSecond, 0, 20.0, 50, 3.0, 0, 1013.25, 15.0, 30.0, 30.0, WeatherInterpretation.getKnownWeatherCodes().random()),
+ OpenMeteoData(Instant.now().epochSecond, 0, 20.0, 50, 3.0, 0, 1013.25, 980.0, 15.0, 30.0, 30.0, WeatherInterpretation.getKnownWeatherCodes().random()),
0.0, 0.0, "Europe/Berlin", 30.0, 0,
OpenMeteoForecastData(forecastTimes, forecastTemperatures, forecastPrecipitationPropability,
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 98e2457..0162395 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -19,6 +19,8 @@
Current precipitation (rainfall / snowfall)
Surface pressure
Atmospheric pressure at surface in configured unit
+ Sealevel pressure
+ Atmospheric pressure at sea level in configured unit
Weather
Current weather conditions
Weather Forecast
diff --git a/app/src/main/res/xml/extension_info.xml b/app/src/main/res/xml/extension_info.xml
index d45cc54..3173920 100644
--- a/app/src/main/res/xml/extension_info.xml
+++ b/app/src/main/res/xml/extension_info.xml
@@ -95,6 +95,13 @@
icon="@drawable/ic_cloud"
typeId="surfacePressure" />
+
+