From 11d57e721af16e040a4995189a08c1eba354d7cb Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 29 Mar 2020 11:00:25 -0700 Subject: [PATCH] fix #68 (@girtsf, pls review - ps: no worries ;-) ) // We don't set useDisplay until setup() is called, because some boards have a declaration of this object but the device // is never found when probing i2c and therefore we don't call setup and never want to do (invalid) accesses to this device. --- src/screen.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/screen.cpp b/src/screen.cpp index 8f81fbb63..ea7b07a02 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -402,7 +402,7 @@ void _screen_header() #endif Screen::Screen(uint8_t address, uint8_t sda, uint8_t scl) - : cmdQueue(32), useDisplay(sda || scl), dispdev(address, sda, scl), ui(&dispdev) + : cmdQueue(32), useDisplay(false), dispdev(address, sda, scl), ui(&dispdev) { } @@ -425,8 +425,9 @@ void Screen::handleSetOn(bool on) void Screen::setup() { - if (!useDisplay) - return; + // We don't set useDisplay until setup() is called, because some boards have a declaration of this object but the device + // is never found when probing i2c and therefore we don't call setup and never want to do (invalid) accesses to this device. + useDisplay = true; dispdev.resetOrientation();