fix: resolve first-board bring-up issues (power, OLED, XBee diagnostics, button naming) - #53
Merged
Merged
Conversation
…cs, button naming) Found and fixed during hands-on bring-up of the first assembled board: - Power-button-sense polarity was inverted (assumed active-high, actually active-low via an external pull-up) -- read the button as continuously held from boot and triggered an unwanted graceful shutdown 3s into every session. - OledDisplay could crash (StoreProhibited/null-buffer write) whenever the display wasn't present, because Adafruit_SSD1306::begin() never allocates its frame buffer unless its own begin() is called, and nothing else in the call chain checked readiness before rendering. Added a real I2C presence check (Adafruit's begin() never actually verifies an ACK) with fallback between 0x3C/0x3D, a full bus-scan diagnostic on total failure, and a readiness guard on every OledDisplay method. - Serial never reached the USB port at all: this board has no external USB-UART bridge, and ARDUINO_USB_CDC_ON_BOOT wasn't set, so Serial was going to unconnected UART0 pins instead of the native USB-CDC port. - Early boot diagnostics were getting lost even with a monitor already open, because native USB-CDC has to re-enumerate with the host after every reset. Added a bounded wait for an actual host connection before continuing. - Added an XBee ATTN pin read at boot to help isolate SPI wiring issues from module/firmware issues. - Buttons::kLeftUp/kLeftDown and kRightUp/kRightDown were mapped to the physically wrong button pairs (Vol/Trigger swapped) -- confirmed against the real controller and corrected. - The Button Test screen never updated after the first button press -- the display's change-detection only watched currentScreen()/ selectedMainMenuItem(), not lastTestedButtonIndex(), so pressing a button while already on that screen never triggered a redraw. - KiCad: the OLED Qwiic connector's pin assignment in SnipsControllers:SSD1306_OLED_4pin was wrong on two counts, both found by testing against real hardware -- VCC/GND were swapped, and once that was fixed, SCL/SDA turned out to be swapped too. Both corrected in the symbol (library file + schematic's embedded copy); the PCB itself still needs Update PCB from Schematic + a small copper rework for the next rev. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Everything found and fixed while doing hands-on bring-up of the first assembled board:
Adafruit_SSD1306::begin()never actually validates I2C ACKs and never allocates its frame buffer unless called — so when the display genuinely isn't there, any laterrender()call wrote through a null pointer (StoreProhibitedpanic → boot loop). Added a real I2C presence probe (address 0x3C with 0x3D fallback), a full bus-scan diagnostic when neither responds, and a readiness guard on everyOledDisplaymethod.ARDUINO_USB_CDC_ON_BOOTwasn't set, soSerialwas silently going to unconnected UART0 pins instead of the native USB-CDC port used for flashing/monitoring.kLeftUp/kLeftDownandkRightUp/kRightDownwere mapped to the physically wrong button pairs (Vol/Trigger swapped) — confirmed against the real controller and corrected. Nothing else in the codebase hardcodes the physical mapping, so this one change fixes it everywhere (menu-open combo, uplink suppression, Button Test display).currentScreen()/selectedMainMenuItem(), notlastTestedButtonIndex()— pressing a button while already on that screen changed neither, so the screen silently never refreshed.SnipsControllers:SSD1306_OLED_4pinwas wrong on two counts, both found by testing against real hardware — VCC/GND were swapped, and once fixed, SCL/SDA turned out to be swapped too. Both corrected in the symbol (library file + schematic's embedded copy); the PCB itself still needs Update PCB from Schematic (F8) and a small copper rework near the connector for the next revision.Test plan
pio test -e native— 262/262 passingpio run -e esp32s3— builds clean🤖 Generated with Claude Code