diff --git a/examples/framebuf_simpletest.py b/examples/framebuf_simpletest.py index 6ff858e..963a911 100644 --- a/examples/framebuf_simpletest.py +++ b/examples/framebuf_simpletest.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT +import math import adafruit_framebuf print("framebuf test will draw to the REPL") @@ -8,11 +9,12 @@ print("framebuf test will draw to the REPL") WIDTH = 32 HEIGHT = 8 -buffer = bytearray(round(WIDTH * HEIGHT / 8)) +buffer = bytearray(round(WIDTH * math.ceil(HEIGHT / 8))) fb = adafruit_framebuf.FrameBuffer( buffer, WIDTH, HEIGHT, buf_format=adafruit_framebuf.MVLSB ) + # Ascii printer for very small framebufs! def print_buffer(the_fb): print("." * (the_fb.width + 2))