Repository navigation
led_driver board profile + seed the boot effect from DEFAULT_MODE - #20
Conversation
…d per board family New env for the SparkFun LoRa 1-CH Gateway LED drivers: WS2801 on 25/23 (50 px, rainbow at boot, ABL off) and the RS485 bridge enabled on rx 5 / tx 19 / en 18 at 28000 baud, via new build-flag overrides for the usermod's compile defaults (stock values unchanged). FX.h and const.h default macros gain ifndef guards so DATA_PINS/LED_TYPES-style env profiles can actually override them; serial esptool upload since these boards are bench-flashed. Per-device address and WiFi credentials stay in the gitignored platformio_override.ini. Hardware-validated end-to-end: UDP probe -> bridge(96) -> RS485 -> legacy module 72 poll response relayed back; VALUE pulses handled; zero framing errors. Co-Authored-By: Claude Fable 5 <[email protected]>
…ly takes Segments are constructed with DEFAULT_MODE, but colorUpdated(CALL_MODE_INIT) at boot overwrites every segment's mode with the effectCurrent global, which was hard-initialized to 0 — so a -D DEFAULT_MODE override changed nothing on first boot. Initializing the global from the same macro keeps stock builds identical (DEFAULT_MODE defaults to 0) and makes the flag truthful. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Cross-repo consequence found while testing something else: this PR will break
Reproduced by checking the WLED submodule out onto this branch and running Not a defect in this PR — the README is simply counting, and this PR legitimately adds one. But it needs a paired WLED_dev commit bumping the stated count to 38, landing with or immediately after this merge, or the super-repo test goes red. |
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Self-review of my own PR. Three things verified, one real risk, one thing I could not test.
Verified rather than assumed
- Stock builds are genuinely unaffected.
esp32devbuilt from this branch vsmain: identical
size (1,304,416 B) and byte-identical except 64 bytes — which are exactlyapp_elf_sha256
(offsets 177–208) and the trailing image SHA-256 (1304385–1304416). Both must differ because the
ELF comes from a different source tree. All 1.3 MB of code and data is identical. "Same size"
would have been weak evidence; this is conclusive. - The
#ifndefguards aroundDEFAULT_*are inert for every existing env. Wrapping them changes
which definition wins when a build flag already defines one — previously FX.h's unconditional
#definewon (with a redefinition warning), now the flag wins. I checked: zero envs in
platformio.inicurrently pass-D DEFAULT_BRIGHTNESS|MODE|SPEED|INTENSITY|COLOR|LED_TYPE|LED_COUNT,
so nothing changes behaviour today. Worth knowing the semantics shifted, for anyone adding one later. - CI is green across the full build matrix.
The part that needs a human: this touches wled00/ core
effectCurrent _INIT(DEFAULT_MODE) changes a core global, not just fork usermod code. The root cause
is real — segments are built with DEFAULT_MODE, then boot-time colorUpdated(CALL_MODE_INIT)
overwrites every segment from effectCurrent, hard-initialised to 0 (wled00/led.cpp:33,
wled00/wled.h:749), so the env-profile flag was silently doing nothing.
The judgement I cannot make by building: is there a build that sets DEFAULT_MODE and relies on the
boot effect staying 0? The macro defaults to 0 so stock is unaffected (proven above), but that is an
argument about defaults, not about intent.
Not verified — needs hardware
The actual claim of this PR is untested: erase-flash a board with led_driver, boot with no stored
config, confirm the segment comes up on DEFAULT_MODE rather than effect 0. Everything above shows the
change is inert where it should be; none of it shows the change works. Also unverified: that the
preset path still overrides the default on a device with presets stored.
Merge-time dependency
This adds an env, taking the count 37 → 38, which breaks make test-readme in WLED_dev. Needs a paired
super-repo commit bumping the stated count — details in the earlier comment on this PR.
upload_port named /dev/cu.usbserial-2110, a device path specific to one machine at one moment. /dev/cu.usbserial-* names are not stable: three boards replugged on the same machine had usbserial-0001 and usbserial-6 swap while usbserial-5 stayed put. So the committed value is wrong for everyone -- but if any device happens to occupy that path, `pio run -e led_driver -t upload` flashes it without complaint. Silently flashing the wrong board is worse than failing. The override cannot simply be dropped: env:ampworks sets upload_port to an IP for its custom OTA path, and esptool cannot open an IP as a serial port. So it must be set to something -- and a path that cannot exist fails immediately and names the fix, rather than hitting an unrelated board. Builds unchanged (led_driver SUCCESS).
|
Addressed in I did not apply my own suggestion verbatim. I had proposed upload_port = /dev/cu.SET-UPLOAD-PORT # pass --upload-port /dev/cu.usbserial-<n>That fails immediately and names the fix. The comment above it records why the override cannot simply be deleted —
|
aphelps-claude-bot
left a comment
There was a problem hiding this comment.
Re-review of aa23343a (the upload_port fix), verified by running it rather than reading it.
The fix does what it claims. pio run -e led_driver -t upload with no --upload-port:
A fatal error occurred: Could not open /dev/cu.SET-UPLOAD-PORT, the port is busy or doesn't exist.
([Errno 2] No such file or directory: '/dev/cu.SET-UPLOAD-PORT')
The port path is the instruction, so the error names its own fix. That is the property that was
missing before: the old value could silently succeed against an unrelated board.
Correction to my own commit message. It says the bogus path "fails immediately". It does not —
PlatformIO builds first and fails at the upload step, about 30 s in. The failure is loud and
correct, but not immediate, and the distinction matters to anyone who reads that message and expects
a fast fail. The behaviour is PlatformIO's ordering, not something this change controls.
led_driver still builds. Nothing else in the diff changed since the previous review, and the two
items left for a human are unchanged:
- the
wled00/core touch — whether any build setsDEFAULT_MODEand relies on the boot effect
staying 0 is a question about intent, not defaults; - the PR's central claim — first boot on a factory-fresh board landing on
DEFAULT_MODE— is still
unverified on hardware.
aphelps
left a comment
There was a problem hiding this comment.
Good other than a minor nit to correct. Please test with the currently attached devices and then merge if good
|
Hardware-verified on two ESP32s — the Method. Both boards
Why the mutation matters: board A alone showing Remaining unverified: the preset-override path (that a device with presets stored still overrides the default). That needs a board with presets, which these erased ones by definition are not. |
|
Second On board A (with the fix), saved preset 1 with So a configured device still boots into its preset, while a factory-fresh one now honours Both Testing Required items are now done:
Nothing on this PR is unverified any more. |
Review: "led_driver" says nothing about which hardware it targets, and the pin map in it is specific to one board. Renamed to led_driver_lora1ch, after SparkFun's "ESP32 LoRa 1-CH Gateway" product name. Adam suggested "led_driver_with_lora or something"; this differs deliberately because nothing in the profile uses the LoRa radio -- "with_lora" would name a capability the build does not have, where the intent was to name the board. It also matches the led_driver_<variant> pattern already used on other branches. One line to change if the literal wording is preferred. The comment above the env now says outright that the env is named for the board rather than a feature, and that the WS2801 25/23 and RS485 5/19/18 pins are specific to it, so nobody goes looking for the LoRa code. Single occurrence in the repo, so the rename is complete. Builds clean.
Two commits that were built and hardware-verified on a branch that no task tracked, so they were
invisible to review. Opening them properly.
led_driverboard profileBakes WS2801 + RS485-bridge defaults per board family, so a board type carries its own pin/enable
defaults instead of every install re-deriving them. Runtime config still wins once saved.
Seeding the boot effect from
DEFAULT_MODE— the part worth reviewingThis one fixes a real bug, and it touches
wled00/core rather than just the fork's usermod.Segments are constructed with
DEFAULT_MODE, but boot-timecolorUpdated(CALL_MODE_INIT)overwritesevery segment's mode from the
effectCurrentglobal, which is hard-initialised to0(
wled00/led.cpp:33,wled00/wled.h:749). So settingDEFAULT_MODEin an env profile was silentlydoing nothing — the flag existed and had no effect.
The fix seeds
effectCurrentfrom the same macro, so the flag becomes truthful.The review question: does seeding
effectCurrentfromDEFAULT_MODEhave side effects for buildsthat set
DEFAULT_MODEwithout expecting the boot effect to change? The macro defaults to0, so astock build should be unaffected — see the evidence below.
Evidence that stock builds are unaffected
esp32devbuilt from this branch vs frommain, same toolchain, same working tree:Identical size: 1,304,416 bytes both.
Byte-identical except 64 bytes, and those 64 are exactly two self-referential hashes:
app_elf_sha256inesp_app_desc_tBoth necessarily differ because the ELF is built from a different source tree. All 1.3 MB of
code and data is identical.
Test plan
pio run -e led_driverbuildspio run -e esp32devbuildsesp32devbyte-compared before/after — differs only in the two embedded hashesNot yet verified (needs hardware)
led_driver, boot with no stored config,confirm the segment comes up on the configured
DEFAULT_MODErather than effect 0. This isthe actual claim and the one thing not yet demonstrated on hardware.
Rebased onto current
main(cfe86c58); theusermods/rs485_bridge/hunk was re-verified afterthat merge, since PR #19 touched the same file.