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.
This commit is contained in:
=UltimateCodeWarrior
2026-07-20 19:24:38 -07:00
parent b8b6598dd3
commit 0de2b4fc5f
2 changed files with 5 additions and 11 deletions
+4 -11
View File
@@ -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()
@@ -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