You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guiding principle (do it this way, not with a #define)
Do not gate a driver behind a #define that turns its code on. Select drivers
by template and let the linker drop the ones nothing references. A driver's
translation unit stays alive only when something names it — this repo already has
the mechanism: BusTraits<Bus::X>::instance() / BusSupports<Bus::X, Chipset>
(see src/fl/channels/bus_traits.h, "Naming BusTraits<Bus::X>::instance()
anywhere in the program is what causes the linker to keep the driver's
translation unit. If no template instantiation references it, the driver TU is
dead-stripped. See #2428.").
So on a given target the unused drivers are eliminated automatically — which is
most of them — without a compile-time enable flag, and the whole program is still
type-checked. Opt-in defines (FASTLED_ESP8266_UART, FL_ESP8266_EMBEDDED_FS, FASTLED_ALL_PINS_HARDWARE_SPI, ...) move this decision to the build system and
prevent the driver from being link-eliminated or compile-verified.
Scope on ESP8266
Audit every define that gates driver code on FL_IS_ESP8266 and convert it to a
template-selected driver whose TU link-eliminates when unreferenced. Known today:
Define
Gates
Where
FASTLED_ESP8266_UART
UART1 WS2812 driver
src/platforms/esp/8266/fastled_esp8266.h
FL_ESP8266_EMBEDDED_FS
LittleFS embedded FS
src/platforms/embedded_fs.h:28
FASTLED_ALL_PINS_HARDWARE_SPI
legacy Arduino-SPI shim
src/platforms/esp/8266/spi_output_template.h:33
(Pin-order selects — FASTLED_ESP8266_RAW/D1/NODEMCU_PIN_ORDER — are board wiring configuration, not driver enables; leave those.)
Deliverable
Convert each row above to a template/BusTraits-selected driver.
Document the rule in agents/docs/cpp-standards.md ("Driver selection is by
template, never a code-enabling define").
Add a lint check that flags a new driver-enabling #define under src/platforms/**.
Prove elimination: a build with no reference to a given engine must not link
its symbols (flash/RAM size diff, per bash bloat).
Activity
Merge pull request #4955 from FastLED/feat/4940-driver-enable-define-…
feat(lint): flag a new driver-enabling define; document the template …