fix(observer): recover T-Beam Supreme display startup

This commit is contained in:
agessaman committed 2026-08-10 12:50:11 -07:00
1 parent b744b42aab
commit 1f79e91c7f
5 files changed
+41 -10

No files matched your search

+20 -2
View File
@@ -24,18 +24,36 @@ bool SH1106Display::begin()
{
// Wire must already be initialised by board.begin() before this is called.
// Boards with non-standard SH1106 addresses should define DISPLAY_ADDRESS
// in their variant/platformio configuration.
return i2c_probe(Wire, DISPLAY_ADDRESS) && display.begin(DISPLAY_ADDRESS, true);
// in their variant/platformio configuration. Some board revisions may have
// different solder-bridge address configurations, so variants can also
// provide DISPLAY_ADDRESS_ALT as a fallback.
_initialized = false;
if (i2c_probe(Wire, DISPLAY_ADDRESS) && display.begin(DISPLAY_ADDRESS, true)) {
_initialized = true;
}
#ifdef DISPLAY_ADDRESS_ALT
if (!_initialized && DISPLAY_ADDRESS_ALT != DISPLAY_ADDRESS &&
i2c_probe(Wire, DISPLAY_ADDRESS_ALT) &&
display.begin(DISPLAY_ADDRESS_ALT, true)) {
_initialized = true;
}
#endif
return _initialized;
}
void SH1106Display::turnOn()
{
if (!_initialized) return;
display.oled_command(SH110X_DISPLAYON);
_isOn = true;
}
void SH1106Display::turnOff()
{
if (!_initialized) {
_isOn = false;
return;
}
display.oled_command(SH110X_DISPLAYOFF);
_isOn = false;
}
+6 -2
View File
@@ -17,16 +17,20 @@
class SH1106Display : public DisplayDriver
{
Adafruit_SH1106G display;
bool _initialized;
bool _isOn;
uint8_t _color;
bool i2c_probe(TwoWire &wire, uint8_t addr);
public:
SH1106Display() : DisplayDriver(128, 64), display(128, 64, &Wire, PIN_OLED_RESET) { _isOn = false; }
SH1106Display() : DisplayDriver(128, 64), display(128, 64, &Wire, PIN_OLED_RESET) {
_initialized = false;
_isOn = false;
}
bool begin();
bool isOn() override { return _isOn; }
bool isOn() override { return _initialized && _isOn; }
void turnOn() override;
void turnOff() override;
void clear() override;