[CRITICAL] Circular extern DisplayManager dependency in display drivers #2

Open
opened 2026-05-29 22:22:34 +00:00 by david · 0 comments
Owner

Problem

Both DisplayDriverTFT (esp32-32e, esp32-32e-4) and DisplayDriverGFX (esp32-s3-lcd-43) declare extern DisplayManager display; and call display.calculateDashboardLayouts() from within the driver.

This creates a circular dependency where the display driver knows about its manager, violating the interface design principle.

Affected files:

  • boards/esp32-32e/DisplayDriverTFT.cpp
  • boards/esp32-32e-4/DisplayDriverTFT.cpp
  • boards/esp32-s3-lcd-43/DisplayDriverGFX.cpp

Fix

Pass layout data as a parameter to the render() method or calculate layouts in the .ino file before calling render(), rather than having the driver reach into DisplayManager.

## Problem Both DisplayDriverTFT (esp32-32e, esp32-32e-4) and DisplayDriverGFX (esp32-s3-lcd-43) declare `extern DisplayManager display;` and call `display.calculateDashboardLayouts()` from within the driver. This creates a circular dependency where the display driver knows about its manager, violating the interface design principle. **Affected files:** - `boards/esp32-32e/DisplayDriverTFT.cpp` - `boards/esp32-32e-4/DisplayDriverTFT.cpp` - `boards/esp32-s3-lcd-43/DisplayDriverGFX.cpp` ## Fix Pass layout data as a parameter to the render() method or calculate layouts in the .ino file before calling render(), rather than having the driver reach into DisplayManager.
david added the critical label 2026-05-29 22:22:34 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: klubhaus/klubhaus-doorbell#2