Fixed 2 bugs:

* excessive reading of theme when light was on
* retrieve air quality 2 seconds before whole minute to prevent using old data for a whole minute
This commit is contained in:
Admar Schoonen 2023-05-29 09:01:52 +02:00
parent 946f531161
commit 624d75c033
1 changed files with 5 additions and 3 deletions

View File

@ -380,9 +380,11 @@ class MyClockWidget(FloatLayout):
else:
if self.intensity_curr >= 0.5:
self.theme = Theme("Light")
if self.theme.name != "Light":
self.theme = Theme("Light")
else:
self.theme = Theme("Dark")
if self.theme.name != "Dark":
self.theme = Theme("Dark")
self.update_background_automatic_sunrise()
@ -1643,7 +1645,7 @@ class MyApp(App):
Clock.schedule_once(clock_widget.get_air_quality, 0)
t = datetime.datetime.now()
delay = 60 - (t.second + t.microsecond / 1000000)
delay = 58 - (t.second + t.microsecond / 1000000)
if delay < 0:
delay = delay + 60
Clock.schedule_once(clock_widget.sync_air_quality, delay)