From 1e3db572846a4c947e6880ec459a4d2e7236f29f Mon Sep 17 00:00:00 2001 From: Todd Herbert Date: Tue, 27 Feb 2024 19:00:54 +1300 Subject: [PATCH] fix: declare class only if USE_EINK, init all members --- src/graphics/EInkDisplay2.cpp | 1 - src/graphics/EInkDisplay2.h | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index e2a32d8f4c..45005dee1f 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -2,7 +2,6 @@ #ifdef USE_EINK #include "EInkDisplay2.h" -#include "GxEPD2_BW.h" #include "SPILock.h" #include "main.h" #include diff --git a/src/graphics/EInkDisplay2.h b/src/graphics/EInkDisplay2.h index 9477b43257..f40747f266 100644 --- a/src/graphics/EInkDisplay2.h +++ b/src/graphics/EInkDisplay2.h @@ -1,5 +1,7 @@ #pragma once +#ifdef USE_EINK + #include "GxEPD2_BW.h" #include @@ -58,7 +60,7 @@ class EInkDisplay : public OLEDDisplay virtual bool connect() override; // AdafruitGFX display object - instantiated in connect(), variant specific - GxEPD2_BW *adafruitDisplay; + GxEPD2_BW *adafruitDisplay = NULL; // If display uses HSPI #if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) @@ -67,5 +69,7 @@ class EInkDisplay : public OLEDDisplay private: // FIXME quick hack to limit drawing to a very slow rate - uint32_t lastDrawMsec; + uint32_t lastDrawMsec = 0; }; + +#endif \ No newline at end of file