feat: drive OLED with a testable screen-content model (PR 3/9) - #38
Merged
Conversation
Adds the SSD1306 OLED per PCB/README.md's hardware table (128x64, I2C). Split the same way as the rest of this rewrite: ScreenBuffer (screen.h/.cpp) is pure content — just a small grid of text lines, fully unit tested — and OledDisplay (oled.cpp) is a thin adapter over Adafruit_SSD1306/GFX that draws whatever a ScreenBuffer holds. Later PRs (menu, complications, gesture feedback) drive the display by changing ScreenBuffer content, never by touching the display directly. oled.cpp is hardware-touching (I2C/Adafruit_SSD1306) and has no branching logic worth testing, so it's excluded from native build/coverage the same way SnipsController.ino already is — extended platformio.ini's build_src_filter and ci.yml's gcovr --exclude to match. For now SnipsController.ino just shows a static boot message — real content lands with the menu/complications PRs. Flagged two assumptions in oled.h for real-hardware bring-up: the module's I2C address (0x3C) and that it needs no dedicated reset pin — neither is documented in the PCB docs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 7, 2026
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
PR 3 of the firmware rewrite (PR 1: #35, PR 2: #36). Adds the SSD1306 OLED per
PCB/README.md's hardware table (128x64, I2C on pins 8/9).ScreenBuffer(include/screen.h/src/screen.cpp): pure content model — a small grid of text lines (8 rows x 21 cols, sized for the default 6x8px GFX font on this display), fully unit tested. Decides what text should be shown; knows nothing about I2C or Adafruit.OledDisplay(include/oled.h/src/oled.cpp): thin adapter wrappingAdafruit_SSD1306/GFX — draws whatever aScreenBuffercurrently holds. No content decisions live here.ScreenBuffercontent — nothing after this PR should need to toucholed.cppdirectly.oled.cppis hardware-touching with no branching logic worth testing, so it joinsSnipsController.inoin the native build/coverage exclusion list (platformio.ini+ci.yml, both updated).include/oled.hfor real-hardware bring-up, since neither is documented in the PCB docs: the module's I2C address (assumed0x3C) and that it needs no dedicated reset pin.For now
SnipsController.inojust shows a static boot message on the two top lines — real content lands with the menu/complications PRs.Test plan
pio test -e native— all 24 test cases passgcovr --exclude 'src/SnipsController\.ino' --exclude 'src/oled\.cpp' --fail-under-line 90— 100% acrossbuttons.cpp/power_latch.cpp/screen.cpppio run -e esp32s3— builds successfully, Adafruit SSD1306/GFX libs resolve and link0x3D(seeinclude/oled.h)🤖 Generated with Claude Code