Skip to content

Add DFU screen support for I2C mono OLEDs - #40

Draft
rcarteraz wants to merge 1 commit into
masterfrom
oled-dfu-screen
Draft

Add DFU screen support for I2C mono OLEDs#40
rcarteraz wants to merge 1 commit into
masterfrom
oled-dfu-screen

Conversation

@rcarteraz

Copy link
Copy Markdown
Member

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

Enabled Notes
RAK4631 Validated on hardware
RAK3401 Pin-identical WisBlock sibling, untested
Wio Tracker L1 Variant declares HAS_SCREEN 1 / USE_SSD1306 1, untested
ProMicro nRF52840 Pins per the default Meshtastic variant, untested
XIAO nRF52840 / Sense Kit-default I2C pins, untested

Boards with no display (SenseCAP Solar P1, T1000-E, ThinkNode M3/M6, WisMesh Tag, MX25LE01) build byte-identical — the whole feature is behind a board.h declaration. 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 a board.h only 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_OFFSET is 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 4 plus the default pendriveLogo_X 129 put the third icon at x=133..164, writing 386 bytes past the end of frame_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 compiling screen.c natively and dumping the pages the driver emits.

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.
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant