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

View file

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

View file

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

View file

@ -40,7 +40,7 @@ def background_sound(filename):
def show_screen(group):
""" Activate a given displayio group, pause until keypress. """
macropad.display.show(group)
macropad.display.root_group = group
macropad.display.refresh()
# Purge any queued up key events...
while macropad.keys.events.get():
@ -134,7 +134,7 @@ while True:
play_group[-1].text = '0' # Score text
life_bar.value = 100
audio.stop()
macropad.display.show(play_group)
macropad.display.root_group = play_group
macropad.display.refresh()
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,
anchored_position=(macropad.display.width//2, -2),
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
apps = []

View file

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

View file

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

View file

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

View file

@ -160,7 +160,7 @@ GROUP = displayio.Group()
GROUP.append(fillrect(0, 0, DISPLAY.width, DISPLAY.height, 0xFFFFFF))
# Clear the screen ASAP before populating rest of group (erase any old
# prediction data)...
DISPLAY.show(GROUP)
DISPLAY.root_group = GROUP
DISPLAY.refresh()
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)
# Third element (predictions) is NOT positioned here...see main loop
DISPLAY.show(GROUP)
DISPLAY.root_group = GROUP
NETWORK.connect()

View file

@ -73,7 +73,7 @@ if selector:
rect = Rect(4, 4, 66, 58, outline=0x000000, stroke=2)
group.append(rect)
display.show(group)
display.root_group = group
display.refresh()
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)
# show the group
display.show(main_group)
display.root_group = main_group
# refresh display
try_refresh()

View file

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

View file

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

View file

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

View file

@ -75,7 +75,7 @@ splash.append(label)
splash.append(co2_value)
# and show em
display.show(splash)
display.root_group = splash
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['upper_lid_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_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)
display = matrix.display
group = displayio.Group()
display.show(group)
display.root_group = group
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)
display = matrix.display
group = displayio.Group()
display.show(group)
display.root_group = group
bitmap = displayio.Bitmap(display.width, display.height, 4)

View file

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

View file

@ -31,7 +31,7 @@ color[3] = 0x3DEB34 # green
# Create a TileGrid using the Bitmap and Palette
tile_grid = displayio.TileGrid(bitmap, pixel_shader=color)
group.append(tile_grid) # Add the TileGrid to the Group
display.show(group)
display.root_group = group
if not DEBUG:
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
GROUP.append(adafruit_display_text.label.Label(SMALL_FONT, color=0x00FF00,
text='12:00', y=-99))
DISPLAY.show(GROUP)
DISPLAY.root_group = GROUP
NETWORK = Network(status_neopixel=board.NEOPIXEL, debug=False)
NETWORK.connect()

View file

@ -149,7 +149,7 @@ def sport_startup(logo):
group.append(grid2)
group.append(grid3)
group.append(grid4)
display.show(group)
display.root_group = group
# pylint: disable=broad-except
except Exception:
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],
logos[z],
groups[z])
display.show(groups[z])
display.root_group = groups[z]
# pylint: disable=broad-except
except Exception as Error:
print(Error)
@ -392,7 +392,7 @@ while True:
# update display seperate from API request
if ticks_diff(ticks_ms(), display_clock) >= display_timer:
print("updating display")
display.show(groups[display_index])
display.root_group = groups[display_index]
display_index = (display_index + 1) % len(teams)
display_clock = ticks_add(display_clock, display_timer)
# cleared for fetching after time has passed

View file

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

View file

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

View file

@ -43,7 +43,7 @@ color[3] = 0x85FF00 # greenish
# Create a TileGrid using the Bitmap and Palette
tile_grid = displayio.TileGrid(bitmap, pixel_shader=color)
group.append(tile_grid) # Add the TileGrid to the Group
display.show(group)
display.root_group = group
if not DEBUG:
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()
macropad.display.show(main_group)
macropad.display.root_group = main_group
title = label.Label(
y=4,
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)

View file

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

View file

@ -61,7 +61,7 @@ def do_crawl_down(image_file, *,
group = displayio.Group()
tile_grid = displayio.TileGrid(bitmap=the_bitmap, pixel_shader=the_palette)
group.append(tile_grid)
display.show(group)
display.root_group = group
start_time = time.monotonic_ns()
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.x = (display.width - the_bitmap.width) // 2
group.y = (display.height - the_bitmap.height) // 2
display.show(group)
display.root_group = group
start_time = time.monotonic_ns()
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
splash = displayio.Group()
board.DISPLAY.show(splash)
board.DISPLAY.root_group = splash
# set progress bar width and height relative to board's display
width = 183

View file

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

View file

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

View file

@ -71,7 +71,7 @@ clock_area.x = 125
clock_area.y = 128
group.append(text_area)
group.append(clock_area)
display.show(group)
display.root_group = group
last_value = 0 # checks last tweet's ID
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
splash = displayio.Group()
display.show(splash)
display.root_group = splash
color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)