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.
1.2-legacy
geeksville 2020-03-29 11:00:25 -07:00
rodzic 9b0e329bb9
commit 11d57e721a
1 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -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();