Skip to content

Commit 7124fa1

Browse files
authored
Merge pull request #2815 from UltimateCodeWarrior/fix/tbeam-supreme-v3-oled-i2c
Fix blank OLED on T-Beam Supreme V3 (I2C bus init + 0x3D address)
2 parents d2fd1fd + 0de2b4f commit 7124fa1

3 files changed

Lines changed: 15 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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ 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+
// Wire must already be initialised by board.begin() before this is called.
15+
// Boards with non-standard SH1106 addresses should define DISPLAY_ADDRESS
16+
// in their variant/platformio configuration.
17+
return i2c_probe(Wire, DISPLAY_ADDRESS) && display.begin(DISPLAY_ADDRESS, true);
1518
}
1619

1720
void SH1106Display::turnOn()

variants/lilygo_tbeam_supreme_SX1262/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ build_flags =
1818
-D RADIO_CLASS=CustomSX1262
1919
-D WRAPPER_CLASS=CustomSX1262Wrapper
2020
-D DISPLAY_CLASS=SH1106Display
21+
-D DISPLAY_ADDRESS=0x3D
2122
-D LORA_TX_POWER=22
2223
-D P_LORA_TX_LED=6
2324
-D PIN_BOARD_SDA=17

0 commit comments

Comments
 (0)