From ce707923099b8739ac3cb88365797b262605794a Mon Sep 17 00:00:00 2001 From: Florent Date: Sat, 18 Oct 2025 14:03:27 +0200 Subject: [PATCH] lgfx_display: better handle display class construction --- src/helpers/ui/LGFXDisplay.h | 11 +++-------- .../sensecap_indicator-espnow/SCIndicatorDisplay.h | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/helpers/ui/LGFXDisplay.h b/src/helpers/ui/LGFXDisplay.h index 81d0239f..ad7212ec 100644 --- a/src/helpers/ui/LGFXDisplay.h +++ b/src/helpers/ui/LGFXDisplay.h @@ -1,9 +1,3 @@ - -/* - * Base class for LovyanGFX supported display (works on ESP32 mainly) - * You can extend this class to support your display, providing your own LGFX - */ - #pragma once #include @@ -20,11 +14,12 @@ protected: LGFX_Device* display; LGFX_Sprite buffer; - bool _isOn; + bool _isOn = false; int _color = TFT_WHITE; public: - LGFXDisplay(int w, int h):DisplayDriver(w/UI_ZOOM, h/UI_ZOOM) {_isOn = false;} + LGFXDisplay(int w, int h, LGFX_Device &disp) + : DisplayDriver(w/UI_ZOOM, h/UI_ZOOM), display(&disp) {} bool begin(); bool isOn() override { return _isOn; } void turnOn() override; diff --git a/variants/sensecap_indicator-espnow/SCIndicatorDisplay.h b/variants/sensecap_indicator-espnow/SCIndicatorDisplay.h index 6a7e3177..aabedd24 100644 --- a/variants/sensecap_indicator-espnow/SCIndicatorDisplay.h +++ b/variants/sensecap_indicator-espnow/SCIndicatorDisplay.h @@ -124,6 +124,5 @@ public: class SCIndicatorDisplay : public LGFXDisplay { LGFX disp; public: - SCIndicatorDisplay() : LGFXDisplay(480, 480) - { display=&disp; } + SCIndicatorDisplay() : LGFXDisplay(480, 480, disp) {} };