mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-09 03:37:03 +01:00
Huawei: Fix for weather
- Also the sunrise/set cannot be zero - We could send a single forecast more when exactly 7 are provided - It seems like the watches may require exactly 8 days to be sent for the forecast - one of which is for today
This commit is contained in:
parent
ecda7b9f78
commit
2dbf70cb77
@ -628,9 +628,9 @@ public class Weather {
|
||||
dayTlv.put(0x15, dayData.lowTemperature);
|
||||
}
|
||||
if (settings.sunRiseSetSupported) {
|
||||
if (dayData.sunriseTime != null)
|
||||
if (dayData.sunriseTime != null && dayData.sunriseTime != 0)
|
||||
dayTlv.put(0x16, dayData.sunriseTime);
|
||||
if (dayData.sunsetTime != null)
|
||||
if (dayData.sunsetTime != null && dayData.sunsetTime != 0)
|
||||
dayTlv.put(0x17, dayData.sunsetTime);
|
||||
if (dayData.moonRiseTime != null && dayData.moonRiseTime != 0)
|
||||
dayTlv.put(0x1a, dayData.moonRiseTime);
|
||||
|
@ -40,7 +40,7 @@ public class SendWeatherForecastRequest extends Request {
|
||||
@Override
|
||||
protected List<byte[]> createRequest() throws RequestCreationException {
|
||||
int hourlyCount = Math.min(weatherSpec.hourly.size(), 24);
|
||||
int dayCount = Math.min(weatherSpec.forecasts.size(), 8);
|
||||
int dayCount = Math.min(weatherSpec.forecasts.size() + 1, 8); // We add today as well
|
||||
|
||||
ArrayList<WeatherForecastData.TimeData> timeDataArrayList = new ArrayList<>(hourlyCount);
|
||||
ArrayList<WeatherForecastData.DayData> dayDataArrayList = new ArrayList<>(dayCount);
|
||||
|
Loading…
Reference in New Issue
Block a user