From d774cd952e90847cb0f8f6e2fa4d8fc30483696d Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 9 Jul 2025 13:58:19 -0500 Subject: [PATCH] access display and framebuffer properties for values, format code. --- adafruit_fruitjam/peripherals.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/adafruit_fruitjam/peripherals.py b/adafruit_fruitjam/peripherals.py index 47f4099..ea7224e 100644 --- a/adafruit_fruitjam/peripherals.py +++ b/adafruit_fruitjam/peripherals.py @@ -79,19 +79,23 @@ def request_display_config(width, height): ) supervisor.runtime.display = framebufferio.FramebufferDisplay(fb) + def get_display_config(): """ - Get the current display size configuration. + Get the current display size configuration. :return: width: The width of the display in pixels. :return: height: The height of the display in pixels. :return: pixel_depth of the display in pixels """ + try: - display = (picodvi.Framebuffer.width, picodvi.Framebuffer.height, picodvi.Framebuffer.color_depth) - return display - except ValueError as e: - return (None, None, None) + display = supervisor.runtime.display + display_config = (display.width, display.height, display.framebuffer.color_depth) + return display_config + except ValueError: + return (None, None, None) + class Peripherals: """Peripherals Helper Class for the FruitJam Library