Sync retrieving air quality to whole minutes
This commit is contained in:
parent
5ef49f098d
commit
47eb3acd01
10
clock.py
10
clock.py
|
@ -337,6 +337,9 @@ class MyClockWidget(FloatLayout):
|
||||||
else:
|
else:
|
||||||
print("Error retrieving air quality; got response " + str(response))
|
print("Error retrieving air quality; got response " + str(response))
|
||||||
|
|
||||||
|
def sync_air_quality(self, *args):
|
||||||
|
Clock.schedule_interval(self.get_air_quality, 60)
|
||||||
|
|
||||||
def update_background_automatic_sunrise(self):
|
def update_background_automatic_sunrise(self):
|
||||||
background = self.ids["background"]
|
background = self.ids["background"]
|
||||||
self.draw_list_curr_frame.append(["canvas.clear()", background])
|
self.draw_list_curr_frame.append(["canvas.clear()", background])
|
||||||
|
@ -1568,7 +1571,12 @@ class MyApp(App):
|
||||||
Clock.schedule_interval(clock_widget.update_display, 1.0/update_rate)
|
Clock.schedule_interval(clock_widget.update_display, 1.0/update_rate)
|
||||||
|
|
||||||
Clock.schedule_once(clock_widget.get_air_quality, 0)
|
Clock.schedule_once(clock_widget.get_air_quality, 0)
|
||||||
Clock.schedule_interval(clock_widget.get_air_quality, 60)
|
|
||||||
|
t = datetime.datetime.now()
|
||||||
|
delay = 60 - (t.second + t.microsecond / 1000000)
|
||||||
|
if delay < 0:
|
||||||
|
delay = delay + 60
|
||||||
|
Clock.schedule_once(clock_widget.sync_air_quality, delay)
|
||||||
|
|
||||||
if is_arm():
|
if is_arm():
|
||||||
Window.borderless = True
|
Window.borderless = True
|
||||||
|
|
Loading…
Reference in New Issue