Browse Source

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.
pull/2815/head
=UltimateCodeWarrior 4 days ago
parent
commit
0de2b4fc5f
  1. 15
      src/helpers/ui/SH1106Display.cpp
  2. 1
      variants/lilygo_tbeam_supreme_SX1262/platformio.ini

15
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()

1
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

Loading…
Cancel
Save