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()