Fix SH1106 OLED address detection on T-Beam Supreme sub-variants - #3153
Open
strasharo wants to merge 1 commit into
Open
Fix SH1106 OLED address detection on T-Beam Supreme sub-variants#3153strasharo wants to merge 1 commit into
strasharo wants to merge 1 commit into
Conversation
The T-Beam S3 Supreme ships with a QMC6310N magnetometer whose configurable I2C address collides with the OLED's: depending on the board sub-variant, the display sits at either 0x3C or 0x3D, with the magnetometer occupying the other one. SH1106Display::begin() only ever tried the single address from DISPLAY_ADDRESS, so boards where the build-time default doesn't match their wiring get a silently blank screen even though the panel and bus are both fine. begin() now probes both 0x3C and 0x3D and disambiguates by reading the magnetometer's chip-ID register (0x00 returns 0x80 on a QMC6310N) - the same technique LilyGo's own factory test firmware uses - instead of picking whichever address happens to ACK first. Fixes meshcore-dev#3147
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3147 (T-Beam Supreme blank display on v1.17.0).
The T-Beam S3 Supreme ships a QMC6310N magnetometer whose configurable I2C address collides with the OLED's — depending on the board sub-variant (VHF/UHF, per LilyGo's hardware docs), the display sits at either
0x3Cor0x3D, with the magnetometer on the other one.SH1106Display::begin()only ever tried the singleDISPLAY_ADDRESSfrom the variant's build flags (currently hardcoded to0x3Dfor this board), so on units where that doesn't match the actual wiring, the display silently fails to init even though the panel and I2C bus are both fine.This is a regression from before v1.17.0: v1.16.0 worked because of #2815, but that fix only tries
0x3Dthen falls back to0x3Cwithout checking which device is actually at each address — so on boards where the magnetometer ACKs first, it gets initialized as if it were the display.Fix
begin()now probes both0x3Cand0x3Dand disambiguates by reading the magnetometer's chip-ID register (a read of register0x00returns0x80on a QMC6310N) — same technique LilyGo's own factory test firmware uses — instead of just taking whichever address ACKs first.This is the same core approach as #2591, ported onto current
dev(that PR predates a color-type refactor and no longer applies/builds cleanly).Testing
Built and flashed
T_Beam_S3_Supreme_SX1262_companion_radio_blelocally on a T-Beam Supreme unit that reproduces #3147:dev: display works.Related
dev), Fix T-Beam Supreme OLED address #2276 (hardcodes0x3D, already effectively whatdevdoes today and insufficient on its own)