This commit is contained in:
foamyguy 2023-11-06 11:55:54 -06:00
parent 3a738907ac
commit fde611205f
35 changed files with 58 additions and 80 deletions

View file

@ -69,7 +69,7 @@ def keys_clear(): # Set display in the Start mode, key LEDs off
group[i].text = " " group[i].text = " "
macropad.pixels.show() macropad.pixels.show()
group[9].text = "START" group[9].text = "START"
macropad.display.show(group) macropad.display.root_group = group
macropad.display.refresh() macropad.display.refresh()
def scramble(): # Scramble values of the keys and display on screen def scramble(): # Scramble values of the keys and display on screen
@ -177,7 +177,7 @@ while True:
if password_guess == PASSWORD: # Success if password_guess == PASSWORD: # Success
group[9].text = " " group[9].text = " "
group[11].text = "OPEN" group[11].text = "OPEN"
macropad.display.show(group) macropad.display.root_group = group
macropad.display.refresh() macropad.display.refresh()
macropad.pixels[11] = GREEN macropad.pixels[11] = GREEN
macropad.pixels.show() macropad.pixels.show()
@ -193,7 +193,7 @@ while True:
else: # fail! else: # fail!
group[11].text = "FAIL" group[11].text = "FAIL"
group[9].text = " " group[9].text = " "
macropad.display.show(group) macropad.display.root_group = group
macropad.display.refresh() macropad.display.refresh()
for _ in range(3): # Flash lower right 3 times red with beeps for _ in range(3): # Flash lower right 3 times red with beeps
macropad.pixels[11] = RED macropad.pixels[11] = RED

View file

@ -89,7 +89,7 @@ splash.append(rtc_date)
splash.append(rtc_time) splash.append(rtc_time)
splash.append(progress_bar) splash.append(progress_bar)
display.show(splash) display.root_group = splash
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# H E L P E R F U N C S # H E L P E R F U N C S

View file

@ -75,7 +75,7 @@ macropad.pixels.brightness = BRIGHT
# ---Display setup--- # ---Display setup---
display = board.DISPLAY display = board.DISPLAY
screen = displayio.Group() screen = displayio.Group()
display.show(screen) display.root_group = screen
WIDTH = 128 WIDTH = 128
HEIGHT = 64 HEIGHT = 64
FONT = terminalio.FONT FONT = terminalio.FONT

View file

@ -40,7 +40,7 @@ def background_sound(filename):
def show_screen(group): def show_screen(group):
""" Activate a given displayio group, pause until keypress. """ """ Activate a given displayio group, pause until keypress. """
macropad.display.show(group) macropad.display.root_group = group
macropad.display.refresh() macropad.display.refresh()
# Purge any queued up key events... # Purge any queued up key events...
while macropad.keys.events.get(): while macropad.keys.events.get():
@ -134,7 +134,7 @@ while True:
play_group[-1].text = '0' # Score text play_group[-1].text = '0' # Score text
life_bar.value = 100 life_bar.value = 100
audio.stop() audio.stop()
macropad.display.show(play_group) macropad.display.root_group = play_group
macropad.display.refresh() macropad.display.refresh()
start = time.monotonic() start = time.monotonic()

View file

@ -74,7 +74,7 @@ group.append(Rect(0, 0, macropad.display.width, 12, fill=0xFFFFFF))
group.append(label.Label(terminalio.FONT, text='', color=0x000000, group.append(label.Label(terminalio.FONT, text='', color=0x000000,
anchored_position=(macropad.display.width//2, -2), anchored_position=(macropad.display.width//2, -2),
anchor_point=(0.5, 0.0))) anchor_point=(0.5, 0.0)))
macropad.display.show(group) macropad.display.root_group = group
# Load all the macro key setups from .py files in MACRO_FOLDER # Load all the macro key setups from .py files in MACRO_FOLDER
apps = [] apps = []

View file

@ -104,7 +104,7 @@ for i in range(day):
time.sleep(0.1) time.sleep(0.1)
# updates display with bitmap and current circle colors # updates display with bitmap and current circle colors
magtag.display.show(group) magtag.display.root_group = group
magtag.display.refresh() magtag.display.refresh()
time.sleep(5) time.sleep(5)

View file

@ -31,7 +31,7 @@ with open(bmp_file, "rb") as fp:
) )
group = displayio.Group() group = displayio.Group()
group.append(tile_grid) group.append(tile_grid)
epd.show(group) epd.root_group = group
time.sleep(epd.time_to_refresh + 0.01) time.sleep(epd.time_to_refresh + 0.01)
epd.refresh() epd.refresh()
while epd.busy: while epd.busy:
@ -42,7 +42,7 @@ with open(bmp_file, "rb") as fp:
# tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) # tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
# group = displayio.Group() # group = displayio.Group()
# group.append(tile_grid) # group.append(tile_grid)
# epd.show(group) # epd.root_group = group
# time.sleep(epd.time_to_refresh + 0.01) # time.sleep(epd.time_to_refresh + 0.01)
# epd.refresh() # epd.refresh()
# while epd.busy: # while epd.busy:

View file

@ -60,7 +60,7 @@ with open(bmp_file, "rb") as fp:
) )
group = displayio.Group() group = displayio.Group()
group.append(tile_grid) group.append(tile_grid)
epd.show(group) epd.root_group = group
time.sleep(epd.time_to_refresh + 0.01) time.sleep(epd.time_to_refresh + 0.01)
epd.refresh() epd.refresh()
while epd.busy: while epd.busy:
@ -71,7 +71,7 @@ with open(bmp_file, "rb") as fp:
# tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) # tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
# group = displayio.Group() # group = displayio.Group()
# group.append(tile_grid) # group.append(tile_grid)
# epd.show(group) # epd.root_group = group
# time.sleep(epd.time_to_refresh + 0.01) # time.sleep(epd.time_to_refresh + 0.01)
# epd.refresh() # epd.refresh()
# while epd.busy: # while epd.busy:

View file

@ -160,7 +160,7 @@ GROUP = displayio.Group()
GROUP.append(fillrect(0, 0, DISPLAY.width, DISPLAY.height, 0xFFFFFF)) GROUP.append(fillrect(0, 0, DISPLAY.width, DISPLAY.height, 0xFFFFFF))
# Clear the screen ASAP before populating rest of group (erase any old # Clear the screen ASAP before populating rest of group (erase any old
# prediction data)... # prediction data)...
DISPLAY.show(GROUP) DISPLAY.root_group = GROUP
DISPLAY.refresh() DISPLAY.refresh()
time.sleep(5) # Don't allow another refresh() too soon time.sleep(5) # Don't allow another refresh() too soon
@ -207,7 +207,7 @@ for stop_index, stop in enumerate(STOPS):
GROUP[2 + stop_index * 3].anchored_position = (MAX_SIZE[0] + 4, baseline) GROUP[2 + stop_index * 3].anchored_position = (MAX_SIZE[0] + 4, baseline)
# Third element (predictions) is NOT positioned here...see main loop # Third element (predictions) is NOT positioned here...see main loop
DISPLAY.show(GROUP) DISPLAY.root_group = GROUP
NETWORK.connect() NETWORK.connect()

View file

@ -73,7 +73,7 @@ if selector:
rect = Rect(4, 4, 66, 58, outline=0x000000, stroke=2) rect = Rect(4, 4, 66, 58, outline=0x000000, stroke=2)
group.append(rect) group.append(rect)
display.show(group) display.root_group = group
display.refresh() display.refresh()
time.sleep(5) time.sleep(5)

View file

@ -238,7 +238,7 @@ top_left_value.text = "{}C | {}C\n{}C | {}C".format(
top_center_name.anchored_position = (top_right_value.x - 2, 6) top_center_name.anchored_position = (top_right_value.x - 2, 6)
# show the group # show the group
display.show(main_group) display.root_group = main_group
# refresh display # refresh display
try_refresh() try_refresh()

View file

@ -235,7 +235,7 @@ temperature_val.text = "{}c | {}c\n{}c | {}c".format(
) )
# show the group # show the group
display.show(main_group) display.root_group = main_group
# refresh display # refresh display
try_refresh() try_refresh()

View file

@ -14,7 +14,7 @@ import displayio
import adafruit_lis3dh import adafruit_lis3dh
splash = displayio.Group() splash = displayio.Group()
board.DISPLAY.show(splash) board.DISPLAY.root_group = splash
SENSITIVITY = 5 # reading in Z direction to trigger, adjustable SENSITIVITY = 5 # reading in Z direction to trigger, adjustable

View file

@ -142,7 +142,7 @@ def startup_text():
text_line2.x = 2 text_line2.x = 2
text_line2.color = color[2] text_line2.color = color[2]
redraw_wings(0) redraw_wings(0)
display.show(group) display.root_group = group
startup_text() # display the startup text startup_text() # display the startup text
@ -158,7 +158,7 @@ def update_text(state):
text_line2.color = color[1] text_line2.color = color[1]
redraw_wings(1) redraw_wings(1)
redraw_frame() redraw_frame()
display.show(group) display.root_group = group
else: # else, text if "OFF" at startup else: # else, text if "OFF" at startup
text_line1.text = "OFF" text_line1.text = "OFF"
text_line1.x = off_x text_line1.x = off_x
@ -168,7 +168,7 @@ def update_text(state):
text_line2.color = color[3] text_line2.color = color[3]
redraw_wings(3) redraw_wings(3)
redraw_frame() redraw_frame()
display.show(group) display.root_group = group
def get_status(): def get_status():

View file

@ -75,7 +75,7 @@ splash.append(label)
splash.append(co2_value) splash.append(co2_value)
# and show em # and show em
display.show(splash) display.root_group = splash
def update_display(value): def update_display(value):

View file

@ -68,7 +68,7 @@ SPRITES.append(Sprite(EYE_DATA['eye_image'])) # Base image is opaque
SPRITES.append(Sprite(EYE_DATA['lower_lid_image'], EYE_DATA['transparent'])) SPRITES.append(Sprite(EYE_DATA['lower_lid_image'], EYE_DATA['transparent']))
SPRITES.append(Sprite(EYE_DATA['upper_lid_image'], EYE_DATA['transparent'])) SPRITES.append(Sprite(EYE_DATA['upper_lid_image'], EYE_DATA['transparent']))
SPRITES.append(Sprite(EYE_DATA['stencil_image'], EYE_DATA['transparent'])) SPRITES.append(Sprite(EYE_DATA['stencil_image'], EYE_DATA['transparent']))
DISPLAY.show(SPRITES) DISPLAY.root_group = SPRITES
EYE_CENTER = ((EYE_DATA['eye_move_min'][0] + # Pixel coords of eye EYE_CENTER = ((EYE_DATA['eye_move_min'][0] + # Pixel coords of eye
EYE_DATA['eye_move_max'][0]) / 2, # image when centered EYE_DATA['eye_move_max'][0]) / 2, # image when centered

View file

@ -44,7 +44,7 @@ DELAY = 0.01 # smaller = faster
matrix = Matrix(width=MATRIX_WIDTH, height=MATRIX_HEIGHT, bit_depth=6) matrix = Matrix(width=MATRIX_WIDTH, height=MATRIX_HEIGHT, bit_depth=6)
display = matrix.display display = matrix.display
group = displayio.Group() group = displayio.Group()
display.show(group) display.root_group = group
bitmap = displayio.Bitmap(display.width, display.height, 4) bitmap = displayio.Bitmap(display.width, display.height, 4)

View file

@ -55,7 +55,7 @@ for row in range(len(VX)):
matrix = Matrix(width=MATRIX_WIDTH, height=MATRIX_HEIGHT, bit_depth=6) matrix = Matrix(width=MATRIX_WIDTH, height=MATRIX_HEIGHT, bit_depth=6)
display = matrix.display display = matrix.display
group = displayio.Group() group = displayio.Group()
display.show(group) display.root_group = group
bitmap = displayio.Bitmap(display.width, display.height, 4) bitmap = displayio.Bitmap(display.width, display.height, 4)

View file

@ -101,7 +101,7 @@ while True:
MODE = 1 MODE = 1
elif time.monotonic() > last_movement + SLEEP_DURATION: elif time.monotonic() > last_movement + SLEEP_DURATION:
MODE = 0 MODE = 0
display.show(empty_group) display.root_group = empty_group
if MODE == 1: if MODE == 1:
if auto_advance and time.monotonic() > LAST_ADVANCE + IMAGE_DURATION[i]: if auto_advance and time.monotonic() > LAST_ADVANCE + IMAGE_DURATION[i]:
advance() advance()

View file

@ -31,7 +31,7 @@ color[3] = 0x3DEB34 # green
# Create a TileGrid using the Bitmap and Palette # Create a TileGrid using the Bitmap and Palette
tile_grid = displayio.TileGrid(bitmap, pixel_shader=color) tile_grid = displayio.TileGrid(bitmap, pixel_shader=color)
group.append(tile_grid) # Add the TileGrid to the Group group.append(tile_grid) # Add the TileGrid to the Group
display.show(group) display.root_group = group
if not DEBUG: if not DEBUG:
font = bitmap_font.load_font("/IBMPlexMono-Medium-24_jep.bdf") font = bitmap_font.load_font("/IBMPlexMono-Medium-24_jep.bdf")

View file

@ -264,7 +264,7 @@ GROUP.append(adafruit_display_text.label.Label(SYMBOL_FONT, color=0x00FF00,
# Element 9 is the time of (or time to) next rise/set event # Element 9 is the time of (or time to) next rise/set event
GROUP.append(adafruit_display_text.label.Label(SMALL_FONT, color=0x00FF00, GROUP.append(adafruit_display_text.label.Label(SMALL_FONT, color=0x00FF00,
text='12:00', y=-99)) text='12:00', y=-99))
DISPLAY.show(GROUP) DISPLAY.root_group = GROUP
NETWORK = Network(status_neopixel=board.NEOPIXEL, debug=False) NETWORK = Network(status_neopixel=board.NEOPIXEL, debug=False)
NETWORK.connect() NETWORK.connect()

View file

@ -149,7 +149,7 @@ def sport_startup(logo):
group.append(grid2) group.append(grid2)
group.append(grid3) group.append(grid3)
group.append(grid4) group.append(grid4)
display.show(group) display.root_group = group
# pylint: disable=broad-except # pylint: disable=broad-except
except Exception: except Exception:
print("Can't find bitmap. Did you run the get_team_logos.py script?") print("Can't find bitmap. Did you run the get_team_logos.py script?")
@ -361,7 +361,7 @@ for z in range(5):
teams[z], teams[z],
logos[z], logos[z],
groups[z]) groups[z])
display.show(groups[z]) display.root_group = groups[z]
# pylint: disable=broad-except # pylint: disable=broad-except
except Exception as Error: except Exception as Error:
print(Error) print(Error)
@ -392,7 +392,7 @@ while True:
# update display seperate from API request # update display seperate from API request
if ticks_diff(ticks_ms(), display_clock) >= display_timer: if ticks_diff(ticks_ms(), display_clock) >= display_timer:
print("updating display") print("updating display")
display.show(groups[display_index]) display.root_group = groups[display_index]
display_index = (display_index + 1) % len(teams) display_index = (display_index + 1) % len(teams)
display_clock = ticks_add(display_clock, display_timer) display_clock = ticks_add(display_clock, display_timer)
# cleared for fetching after time has passed # cleared for fetching after time has passed

View file

@ -34,7 +34,7 @@ THRESHOLD = 20
# --- Display setup --- # --- Display setup ---
matrix = Matrix(bit_depth=4) matrix = Matrix(bit_depth=4)
sprite_group = displayio.Group() sprite_group = displayio.Group()
matrix.display.show(sprite_group) matrix.display.root_group = sprite_group
# --- Button setup --- # --- Button setup ---
pin_down = DigitalInOut(board.BUTTON_DOWN) pin_down = DigitalInOut(board.BUTTON_DOWN)

View file

@ -22,7 +22,7 @@ FRAME_DURATION_OVERRIDES = {
# --- Display setup --- # --- Display setup ---
matrix = Matrix(bit_depth=4) matrix = Matrix(bit_depth=4)
sprite_group = displayio.Group() sprite_group = displayio.Group()
matrix.display.show(sprite_group) matrix.display.root_group = sprite_group
# --- Button setup --- # --- Button setup ---
pin_down = DigitalInOut(board.BUTTON_DOWN) pin_down = DigitalInOut(board.BUTTON_DOWN)

View file

@ -43,7 +43,7 @@ color[3] = 0x85FF00 # greenish
# Create a TileGrid using the Bitmap and Palette # Create a TileGrid using the Bitmap and Palette
tile_grid = displayio.TileGrid(bitmap, pixel_shader=color) tile_grid = displayio.TileGrid(bitmap, pixel_shader=color)
group.append(tile_grid) # Add the TileGrid to the Group group.append(tile_grid) # Add the TileGrid to the Group
display.show(group) display.root_group = group
if not DEBUG: if not DEBUG:
font = bitmap_font.load_font("/IBMPlexMono-Medium-24_jep.bdf") font = bitmap_font.load_font("/IBMPlexMono-Medium-24_jep.bdf")

View file

@ -70,7 +70,7 @@ for i in range(12):
main_group = displayio.Group() main_group = displayio.Group()
macropad.display.show(main_group) macropad.display.root_group = main_group
title = label.Label( title = label.Label(
y=4, y=4,
font=terminalio.FONT, font=terminalio.FONT,

View file

@ -82,7 +82,7 @@ group.append(tilegrid)
display.show(group) display.root_group = group
board_data = bytearray(b'\x00' * 300) board_data = bytearray(b'\x00' * 300)

View file

@ -66,7 +66,7 @@ tg = displayio.TileGrid(bitmap,
pixel_shader=displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB565_SWAPPED) pixel_shader=displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB565_SWAPPED)
) )
g.append(tg) g.append(tg)
display.show(g) display.root_group = g
t0 = time.monotonic_ns() t0 = time.monotonic_ns()
display.auto_refresh = False display.auto_refresh = False

View file

@ -61,7 +61,7 @@ def do_crawl_down(image_file, *,
group = displayio.Group() group = displayio.Group()
tile_grid = displayio.TileGrid(bitmap=the_bitmap, pixel_shader=the_palette) tile_grid = displayio.TileGrid(bitmap=the_bitmap, pixel_shader=the_palette)
group.append(tile_grid) group.append(tile_grid)
display.show(group) display.root_group = group
start_time = time.monotonic_ns() start_time = time.monotonic_ns()
start_y = display.height # High enough to be "off the top" start_y = display.height # High enough to be "off the top"
@ -100,7 +100,7 @@ def do_pulse(image_file, *, duration=4, pulse_speed=1/8, pulse=.5):
group.append(tile_grid) group.append(tile_grid)
group.x = (display.width - the_bitmap.width) // 2 group.x = (display.width - the_bitmap.width) // 2
group.y = (display.height - the_bitmap.height) // 2 group.y = (display.height - the_bitmap.height) // 2
display.show(group) display.root_group = group
start_time = time.monotonic_ns() start_time = time.monotonic_ns()
end_time = start_time + int(duration * 1e9) end_time = start_time + int(duration * 1e9)

View file

@ -30,7 +30,7 @@ wifi.radio.connect(os.getenv('CIRCUITPY_WIFI_SSID'), os.getenv('CIRCUITPY_WIFI_P
# Make the display context # Make the display context
splash = displayio.Group() splash = displayio.Group()
board.DISPLAY.show(splash) board.DISPLAY.root_group = splash
# set progress bar width and height relative to board's display # set progress bar width and height relative to board's display
width = 183 width = 183

View file

@ -86,7 +86,7 @@ with open(emote_img[0], "rb") as bitmap_file:
# Add the TileGrid to the Group # Add the TileGrid to the Group
group.append(tile_grid) group.append(tile_grid)
# Add the Group to the Display # Add the Group to the Display
display.show(group) display.root_group = group
if sound_mode != 0: if sound_mode != 0:
# play a sound file # play a sound file
pyportal.play_file(vo_sound[10]) pyportal.play_file(vo_sound[10])
@ -107,23 +107,12 @@ while True:
pixel.show() pixel.show()
time.sleep(1) time.sleep(1)
# CircuitPython 6 & 7 compatible # CircuitPython 7+ compatible
with open(emote_img[i], "rb") as bitmap_file: bitmap = displayio.OnDiskBitmap(emote_img[i])
bitmap = displayio.OnDiskBitmap(bitmap_file) tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
tile_grid = displayio.TileGrid( group = displayio.Group()
bitmap, group.append(tile_grid)
pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter()) display.root_group = group
)
group = displayio.Group()
group.append(tile_grid)
display.show(group)
# # CircuitPython 7+ compatible
# bitmap = displayio.OnDiskBitmap(emote_img[i])
# tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
# group = displayio.Group()
# group.append(tile_grid)
# display.show(group)
if sound_mode != 0: if sound_mode != 0:
# play a sound file # play a sound file

View file

@ -84,7 +84,7 @@ with open(emote_img[0], "rb") as bitmap_file:
# Add the TileGrid to the Group # Add the TileGrid to the Group
group.append(tile_grid) group.append(tile_grid)
# Add the Group to the Display # Add the Group to the Display
display.show(group) display.root_group = group
if sound_mode != 0: if sound_mode != 0:
# play a sound file # play a sound file
pyportal.play_file(vo_sound[10]) pyportal.play_file(vo_sound[10])
@ -101,23 +101,12 @@ while True:
pixel.show() pixel.show()
time.sleep(1) time.sleep(1)
# CircuitPython 6 & 7 compatible # CircuitPython 7+ compatible
with open(emote_img[i], "rb") as bitmap_file: bitmap = displayio.OnDiskBitmap(emote_img[i])
bitmap = displayio.OnDiskBitmap(bitmap_file) tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
tile_grid = displayio.TileGrid( group = displayio.Group()
bitmap, group.append(tile_grid)
pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter()) display.root_group = group
)
group = displayio.Group()
group.append(tile_grid)
display.show(group)
# # CircuitPython 7+ compatible
# bitmap = displayio.OnDiskBitmap(emote_img[i])
# tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
# group = displayio.Group()
# group.append(tile_grid)
# display.show(group)
if sound_mode != 0: if sound_mode != 0:
# play a sound file # play a sound file

View file

@ -142,7 +142,7 @@ title = label.Label(
) )
clue_group.append(title) clue_group.append(title)
display.show(clue_group) display.root_group = clue_group
while True: while True:
if clue.button_a or clue.button_b: if clue.button_a or clue.button_b:

View file

@ -71,7 +71,7 @@ clock_area.x = 125
clock_area.y = 128 clock_area.y = 128
group.append(text_area) group.append(text_area)
group.append(clock_area) group.append(clock_area)
display.show(group) display.root_group = group
last_value = 0 # checks last tweet's ID last_value = 0 # checks last tweet's ID
check = 0 # time.monotonic() holder check = 0 # time.monotonic() holder

View file

@ -29,7 +29,7 @@ display = ST7789(display_bus, width=320, height=170, colstart=35, rotation=270)
# Make the display context # Make the display context
splash = displayio.Group() splash = displayio.Group()
display.show(splash) display.root_group = splash
color_bitmap = displayio.Bitmap(display.width, display.height, 1) color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1) color_palette = displayio.Palette(1)