From 0de2b4fc5f208489a8523882f050ead033ed3d8b Mon Sep 17 00:00:00 2001 From: =UltimateCodeWarrior Date: Mon, 20 Jul 2026 19:24:38 -0700 Subject: [PATCH] Move Supreme OLED address to variant config Keep SH1106Display generic by relying on DISPLAY_ADDRESS while the T-Beam Supreme variant declares its 0x3D OLED address. --- src/helpers/ui/SH1106Display.cpp | 15 ++++----------- .../lilygo_tbeam_supreme_SX1262/platformio.ini | 1 + 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/helpers/ui/SH1106Display.cpp b/src/helpers/ui/SH1106Display.cpp index 86c6089b..57ccfc2e 100644 --- a/src/helpers/ui/SH1106Display.cpp +++ b/src/helpers/ui/SH1106Display.cpp @@ -11,17 +11,10 @@ bool SH1106Display::i2c_probe(TwoWire &wire, uint8_t addr) bool SH1106Display::begin() { - // Address selection: on some board revisions (notably the LilyGo T-Beam - // Supreme V3) the OLED lives at 0x3D because 0x3C is occupied by a - // magnetometer (QMC6310N). 0x3D is only ever used by the OLED, so prefer it - // when present, otherwise fall back to the standard 0x3C (DISPLAY_ADDRESS). - uint8_t addr = 0; - if (i2c_probe(Wire, 0x3D)) { - addr = 0x3D; - } else if (i2c_probe(Wire, DISPLAY_ADDRESS)) { - addr = DISPLAY_ADDRESS; - } - return addr && display.begin(addr, true); + // 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); } void SH1106Display::turnOn() diff --git a/variants/lilygo_tbeam_supreme_SX1262/platformio.ini b/variants/lilygo_tbeam_supreme_SX1262/platformio.ini index 02946156..8bfc4093 100644 --- a/variants/lilygo_tbeam_supreme_SX1262/platformio.ini +++ b/variants/lilygo_tbeam_supreme_SX1262/platformio.ini @@ -18,6 +18,7 @@ build_flags = -D RADIO_CLASS=CustomSX1262 -D WRAPPER_CLASS=CustomSX1262Wrapper -D DISPLAY_CLASS=SH1106Display + -D DISPLAY_ADDRESS=0x3D -D LORA_TX_POWER=22 -D P_LORA_TX_LED=6 -D PIN_BOARD_SDA=17