Skip to content

add example demonstrating advanced PlatformIO environment inheritance #4618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions platformio_override.sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,49 @@ extends = env:esp32dev
build_flags = ${env:esp32dev.build_flags} -D USERMOD_RF433
lib_deps = ${env:esp32dev.lib_deps}
sui77/rc-switch @ 2.6.4

# ------------------------------------------------------------------------------
# Advanced example: Inheriting all settings from an upstream WLED "release" config,
# and adding/overriding specific build flags, which is useful if you want to base
# your environment on a stable WLED release env but easily override some of its
# defaults, such as the output pin numbers, the default ethernet board ID, etc.
#
# WARNING: The WLED project does NOT guarantee that your chosen "upstream" config
# will exist or be maintained in the future. Environments can sometimes change
# radically. The compiler will warn you if the upstream configuration doesn't
# exist anymore, but it won't warn you if it's no longer maintained or has added
# new flags that may impact your use-case. It is YOUR responsibility to periodically
# check the status and any new defaults for your chosen upstream configuration.
# However, it's *generally* safe to pick a well-known, popular release configuration
# and tweak a few commonly used defaults such as its pin numbers and modes!
# ------------------------------------------------------------------------------

[env:esp32_eth_custom]
;; Inherit all settings from upstream config. We can then override specific settings.
;; WARNING: The upstream environment's name, such as "esp32_eth" in this example,
;; must also be specified in the other inherited settings (see example below).
extends = env:esp32_eth

;; Remove conflicting upstream flags to fix compiler "variable redefined" warnings.
;; WARNING: Must specify the EXACT upstream "build_flags" flag VALUES to unset.
;; If no value is specified, then ALL values for that flag will be removed, which
;; also deletes any new values you're trying to set. Also be aware that the
;; compiler deletes ALL instances of the EXACT VALUES you specify below.
;; NOTE: If the upstream values are ever changed, the compiler will encounter
;; duplicate values and complain about "variable redefined" again, meaning that
;; these values will simply need to be revised. So maintenance is safe and easy.
build_unflags = ${env:esp32_eth.build_unflags}
;; Unset the old, conflicting flag values:
-D WLED_RELEASE_NAME=\"ESP32_Ethernet\"
-D RLYPIN=-1

;; Inherit all upstream flags and then overwrite/append with some custom values.
;; NOTE: You can add/modify ANY of the WLED build-time variables here (it doesn't
;; have to be values that were in the original upstream config).
build_flags = ${env:esp32_eth.build_flags}
;; Set/add your new flag values:
-D WLED_RELEASE_NAME=\"ESP32_Ethernet_Custom\"
-D RLYPIN=15 ;; Relay pin.
-D WLED_ETH_DEFAULT=4 ;; "QuinLed-ESP32-Ethernet"
-D DATA_PINS=16,3,1,4 ;; LED output channels.