|
35 | 35 | "late afternoon","early evening","early evening","dusk-ish", |
36 | 36 | "evening","evening","late evening","late evening"] |
37 | 37 |
|
| 38 | +# Days of the week |
| 39 | +week_days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] |
| 40 | + |
38 | 41 | esp32_cs = digitalio.DigitalInOut(board.ESP_CS) |
39 | 42 | esp32_ready = digitalio.DigitalInOut(board.ESP_BUSY) |
40 | 43 | esp32_reset = digitalio.DigitalInOut(board.ESP_RESET) |
|
43 | 46 | esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset, debug=False) |
44 | 47 | requests.set_socket(socket, esp) |
45 | 48 |
|
46 | | -def wday_to_weekday_name(tm_wday): |
47 | | - """Returns the name of the weekday based on tm_wday value. |
48 | | - :param int tm_wday: Days since Sunday. |
49 | | -
|
50 | | - """ |
51 | | - switch = { |
52 | | - 0: "Monday", |
53 | | - 1: "Tuesday", |
54 | | - 2: "Wednesday", |
55 | | - 3: "Thursday", |
56 | | - 4: "Friday", |
57 | | - 5: "Saturday", |
58 | | - 6: "Sunday",} |
59 | | - return switch.get(tm_wday, "Day not found") |
60 | | - |
61 | 49 | # initialize pyportal |
62 | 50 | pyportal = PyPortal(esp=esp, |
63 | 51 | external_spi=spi, |
@@ -113,7 +101,7 @@ def wday_to_weekday_name(tm_wday): |
113 | 101 | continue |
114 | 102 |
|
115 | 103 | # Convert tm_wday to name of day |
116 | | - weekday = wday_to_weekday_name(the_time.tm_wday) |
| 104 | + weekday = week_days[the_time.tm_wday] |
117 | 105 |
|
118 | 106 | # set the day label's text |
119 | 107 | label_day.text = weekday |
|
0 commit comments