Skip to content

Commit 955c655

Browse files
committed
Set CircuitPython day to 16th at midnight + TimeZone from settings.toml
1 parent 9968f6c commit 955c655

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

CircuitPython_Day_2024_Projects/Qualia_820x320_IO_Countdown/code.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
from adafruit_ticks import ticks_ms, ticks_add, ticks_diff
1717

1818
## See TZ Identifier column at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
19-
## If you want to set the timezone, you can do so with the following line:
20-
timezone = "GB" # Set timezone for UK developers ;)
19+
## If you want to set the timezone, you can do so with the following:
20+
timezone = os.getenv("ADAFRUIT_AIO_TIMEZONE", "America/New_York") # Fetch timezone from settings.toml or default to EST
2121
# timezone = None # Or instead rely on automatic timezone detection based on IP Address
2222

2323

2424
## The time of the thing!
2525
EVENT_YEAR = 2024
2626
EVENT_MONTH = 8
27-
EVENT_DAY = 11 # 16
28-
EVENT_HOUR = 10 # 0
29-
EVENT_MINUTE = 28 # 0
27+
EVENT_DAY = 16
28+
EVENT_HOUR = 0
29+
EVENT_MINUTE = 0
3030
## we'll make a python-friendly structure
3131
event_time = time.struct_time(
3232
(
@@ -82,9 +82,7 @@
8282
PIXEL_SHADER = blinka_bitmap.pixel_shader
8383
group = displayio.Group()
8484
font = bitmap_font.load_font(FONT_FILE)
85-
# blinka_bitmap = displayio.OnDiskBitmap(BITMAP_FILE)
8685
blinka_grid = displayio.TileGrid(blinka_bitmap, pixel_shader=blinka_bitmap.pixel_shader)
87-
# blinka_grid.y = -100
8886
scrolling_label = bitmap_label.Label(font, text=" ", y=display.height - FONT_Y_OFFSET)
8987

9088
group.append(blinka_grid)
@@ -156,11 +154,8 @@
156154
remaining //= 24
157155
days_remaining = remaining
158156
if not finished or (finished and days_remaining < 0):
159-
# Remove 1 from days_remaining to count from end of day instead of start
157+
# Add 1 to negative days_remaining to count from end of day instead of start
160158
if days_remaining < 0:
161-
print(
162-
f"Event time in past: Adding 1 to days_remaining ({days_remaining}) to count from end of day"
163-
)
164159
days_remaining += 1
165160
# Update the display with current countdown value
166161
scrolling_label.text = (

CircuitPython_Day_2024_Projects/Qualia_820x320_IO_Countdown/qualia_bar_display_320x820.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
#
33
# SPDX-License-Identifier: MIT
44

5+
# pylint: disable=import-outside-toplevel, line-too-long
56
def setup_display():
67
# Code taken from Adafruit Qualia ESP32-S3 for RGB-666 Displays Learn Guide - Rectangle Bar 3.2" display
78
# https://learn.adafruit.com/adafruit-qualia-esp32-s3-for-rgb666-displays/qualia-rgb666-with-tl032fwv01-3-2-320x820-bar-display
89
from displayio import release_displays
910
release_displays()
1011

11-
import random
12-
import displayio
13-
import time
1412
import busio
1513
import board
1614
import dotclockframebuffer

0 commit comments

Comments
 (0)