Skip to content

Commit b8b6598

Browse files
Fix blank OLED on T-Beam Supreme V3 (I2C bus + 0x3D address)
The SH1106 OLED on the LilyGo T-Beam Supreme V3 never lights up because: 1. The primary I2C bus (Wire) that the OLED, BME280 and magnetometer share is never initialized. The PMU/RTC use Wire1 (via XPowersLib); nothing brings up Wire on PIN_BOARD_SDA/PIN_BOARD_SCL, so the display driver talks on the wrong default pins. 2. The OLED is at I2C address 0x3D on this board (0x3C is taken by the QMC6310 magnetometer), but SH1106Display::begin() only tried 0x3C. Initialize Wire for TBEAM_SUPREME_SX1262, and have SH1106Display::begin() prefer 0x3D (only ever used by the OLED) before falling back to 0x3C. Backwards-compatible for boards with the OLED at 0x3C. Closes #2609
1 parent 3192684 commit b8b6598

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/helpers/esp32/TBeamBoard.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ void TBeamBoard::begin() {
1616

1717
ESP32Board::begin();
1818

19+
#ifdef TBEAM_SUPREME_SX1262
20+
// On the T-Beam S3 Supreme the PMU + RTC sit on Wire1 (GPIO 42/41, brought
21+
// up by XPowersLib), while the SH1106 OLED and the BME280/QMC6310 sensors
22+
// sit on the primary bus, Wire (GPIO PIN_BOARD_SDA/PIN_BOARD_SCL). Nothing
23+
// else initialises Wire on this board, so the display driver would
24+
// otherwise talk on the wrong (default) pins and display.begin() fails,
25+
// leaving the screen blank. Bring the OLED bus up here.
26+
Wire.begin(PIN_BOARD_SDA, PIN_BOARD_SCL);
27+
#endif
28+
1929
power_init();
2030

2131
//Configure user button

src/helpers/ui/SH1106Display.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,17 @@ bool SH1106Display::i2c_probe(TwoWire &wire, uint8_t addr)
1111

1212
bool SH1106Display::begin()
1313
{
14-
return display.begin(DISPLAY_ADDRESS, true) && i2c_probe(Wire, DISPLAY_ADDRESS);
14+
// Address selection: on some board revisions (notably the LilyGo T-Beam
15+
// Supreme V3) the OLED lives at 0x3D because 0x3C is occupied by a
16+
// magnetometer (QMC6310N). 0x3D is only ever used by the OLED, so prefer it
17+
// when present, otherwise fall back to the standard 0x3C (DISPLAY_ADDRESS).
18+
uint8_t addr = 0;
19+
if (i2c_probe(Wire, 0x3D)) {
20+
addr = 0x3D;
21+
} else if (i2c_probe(Wire, DISPLAY_ADDRESS)) {
22+
addr = DISPLAY_ADDRESS;
23+
}
24+
return addr && display.begin(addr, true);
1525
}
1626

1727
void SH1106Display::turnOn()

0 commit comments

Comments
 (0)