[CRITICAL] Circular extern DisplayManager dependency in display drivers #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Both DisplayDriverTFT (esp32-32e, esp32-32e-4) and DisplayDriverGFX (esp32-s3-lcd-43) declare
extern DisplayManager display;and calldisplay.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.cppboards/esp32-32e-4/DisplayDriverTFT.cppboards/esp32-s3-lcd-43/DisplayDriverGFX.cppFix
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.