feat(cardputer): define GROVE_SDA/SCL and add Glass2 secondary OLED support#2468
Open
Swissola wants to merge 3 commits into
Open
feat(cardputer): define GROVE_SDA/SCL and add Glass2 secondary OLED support#2468Swissola wants to merge 3 commits into
Swissola wants to merge 3 commits into
Conversation
… path
run_bjs_script_headless() called strndup(filename.c_str(), slash) where
slash = filename.lastIndexOf('/') returns -1 when no path separator is
present. strndup takes size_t, so -1 coerces to SIZE_MAX (~4 GB) and the
allocator either panics on the heap assertion or returns NULL. The
subsequent JS_NewString(ctx, scriptDirpath) then dereferences NULL,
crashing the interpreter before the script runs.
The same bug bites when the path is at root level (slash == 0):
strndup(p, 0) produces an empty string, making __dirpath "" instead of
"/" and breaking any relative path resolution inside the script.
Fix: handle the no-slash and root-slash cases explicitly before falling
through to the normal strndup path.
Likely root cause of issue BruceDevices#2450 (crash launching the app store on
Cardputer ADV), where the app store script path may be constructed
without a leading slash depending on the invocation path.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Define GROVE_SDA=2 / GROVE_SCL=1 in pins_arduino.h (Grove HY2.0-4P; distinct from EXT header SDA=13/SCL=15 used for GPS on ADV) - Add glass2.h (SSD1309/Adafruit_SSD1306 wrapper, Wire on GPIO1/2) - Call glass2Init() in _post_setup_gpio() for both standard Cardputer and ADV variants; shows startup splash on each path - Add Adafruit SSD1306 ^2.5.13 to both lib_deps blocks in platformio.ini Grove GPIO1/2 are free on standard Cardputer (not used by keyboard or SPI). On ADV, GPIO13/15 serve the GPS cap leaving Grove for Glass2. All glass2Show() calls are no-ops if no Glass2 is connected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
M5UnitGLASS2.h ships with M5GFX, already a transitive dependency via M5Unified — no extra library required. Removes the Adafruit SSD1306 entry added in error from both lib_deps blocks in platformio.ini. Co-Authored-By: Claude Sonnet 4.6 <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
Two related changes for the M5Stack Cardputer board target.
Fix: Define
GROVE_SDA/GROVE_SCLinpins_arduino.hThe Cardputer board definition had no
GROVE_SDAorGROVE_SCLmacros, sobruceConfigPins.i2c_bus(initialised from these inconfigPins.h:174) defaulted to-1. This meant any Grove I2C accessory would fail to initialise without manually setting pins in the config menu.These are distinct from the EXT header
SDA=13/SCL=15(used by the GPS cap on Cardputer ADV).Feature: Glass2 secondary OLED display
Adds support for the M5Stack Glass2 Unit (1.51" transparent OLED, SSD1309 driver, 128×64, I2C 0x3C) via the Grove port.
glass2.husing M5UnitGLASS2 from M5GFX — the official M5Stack driver, already a transitive dependency via M5Unified. No additional library required.glass2Init()called in_post_setup_gpio()for both standard Cardputer and ADV variants_g2_readyflag means all calls are safe no-ops if no Glass2 is connectedTest plan
bruceConfigPins.i2c_busresolves to GPIO2/1 by default (no longer -1)_g2_readyguard prevents any I2C traffic🤖 Generated with Claude Code