Add DFU screen support for I2C mono OLEDs - #40
Draft
rcarteraz wants to merge 1 commit into
Draft
Conversation
Adds an SSD1306/SH1106 display path alongside the existing SPI TFT one, so boards with an I2C OLED show a screen while waiting in UF2 or BLE OTA DFU mode instead of leaving the panel dark. Enabled on RAK4631, RAK3401, Wio Tracker L1, ProMicro nRF52840 and XIAO nRF52840/Sense. Boards with no display build byte-identical. Also fixes an out-of-bounds write in screen.c's printicon(): on the 160px-wide T096 and T1 the third drag-screen icon was drawn 386 bytes past the end of frame_buf.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Boards with an I2C OLED currently show nothing while sitting in DFU mode. This adds an SSD1306/SH1106 display path alongside the existing SPI TFT one, so those boards render the same UF2 drag-and-drop and BLE OTA screens the Heltec boards already get.
Boards
HAS_SCREEN 1/USE_SSD1306 1, untestedBoards with no display (SenseCAP Solar P1, T1000-E, ThinkNode M3/M6, WisMesh Tag, MX25LE01) build byte-identical — the whole feature is behind a
board.hdeclaration. E-ink boards (T-Echo, ThinkNode M1) are unaffected and still need a separate e-paper driver.Notes
Panel presence is probed rather than assumed, since an OLED is often a plug-in module or user-wired. If nothing ACKs, the screen is skipped and the board behaves exactly as before; every I2C wait is bounded so a missing or unterminated bus can't stall the bootloader.
Layout defaults for 1bpp panels live in
screen.c, so aboard.honly declares its bus, geometry and title. The existing colour layout survives the mono conversion unchanged because only the foreground palette entries light a pixel.Cost is ~1.8KB of flash on boards that opt in. The tightest board here ends at 94.3%.
DISPLAY_COL_OFFSETis panel-specific and can't be detected — the RAK4631's panel turned out to be 132-column, needing an offset of 2. The untested boards default to 0 with blanking spanning 132 columns, so a mismatch shows as a 2px shift rather than stray pixels. Whoever tests each board flips that if the image sits left.Also included
An out-of-bounds write in
printicon(): on the 160px-wide T096 and T1,DRAGX 4plus the defaultpendriveLogo_X 129put the third icon at x=133..164, writing 386 bytes past the end offrame_buf. Fixed by moving it to 124 and bounds-checking the blit. Predates this work and is independent of it — happy to split it out if preferred.Testing
All 17 boards build clean under
-Werror. RAK4631 flashed and confirmed showing both screens; layout verified by compilingscreen.cnatively and dumping the pages the driver emits.