|
17 | 17 |
|
18 | 18 | CLOCK_UPDATE_INTERVAL = 100 # 10 or even 1 ms doesn't seem to change the framerate but 100ms is enough |
19 | 19 | WIFI_ICON_UPDATE_INTERVAL = 1500 |
| 20 | +TEMPERATURE_UPDATE_INTERVAL = 2000 |
20 | 21 |
|
21 | 22 | # Color palette |
22 | 23 | DARKPINK = lv.color_hex(0xEC048C) |
@@ -80,11 +81,16 @@ def toggle_drawer(event): |
80 | 81 | time_label.align(lv.ALIGN.LEFT_MID, 0, 0) |
81 | 82 | time_label.set_style_text_color(COLOR_TEXT_WHITE, 0) |
82 | 83 |
|
| 84 | +temp_label = lv.label(notification_bar) |
| 85 | +temp_label.set_text("") |
| 86 | +temp_label.align_to(time_label, lv.ALIGN.OUT_RIGHT_MID, PADDING_TINY, 0) |
| 87 | +temp_label.set_style_text_color(COLOR_TEXT_WHITE, 0) |
| 88 | + |
83 | 89 | # Notification icon (bell) |
84 | | -notif_icon = lv.label(notification_bar) |
85 | | -notif_icon.set_text(lv.SYMBOL.BELL) |
86 | | -notif_icon.align_to(time_label, lv.ALIGN.OUT_RIGHT_MID, PADDING_TINY, 0) |
87 | | -notif_icon.set_style_text_color(COLOR_TEXT_WHITE, 0) |
| 90 | +#notif_icon = lv.label(notification_bar) |
| 91 | +#notif_icon.set_text(lv.SYMBOL.BELL) |
| 92 | +#notif_icon.align_to(time_label, lv.ALIGN.OUT_RIGHT_MID, PADDING_TINY, 0) |
| 93 | +#notif_icon.set_style_text_color(COLOR_TEXT_WHITE, 0) |
88 | 94 |
|
89 | 95 | # WiFi icon |
90 | 96 | wifi_icon = lv.label(notification_bar) |
@@ -124,8 +130,14 @@ def update_wifi_icon(timer): |
124 | 130 | else: |
125 | 131 | wifi_icon.add_flag(lv.obj.FLAG.HIDDEN) |
126 | 132 |
|
| 133 | +import esp32 |
| 134 | +def update_temperature(timer): |
| 135 | + temp_label.set_text(f"{esp32.mcu_temperature()}°C") |
| 136 | + |
127 | 137 | lv.timer_create(update_time, CLOCK_UPDATE_INTERVAL, None) |
128 | 138 | lv.timer_create(update_wifi_icon, WIFI_ICON_UPDATE_INTERVAL, None) |
| 139 | +lv.timer_create(update_temperature, TEMPERATURE_UPDATE_INTERVAL, None) |
| 140 | + |
129 | 141 | notification_bar.add_event_cb(toggle_drawer, lv.EVENT.CLICKED, None) |
130 | 142 |
|
131 | 143 |
|
|
0 commit comments