From 5916bff0c781af503f487128c4dce4c780ed4d57 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sat, 17 Jan 2026 21:34:45 +0100 Subject: [PATCH] enable clear() in dev mode --- lib/display.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/display.py b/lib/display.py index ef0a413..5a9d303 100644 --- a/lib/display.py +++ b/lib/display.py @@ -1,5 +1,5 @@ from rgbmatrix import RGBMatrix, RGBMatrixOptions -from PIL import ImageFont, Image +from PIL import ImageFont, Image, ImageDraw #from time import sleep # Das Bild nur speichern. Nicht die LED-Matrix ansteuern. @@ -58,5 +58,17 @@ class MyMatrix: """Get an image buffer with the right dimensions""" return Image.new("RGB", (MATRIX_WIDTH * NUMBER_OF_PANELS, MATRIX_HEIGHT)) + def clear(self): + """Reset the matrix display. Set to black.""" + if DEV: + # Just fill with black + image_buffer = self.buffer() + draw = ImageDraw.Draw(image_buffer) + draw.rectangle( ((0,0),(self.width-1,self.height-1)), fill=(0,0,0) ) + self.show(image_buffer) + else: + # Send reset signal to matrix + self.matrix.Clear() + matrix = MyMatrix()