mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 15:16:40 +00:00
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:
@@ -11,17 +11,10 @@ bool SH1106Display::i2c_probe(TwoWire &wire, uint8_t addr)
|
|||||||
|
|
||||||
bool SH1106Display::begin()
|
bool SH1106Display::begin()
|
||||||
{
|
{
|
||||||
// Address selection: on some board revisions (notably the LilyGo T-Beam
|
// Wire must already be initialised by board.begin() before this is called.
|
||||||
// Supreme V3) the OLED lives at 0x3D because 0x3C is occupied by a
|
// Boards with non-standard SH1106 addresses should define DISPLAY_ADDRESS
|
||||||
// magnetometer (QMC6310N). 0x3D is only ever used by the OLED, so prefer it
|
// in their variant/platformio configuration.
|
||||||
// when present, otherwise fall back to the standard 0x3C (DISPLAY_ADDRESS).
|
return i2c_probe(Wire, DISPLAY_ADDRESS) && display.begin(DISPLAY_ADDRESS, true);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SH1106Display::turnOn()
|
void SH1106Display::turnOn()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ build_flags =
|
|||||||
-D RADIO_CLASS=CustomSX1262
|
-D RADIO_CLASS=CustomSX1262
|
||||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||||
-D DISPLAY_CLASS=SH1106Display
|
-D DISPLAY_CLASS=SH1106Display
|
||||||
|
-D DISPLAY_ADDRESS=0x3D
|
||||||
-D LORA_TX_POWER=22
|
-D LORA_TX_POWER=22
|
||||||
-D P_LORA_TX_LED=6
|
-D P_LORA_TX_LED=6
|
||||||
-D PIN_BOARD_SDA=17
|
-D PIN_BOARD_SDA=17
|
||||||
|
|||||||
Reference in New Issue
Block a user