|
@@ -12,7 +12,7 @@ print("battery:", axp.getBatVoltage(), "V")
|
|
|
m5ui.setScreenColor(0x000000)
|
|
|
screen_width, screen_height = lcd.winsize()
|
|
|
|
|
|
-time_text_box = m5ui.M5TextBox(
|
|
|
+clock_text_box = m5ui.M5TextBox(
|
|
|
screen_width - 1, 0, "HH:MM", lcd.FONT_DejaVu40, 0xFFFFFF, rotate=90
|
|
|
)
|
|
|
|
|
@@ -20,4 +20,13 @@ time_text_box = m5ui.M5TextBox(
|
|
|
|
|
|
|
|
|
rtc = machine.RTC()
|
|
|
-time_text_box.setText("{}:{}".format(*rtc.datetime()[4:6]))
|
|
|
+
|
|
|
+clock_update_timer = machine.Timer(0)
|
|
|
+clock_update_timer.init(
|
|
|
+ period=10000,
|
|
|
+ mode=machine.Timer.PERIODIC,
|
|
|
+ callback=lambda t: clock_text_box.setText("{}:{}".format(*rtc.datetime()[4:6])),
|
|
|
+)
|
|
|
+
|
|
|
+
|
|
|
+
|