1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 19:36: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)); weather.add(new Range(currentWeatherCode, currentWeatherCode));
if (weatherSpec.sunRise != 0 && weatherSpec.sunSet != 0) { if (weatherSpec.sunRise != 0 && weatherSpec.sunSet != 0) {
sunRiseSet.add(getSunriseSunset(new Date(weatherSpec.sunRise * 1000L), new Date(weatherSpec.sunSet * 1000L))); 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 { } else {
sunRiseSet.add(getSunriseSunset(sunriseDate, lastKnownLocation)); sunRiseSet.add(getSunriseSunset(sunriseDate, lastKnownLocation));
} }