mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-12-23 01:32:34 +03:00
Improve and fix WeatherService
Ensure that PTS will update the weather info if temperature and cloud info were received. Assume 0 precipitation if no precipitation event were received.
This commit is contained in:
parent
ddfe204f14
commit
d1c146e2fb
@ -537,11 +537,22 @@ void WatchFacePineTimeStyle::Refresh() {
|
||||
}
|
||||
}
|
||||
|
||||
if (weatherService.GetCurrentTemperature()->timestamp != 0 && weatherService.GetCurrentClouds()->timestamp != 0 &&
|
||||
weatherService.GetCurrentPrecipitation()->timestamp != 0) {
|
||||
const auto& newTemperatureEvent = weatherService.GetCurrentTemperature();
|
||||
const auto& newCloudsEvent = weatherService.GetCurrentClouds();
|
||||
const auto& newPrecipitationEvent = weatherService.GetCurrentPrecipitation();
|
||||
|
||||
if(newTemperatureEvent->timestamp == 0 && newCloudsEvent->timestamp == 0 && newPrecipitationEvent == 0) {
|
||||
lv_label_set_text_static(temperature, "--");
|
||||
lv_label_set_text(weatherIcon, Symbols::ban);
|
||||
lv_obj_realign(temperature);
|
||||
lv_obj_realign(weatherIcon);
|
||||
}
|
||||
|
||||
// Assume 0 precipitation if no precipitation event were received
|
||||
if (newTemperatureEvent->timestamp != 0 && newCloudsEvent->timestamp != 0 /*&& newPrecipitationEvent->timestamp !=0*/) {
|
||||
nowTemp = (weatherService.GetCurrentTemperature()->temperature / 100);
|
||||
clouds = (weatherService.GetCurrentClouds()->amount);
|
||||
precip = (weatherService.GetCurrentPrecipitation()->amount);
|
||||
precip = (newPrecipitationEvent->timestamp != 0) ? weatherService.GetCurrentPrecipitation()->amount : 0;
|
||||
if (nowTemp.IsUpdated()) {
|
||||
lv_label_set_text_fmt(temperature, "%d°", nowTemp.Get());
|
||||
if ((clouds <= 30) && (precip == 0)) {
|
||||
|
Loading…
Reference in New Issue
Block a user