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.
This commit is contained in:
Thomas Göttgens
2026-08-19 15:50:49 +00:00
committed by GitHub
parent 93d15a5368
commit bb6a81f1e9
1 file changed
+5 -11
+5 -11
View File
@@ -15,8 +15,6 @@
#endif
#if defined(ARCH_PORTDUINO) || !defined(HAS_FREE_RTOS)
#include <cstdio>
#include <cstdlib>
#include <thread>
#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
{