oled: --fill option to test the display

This commit is contained in:
Maxim Devaev 2025-07-09 13:09:47 +03:00
parent fbf5e52b0f
commit 49638ed896
2 changed files with 8 additions and 0 deletions

View File

@ -78,6 +78,7 @@ def main() -> None: # pylint: disable=too-many-locals,too-many-branches,too-man
parser.add_argument("--image", default="", type=(lambda arg: _get_data_path("pics", arg)), help="Display some image, wait a single interval and exit")
parser.add_argument("--text", default="", help="Display some text, wait a single interval and exit")
parser.add_argument("--pipe", action="store_true", help="Read and display lines from stdin until EOF, wait a single interval and exit")
parser.add_argument("--fill", action="store_true", help="Fill the display with 0xFF")
parser.add_argument("--clear-on-exit", action="store_true", help="Clear display on exit")
parser.add_argument("--contrast", default=64, type=int, help="Set OLED contrast, values from 0 to 255")
parser.add_argument("--fahrenheit", action="store_true", help="Display temperature in Fahrenheit instead of Celsius")
@ -121,6 +122,9 @@ def main() -> None: # pylint: disable=too-many-locals,too-many-branches,too-man
text = ""
time.sleep(options.interval)
elif options.fill:
screen.draw_white()
else:
stop_reason: (str | None) = None

View File

@ -52,3 +52,7 @@ class Screen:
def draw_image(self, image_path: str) -> None:
with luma_canvas(self.__device) as draw:
draw.bitmap(self.__offset, Image.open(image_path).convert("1"), fill="white")
def draw_white(self) -> None:
with luma_canvas(self.__device) as draw:
draw.rectangle((0, 0, self.__device.width, self.__device.height), fill="white")