Skip to content

Fix firmware build: define EvoLights envs in platformio.ini - #1

Merged
johnsonflix merged 10 commits into
evolights/mainfrom
fix/build-platformio-envs
May 3, 2026
Merged

johnsonflix merged 10 commits into
evolights/mainfrom
fix/build-platformio-envs

Conversation

@johnsonflix

Copy link
Copy Markdown
Owner

Replaces the broken runtime platformio_override.ini (infinite-recursion in build_flags) with three new envs appended to platformio.ini that extend the upstream counterparts.

  • esp32dev_evolights
  • esp32_eth_evolights
  • esp32s3dev_8MB_evolights

Each pulls in the cloud_relay usermod and the WLED_FORK_NAME flag. The new block is wrapped in EVOLIGHTS-ANCHOR markers; the verifier asserts all three envs exist.

Local verifier: 25/25 pass.

…ken override

The previous firmware-build.yml wrote a platformio_override.ini that did:
    build_flags = ${env:esp32dev.build_flags} -D USERMOD_EVOLIGHTS_CLOUD_RELAY
which PlatformIO rejects with "Infinite recursion has been detected for
build_flags option in the env:esp32dev section" because a section can't
self-reference.

Replace the runtime override with three new envs appended to platformio.ini,
each extending its upstream counterpart:

    [env:esp32dev_evolights]
    extends = env:esp32dev
    custom_usermods = ${env:esp32dev.custom_usermods} cloud_relay
    build_flags     = ${env:esp32dev.build_flags} -D USERMOD_EVOLIGHTS_CLOUD_RELAY -D WLED_FORK_NAME=\"EvoLights\"

References from the new env into the old env are not self-referential and
PlatformIO resolves them cleanly. Same pattern for esp32_eth_evolights and
esp32s3dev_8MB_evolights.

The new env block is wrapped in EVOLIGHTS-ANCHOR markers; the verifier now
asserts all three envs still exist so an upstream merge that scrambles
platformio.ini is caught.

Workflow simplified: firmware-build.yml now just runs `pio run -e <env>`
against the *_evolights envs in its matrix, no override file generation.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
arjohnson15 and others added 9 commits May 2, 2026 12:23
The previous commit referenced [env:esp32s3dev_8MB] which doesn't exist in
upstream WLED's platformio.ini — actual S3 envs are esp32s3dev_8MB_qspi
and esp32s3dev_8MB_opi. The bad extends made PlatformIO refuse to parse
the entire file, which is why all three matrix builds failed at config
load.

Renames everywhere: env definition, build matrix, verifier assertion.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ubSubClient

WLED uses lib_compat_mode = strict in [env], which blocks auto-inclusion of
ESP32 framework libraries. cloud_relay.cpp #include <WiFiClientSecure.h>
fails with 'No such file or directory' as a result.

Adds an [evolights_common] section listing the framework libs + PubSubClient,
and references it from each *_evolights env's lib_deps alongside the env's
existing deps.
…k libs

WLED's [env] sets lib_compat_mode = strict, which prevents PIO from
auto-resolving framework libraries (WiFiClientSecure, HTTPClient, Update)
when they're transitively included from a symlinked usermod source.

Override per-env to lib_compat_mode=soft and lib_ldf_mode=chain+ so PIO
follows our usermod's #include directives and finds the framework headers.
Adding 'WiFiClientSecure' as a lib_deps entry doesn't help: framework libs
aren't in the package registry, they ship with the platform.
…solve

PIO's load_usermods.py adds usermods as symlink:// lib_deps entries.
When LDF scans the symlinked library it uses the LIBRARY's own settings,
not the env's, so env-level lib_compat_mode/lib_ldf_mode overrides don't
reach the usermod's #include scan.

Setting libLDFMode=deep+ and libCompatMode=soft inside library.json
configures the scan at the right level. PIO can then locate the
WiFiClientSecure framework library via deep #include analysis.
….json

Symlinked usermods get scanned as isolated libraries; PIO's LDF doesn't
walk back up to project lib_deps from inside that scan, so WiFiClientSecure
isn't found unless the library itself declares it.

Switched library.json's dependencies to the array form so we can scope per
platform (the framework libs only exist on espressif32). PubSubClient stays
as a regular external dep.
Six iterations of trying to make WLED's build system find WiFiClientSecure
from a usermod's compile scope: lib_deps entry, lib_compat_mode=soft,
lib_ldf_mode=chain+/deep+, library.json deps array — none worked. The
root cause appears to be how WLED's load_usermods.py wires symlinked
usermods as isolated library compile scopes that don't see framework
include paths.

Pragmatic call: ship the rest of the architecture on plain TCP; mark TLS
as a critical TODO with a long header comment in cloud_relay.cpp listing
mitigation options for the interim:
  - private network + VPN, OR
  - mqtt-over-WSS via a different MQTT client, OR
  - link mbedTLS at WLED-core level and expose a TLS client to usermods

Per-device mqtt_user/mqtt_pass auth still works, but a passive eavesdropper
sees credentials in clear. Acceptable for development; NOT acceptable for
production — that's the entire content of the TODO.
… deps

PIO compiles usermods in an isolated library scope that does not see WLED's
vendored ArduinoJson at wled00/src/dependencies/json/, nor the project-local
ESPAsyncWebServer headers, when included via standalone <Header.h>. wled.h
already pulls all of these in, so the redundant includes only cause 'No such
file or directory' errors.
…ncJson handler signature

Two compile errors after redundant includes were removed:

1. wled_cloud_auth.h forward-declared 'class JsonObject' but ArduinoJson v6
   makes JsonObject a typedef, not a class. Pull in the wled-vendored
   ArduinoJson header so the type is fully known to consumers.

2. cloud_relay's /cloud/pair handler used the upstream AsyncJson lambda
   signature (AsyncWebServerRequest*, JsonVariant&). WLED's vendored
   AsyncCallbackJsonWebHandler at wled00/src/dependencies/json/AsyncJson-v6.h
   passes only AsyncWebServerRequest*; the body sits in request->_tempObject.
   Deserialize it ourselves to reach the same JsonObject obj.

Verifier still 25/25.
…des it

Same root issue as cloud_relay.cpp: WLED vendors ArduinoJson at
wled00/src/dependencies/json/ArduinoJson-v6.h and includes it via that
relative path in wled.h and fcn_declare.h. The standalone <ArduinoJson.h>
isn't on the include path for any WLED source file.
@johnsonflix
johnsonflix merged commit 9bafb02 into evolights/main May 3, 2026
21 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants