Skip to content

Commit aeb45af

Browse files
Show temperature
1 parent 5601150 commit aeb45af

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
output/
22

33
notes.txt
4+
5+
trash/
Binary file not shown.

internal_filesystem/main.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
CLOCK_UPDATE_INTERVAL = 100 # 10 or even 1 ms doesn't seem to change the framerate but 100ms is enough
1919
WIFI_ICON_UPDATE_INTERVAL = 1500
20+
TEMPERATURE_UPDATE_INTERVAL = 2000
2021

2122
# Color palette
2223
DARKPINK = lv.color_hex(0xEC048C)
@@ -80,11 +81,16 @@ def toggle_drawer(event):
8081
time_label.align(lv.ALIGN.LEFT_MID, 0, 0)
8182
time_label.set_style_text_color(COLOR_TEXT_WHITE, 0)
8283

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+
8389
# 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)
8894

8995
# WiFi icon
9096
wifi_icon = lv.label(notification_bar)
@@ -124,8 +130,14 @@ def update_wifi_icon(timer):
124130
else:
125131
wifi_icon.add_flag(lv.obj.FLAG.HIDDEN)
126132

133+
import esp32
134+
def update_temperature(timer):
135+
temp_label.set_text(f"{esp32.mcu_temperature()}°C")
136+
127137
lv.timer_create(update_time, CLOCK_UPDATE_INTERVAL, None)
128138
lv.timer_create(update_wifi_icon, WIFI_ICON_UPDATE_INTERVAL, None)
139+
lv.timer_create(update_temperature, TEMPERATURE_UPDATE_INTERVAL, None)
140+
129141
notification_bar.add_event_cb(toggle_drawer, lv.EVENT.CLICKED, None)
130142

131143

0 commit comments

Comments
 (0)