fix mod div

This commit is contained in:
2026-08-02 00:25:47 -04:00
parent eee1d4626f
commit 1d1ca22e13
+14 -14
View File
@@ -156,7 +156,7 @@ def blit_slice(canvas, pil_img, x_offset):
def draw_frame(matrix):
global games, last_fetch, virtual_canvas, virtual_dirty, scroll_x, tick
ordered = ordered_games()
global total_games
now = time()
if now - last_fetch > 30 or not games:
@@ -165,12 +165,6 @@ def draw_frame(matrix):
update_preferred()
virtual_dirty = True
if not games:
matrix.canvas.Clear()
graphics.DrawText(matrix.canvas, font, 10, 22,
Colors.RED.value, "No games today")
return matrix.canvas
# rebuild virtual canvas if data changed
if virtual_dirty or virtual_canvas is None:
result = build_canvas(matrix)
@@ -179,24 +173,30 @@ def draw_frame(matrix):
virtual_dirty = False
scroll_x = 0
total_scroll_width = GAME_WIDTH * len(ordered)
ordered = ordered_games() # after the fetch, not before
matrix.canvas.Clear()
# blit the PIL image slice (logos + dividers + backgrounds)
if not ordered:
graphics.DrawText(matrix.canvas, font, 10, 22,
Colors.RED.value, "No games today")
scroll_x = tick = 0
return matrix.canvas
total_scroll_width = GAME_WIDTH * len(ordered)
if virtual_canvas:
blit_slice(matrix.canvas, virtual_canvas, scroll_x)
# draw text on top via rgbmatrix (handles fonts correctly)
draw_text_overlay(matrix.canvas, ordered, scroll_x)
# advance scroll every N ticks
tick += 1
if tick >= frames_per_tick:
tick = 0
next_x = scroll_x + scroll_speed
if next_x >= total_scroll_width:
scroll_x = 0
tick = 0
matrix.next_slide("fantasy")
scroll_x = next_x % total_scroll_width
return matrix.canvas
scroll_x = next_x
return matrix.canvas