From bb6a81f1e9ffb0627373ddacae9024d5d419f8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 19 Aug 2026 15:50:49 +0000 Subject: [PATCH] Pass framebuffer rotation through DisplayDriverConfig (#11534) * tftSetup: pass framebuffer rotation via DisplayDriverConfig Replaces the MESHTASTIC_FB_ROTATION environment variable with DisplayDriverConfig::rotation(), which device-ui reads in FBDriver::create(const DisplayDriverConfig &). * tftSetup: carry framebuffer rotation in the panel config Use the DisplayDriverConfig builder with panel_config_t::offset_rotation instead of a dedicated rotation setter. Width and height fall back to the device-ui defaults when the yaml does not set them. * tftSetup: pass the framebuffer panel config unfiltered Take Display.Width, Display.Height and Display.OffsetRotate straight from the portduino config, like the CUSTOM_TFT branch does. --- src/graphics/tftSetup.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/graphics/tftSetup.cpp b/src/graphics/tftSetup.cpp index 460b2f86e..8e971cb60 100644 --- a/src/graphics/tftSetup.cpp +++ b/src/graphics/tftSetup.cpp @@ -15,8 +15,6 @@ #endif #if defined(ARCH_PORTDUINO) || !defined(HAS_FREE_RTOS) -#include -#include #include #endif @@ -351,15 +349,11 @@ void tftSetup(void) #elif defined(USE_FRAMEBUFFER) if (portduino_config.displayPanel == fb) { // Rotation from yaml Display.OffsetRotate: 1=90, 2=180, 3=270 deg - char rbuf[4]; - snprintf(rbuf, sizeof(rbuf), "%d", portduino_config.displayRotate ? (portduino_config.displayOffsetRotate & 3) : 0); - if (setenv("MESHTASTIC_FB_ROTATION", rbuf, 1) != 0) - LOG_ERROR("Failed to set MESHTASTIC_FB_ROTATION, framebuffer will use its default rotation"); - if (portduino_config.displayWidth && portduino_config.displayHeight) - displayConfig = DisplayDriverConfig(DisplayDriverConfig::device_t::FB, (uint16_t)portduino_config.displayWidth, - (uint16_t)portduino_config.displayHeight); - else - displayConfig.device(DisplayDriverConfig::device_t::FB); + displayConfig.device(DisplayDriverConfig::device_t::FB) + .panel(DisplayDriverConfig::panel_config_t{.type = panels[portduino_config.displayPanel], + .panel_width = (uint16_t)portduino_config.displayWidth, + .panel_height = (uint16_t)portduino_config.displayHeight, + .offset_rotation = (uint8_t)portduino_config.displayOffsetRotate}); } else #endif {