Skip to content

Commit fa7ac44

Browse files
author
brentru
committed
update to use CircuitPython time struct, 1->12 not 0->12
1 parent e6a6d24 commit fa7ac44

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

PyPortal_Quarantine_Clock/month_clock.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,28 @@
3636
"evening","evening","late evening","late evening"]
3737

3838
# Months of the year
39-
months = ["January", "February", "March", "April",
39+
months = ["January", "January", "February", "March", "April",
4040
"May", "June", "July", "August",
4141
"September", "October", "November", "December"]
4242

43+
# Dictionary of tm_mon and month name.
44+
# note: tm_mon structure in CircuitPython ranges from [1,12]
45+
months = {
46+
1: "January",
47+
2: "February",
48+
3: "March",
49+
4: "April",
50+
5: "May",
51+
6: "June",
52+
7: "July",
53+
8: "August",
54+
9: "September",
55+
10: "October",
56+
11: "November",
57+
12: "December"
58+
}
59+
60+
4361
esp32_cs = digitalio.DigitalInOut(board.ESP_CS)
4462
esp32_ready = digitalio.DigitalInOut(board.ESP_BUSY)
4563
esp32_reset = digitalio.DigitalInOut(board.ESP_RESET)
@@ -75,15 +93,15 @@
7593
font_large.load_glyphs(b'abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890- ')
7694
font_small.load_glyphs(b'abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890- ()')
7795

78-
# Set up label for the day
96+
# Set up label for the month
7997
label_month = label.Label(font_large, color=LABEL_DAY_COLOR, max_glyphs=200)
80-
label_month.x = board.DISPLAY.width // 6
98+
label_month.x = board.DISPLAY.width // 10
8199
label_month.y = 80
82100
pyportal.splash.append(label_month)
83101

84102
# Set up label for the time
85103
label_time = label.Label(font_small, color=LABEL_TIME_COLOR, max_glyphs=200)
86-
label_time.x = board.DISPLAY.width // 4
104+
label_time.x = board.DISPLAY.width // 3
87105
label_time.y = 150
88106
pyportal.splash.append(label_time)
89107

0 commit comments

Comments
 (0)