Repository navigation
add one-command setup.sh + vendor ArduinoLibs submodule for a portable build - #16
Conversation
Make a fresh clone build with all AMPWorks usermods via one command, with no
machine-specific paths.
- Vendor ArduinoLibs (MPR121 + Debug) as a submodule of this repo, referenced
from WLED/platformio.ini as ${PROJECT_DIR}/../ArduinoLibs (WLED submodule
pointer bumped to the matching platformio.ini rewrite).
- Switch the WLED submodule URL to HTTPS so a keyless clone can init it.
- setup.sh: check prereqs (git, python3/pip, Node.js/npm), init submodules,
install PlatformIO into an isolated .venv, and run a verify build.
- .gitignore the .venv; document the clone -> setup.sh -> build flow in CLAUDE.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Node is only needed to regenerate the web UI; the firmware envs use committed UI headers, so a missing Node no longer fails setup.sh (warns instead). Bump the WLED submodule pointer to include the my_config.h self-sufficiency fix. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The wled00/html_*.h headers the firmware #includes are gitignored (generated, not committed). The custom firmware envs skip the per-build UI regen for fast iteration, so setup.sh runs `npm install && npm run build` once during bootstrap to generate them. Node is therefore required (reverted the earlier soft-warn). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Self-review of the portable-build bootstrap. Overall this is clean and achieves the stated goal: setup.sh is well-structured (set -euo pipefail, quoted vars, isolated venv, idempotent venv check, actionable prereq failures), the ArduinoLibs vendoring is correct (MPR121 declares a Debug dependency and MPR121.cpp includes <Debug.h>, so both vendored libs are genuinely needed and resolve by name via lib_extra_dirs), and both .gitmodules HTTPS URLs are public + keyless-clonable. I verified the pinned submodule commits are reachable on their remotes (WLED 71fee6c on the portable-lib-paths branch, ArduinoLibs 43efab6 on main), so a cold git submodule update --init --recursive succeeds today. A few things to address:
-
apa102_mpr121env does not exist in the committed WLED platformio.ini.grep '^\[env:' WLED/platformio.inishows only[env:ampworks]among the custom envs. But setup.sh advertises--env=apa102_mpr121in its usage text and the final "Custom envs" banner, CLAUDE.md's Quick Start implies it, and the plan's Test Plan claimspio run -e apa102_mpr121builds. A cold-clone user who runs./setup.sh --env=apa102_mpr121gets a hard failure (unknown env). The inline# available once its PR landshedge in the banner is easy to miss and contradicts the usage/next-steps. Either land that env in this submodule bump or drop/clearly gate every reference to it until it exists. -
Submodule PR ordering / gitlink durability (cross-repo). Parent PR#16 pins WLED to 71fee6c, which currently lives ONLY on the un-merged
portable-lib-pathsbranch (PR#5 head), not on WLED main. That is fine while the branch exists, but merge order matters: if PR#5 is squash-merged (new commit hash) and its branch deleted before PR#16's pointer is re-bumped to the landed commit, the parent gitlink dangles and cold clones fail to fetch it. Recommend merging PR#5 first, then bumping the parent pointer to the commit that actually lands on WLED main. -
Reproducibility gap in PlatformIO install (see inline). The goal is a reproducible bootstrap and WLED/requirements.txt pins platformio==6.1.16, but setup.sh installs unpinned
platformio(latest on PyPI), which can drift from the tested toolchain. -
Suggested post-merge check: run ./setup.sh on a second machine / clean user account with no pre-existing ~/.platformio and no SSH keys, to prove a genuinely cold clone -> build works. The plan's temp-dir smoke test shares this machine's toolchain caches, so it does not fully exercise the cold path (toolchain download, keyless submodule init, fresh venv).
| python3 -m venv "$VENV" | ||
| "$VENV/bin/python" -m pip install --quiet --upgrade pip | ||
| info "Installing PlatformIO (first run downloads a fair bit — grab a coffee)" | ||
| "$VENV/bin/python" -m pip install --quiet platformio |
There was a problem hiding this comment.
Reproducibility gap: the stated goal is a reproducible bootstrap, and WLED/requirements.txt pins platformio==6.1.16 (plus its transitive deps). Installing bare platformio here fetches whatever latest version PyPI serves, which can drift from the version the envs were tested against. Prefer installing the pinned requirements so a cold clone gets the known-good toolchain.
| "$VENV/bin/python" -m pip install --quiet platformio | |
| "$VENV/bin/python" -m pip install --quiet -r "$REPO_ROOT/WLED/requirements.txt" |
| url = https://github.com/aphelps/WLED.git | ||
| [submodule "ArduinoLibs"] | ||
| path = ArduinoLibs | ||
| url = https://github.com/aphelps/ArduinoLibs |
There was a problem hiding this comment.
Minor consistency nit: the WLED entry uses a .git suffix (.../WLED.git) but this ArduinoLibs URL omits it. Both work with git, so this is cosmetic — worth matching for consistency.
| # The default upload_port lives in platformio.ini; override it per-machine in | ||
| # WLED/platformio_override.ini (see platformio_override.sample.ini). | ||
|
|
||
| Custom envs: ampworks (VSPI) and apa102_mpr121 (HSPI + MPR121; available once its PR lands). |
There was a problem hiding this comment.
This banner presents apa102_mpr121 as a usable custom env, and --no-verify/--env=apa102_mpr121 in the usage block imply it too, but that env is not defined in the committed WLED/platformio.ini (only [env:ampworks] exists among the custom envs). The available once its PR lands hedge is easy to miss. Suggested test: after the intended submodule bump, run pio run -e apa102_mpr121 and assert it resolves the vendored ${PROJECT_DIR}/../ArduinoLibs MPR121/Debug with no /Users/ path in the build log; until then, gate every apa102_mpr121 reference behind the env actually existing.
Address self-review findings: - Install the pinned toolchain from WLED/requirements.txt (platformio==6.1.16) instead of bare `pip install platformio`, for a reproducible build. - --help example uses a real env (esp32dev), not apa102_mpr121 (not on main yet). - .gitmodules: add the .git suffix to the ArduinoLibs URL for consistency. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Re-review of the fixup commit (53d4fbf..736a44d). All three targeted fixes are correct and introduce no regressions:
- Pinned PlatformIO (addressed): setup.sh now installs
-r $REPO_ROOT/WLED/requirements.txt, which pinsplatformio==6.1.16(plus its full pip-compile'd dependency lock), replacing the unpinnedpip install platformio. This closes the reproducibility gap from the prior review.REPO_ROOTis defined at the top of the script (line 17), so the path resolves; no ordering issue. - --help example env (addressed): the usage text example changed from
--env=apa102_mpr121(a non-existent env) to--env=esp32dev, which is a real committed env — a./setup.sh --env=esp32devcopy/paste now succeeds. - ArduinoLibs .gitmodules URL (addressed):
.gitsuffix added, matching the WLED submodule entry's convention. Cosmetic (GitHub resolves both forms); verified the suffixed URL still resolves to the pinned commit 43efab6.
Still open from the prior review (not in scope for this fixup, no code change here): (1) the apa102_mpr121 env is still not present in the committed WLED platformio.ini while setup.sh's banner/next-steps still reference it — the --help example was corrected but the banner reference remains; (2) the cross-repo gitlink/merge-ordering caveat (bump the parent pointer to the commit that lands on WLED main after PR#5 merges). Recommend landing/gating the apa102_mpr121 references before this merges.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Re-review of the submodule bump + doc fix (736a44d..7ecccb7). The change is correct and low-risk:
- Drop
ampworksfromdefault_envs(correct): the WLED submodule now setsdefault_envs = esp32dev(wasesp32dev, ampworks). Sincedefault_envsdrives both the barepio rundefault and the fork's CI matrix, and theampworksenv depends on ArduinoLibs vendored in the parent WLED_dev repo (${PROJECT_DIR}/../ArduinoLibs) which doesn't exist in a standalone WLED checkout, this stops the fork's CI from attempting an env it can't build. Verified the[env:ampworks]block itself is fully intact and still buildable explicitly viapio run -e ampworksfrom the super-repo (setup.sh and the upload commands already invoke it that way) — only the default/CI-matrix listing was removed. No regression to the super-repo build path. - Reinforced by the paired submodule commit (7d4da9e): the
ampworksenv now uses explicit${PROJECT_DIR}/../ArduinoLibs/MPR121|Debugpaths (no bare names), so an ArduinoLibs-less checkout fails hard rather than silently pulling a registry MPR121. This is exactly why it must not be in the fork's CI matrix — the two commits are consistent. - CLAUDE.md doc line (addressed/consistent): the build comment now reads
default env is esp32dev (ampworks is super-repo-only; build it explicitly), matching the new default_envs and the drop rationale.
Still open from prior reviews (unchanged, no code here): the apa102_mpr121 env is still absent from the committed platformio.ini while setup.sh's banner/next-steps reference it; and the cross-repo gitlink/merge-ordering caveat (land the parent pointer on the commit that reaches WLED main after PR#5). Recommend resolving the apa102_mpr121 reference before merge.
WLED#5 squash-merged to main (4eb8fed). Point the submodule at main so the parent's gitlink no longer references the deleted PR branch. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…irst real guard (#27) ArduinoLibs bc56ddc (#12) -- getFramingErrorCount() plus the 57/58 boundary group that demonstrates the ceiling instead of asserting arithmetic about it. WLED 2e7634b3 (#16) -- RS485B_TX_SLOT_LEN derived from the receive budget minus the socket header, so a full payload can no longer exceed what a receiver can hold. This bump also carries ArduinoLibs #11 (the test-command doc fix), which was held back at the time to avoid deepening a gitlink conflict in the mesh PRs. That conflict is resolved and merged, so it rides along here. The substantive part is the probe change. RS485_RECV_BUFFER lives in ArduinoLibs and RS485B_RECV_BUFFER_LEN mirrors it in the usermod, because rs485_bridge_protocol.h has to stay free of Arduino.h for the host test to build. The static_assert tying them together compiles only under [env:ampworks], and no CI workflow builds that env -- so until now the mirror had NO automated guard at all. Drift it and the transmit ceiling silently stops matching what a receiver can hold, which is the 71-vs-64 bug this whole task exists to remove. tools/rs485_bridge_probe.py --self-test now scrapes both constants and fails if they disagree, and separately fails if RS485B_TX_SLOT_LEN stops being derived -- because re-hardcoding it is exactly how the original defect happened. I said in the WLED PR that the probe already did this; it did not, and this is the commit where that becomes true. Verified, including both negative controls: drifting the mirror to 96 is caught, and replacing the derived slot with a literal 57 -- the right VALUE, still the wrong shape -- is caught too. make test green across all suites, ampworks builds with libdeps cleared. Claude-Session: https://claude.ai/code/session_013HqzdRdTRnreSvevaQGQSJ Co-authored-by: aphelps-claude-bot <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ArduinoLibs 002f6d7 -> ff2a367 (RFM95Socket, #16) HMTL c65f1a3 -> 0a5d7cd (esp32_lora_gw DISABLE_LORA plumbing, #15) WLED 8ea0be8 -> eb14ddb (rs485_bridge framing-count caveat, #21) The ArduinoLibs pointer deliberately lands on the commit that carries BOTH the library and its test wiring, not just the library. The top-level Makefile records why this matters: main once briefly pinned esp-now-router at its README-only commit and the router suites vanished from `make test` with no signal at all. Verified on this exact tree rather than assumed: make test STRICT=1 green, and the ArduinoLibs section now names rfm95_socket_test and rfm95_socket_test_quiet (79 checks each) plus the rfm95-layout sweep under both the host ABI and -fpack-struct=1. pio run -e ampworks SUCCESS, after rm -rf .pio/libdeps/ampworks so the path-based deps were re-copied rather than read from a stale cache. This is the firmware that ships, so it is confirmed rather than reasoned about -- platformio.ini names each ArduinoLibs dependency explicitly and does not glob, so RFM95Socket is not pulled in here. Co-authored-by: aphelps-claude-bot <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Make a fresh clone build WLED with all AMPWorks usermods via one command — no
machine-specific paths.
What changed
setup.sh(repo root): checks prerequisites (git, python3/pip, Node.js/npm), initssubmodules, builds the web UI once (generates the gitignored
wled00/html_*.h), installsPlatformIO into an isolated
.venv, and runs a verify build.--no-verify/--env=<e>flags.ArduinoLibsas a submodule of this repo (MPR121 + Debug), so the build nolonger depends on a personal absolute path.
WLED/platformio.inireferences it via${PROJECT_DIR}/../ArduinoLibs(see the WLED PR below).WLEDsubmodule URL to HTTPS so a keyless clone cangit submodule update --init.WLEDsubmodule pointer to the portable-path fix;.gitignorethe.venv;document the clone →
setup.sh→ build flow inCLAUDE.md.Submodule PRs
WLED: make ampworks env build from a fresh clone (portable ArduinoLibs path) WLED#5 (portable ArduinoLibs path + my_config.h)Test plan
bash -n setup.sh— passes./tmp/wled-fresh,./setup.sh→ampworksbuild SUCCESS,
firmware.binproduced; the vendored/tmp/wled-fresh/ArduinoLibsisused and no
/Users/…path appears in the build;html_ui.hgenerated;my_config.hauto-created.pio run -e esp32devstill builds;grep /Users/ WLED/platformio.iniis clean.shellcheck setup.sh— shellcheck not installed locally; skipped (bash -n passes).Manual (Testing Required before merge)
setup.shon a second machine / clean account (no~/.platformio, no SSH keys) toconfirm a truly cold clone → build works.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]