1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 10:35:50 +01:00

Zepp OS: Use WeatherSpec gps coordinates for sunset if available

This commit is contained in:
José Rebelo 2023-08-27 16:23:19 +01:00
parent 495a8dec89
commit 88b72d51c8

View File

@ -202,6 +202,11 @@ public class Huami2021Weather {
weather.add(new Range(currentWeatherCode, currentWeatherCode));
if (weatherSpec.sunRise != 0 && weatherSpec.sunSet != 0) {
sunRiseSet.add(getSunriseSunset(new Date(weatherSpec.sunRise * 1000L), new Date(weatherSpec.sunSet * 1000L)));
} else if (weatherSpec.latitude != 0 && weatherSpec.longitude != 0) {
final Location weatherSpecLocation = new Location("weatherSpec");
weatherSpecLocation.setLatitude(weatherSpec.latitude);
weatherSpecLocation.setLatitude(weatherSpec.longitude);
sunRiseSet.add(getSunriseSunset(sunriseDate, weatherSpecLocation));
} else {
sunRiseSet.add(getSunriseSunset(sunriseDate, lastKnownLocation));
}