Repository navigation
fix(esp8266): honor forced software pins in native FastPin specializations - #5258
Conversation
…tions Under FASTLED_FORCE_SOFTWARE_PINS the ESP8266 _FL_DEFPIN specializations still selected the register-level _ESPPIN, so the forced core-API provider was never used. Mirror the ESP32 fix (#5241): select FL_FASTPIN_HAS_NO_PINMAP on ESP8266, derive _ESPPIN from NoPinMapPin (keeping kRealPin for the RAW/D1/NodeMCU mapping), keep unspecified pins invalid, gate the register-level BitbangPin policy and HAS_HARDWARE_PIN_SUPPORT, and reject the block clockless driver with a clear static assert. Default (non-forced) builds are unchanged. Fixes #5068
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Memory usage (this PR vs. its merge base)Change in
|
Fixes #5068.
Problem
FASTLED_FORCE_SOFTWARE_PINSselects the primaryFastPinprovider infl/system/fastpin_base.h, but every ESP8266_FL_DEFPIN(RAW, D1 and NodeMCU orders) explicitly specializesFastPin<N>to the register-level_ESPPIN. Those specializations override the primary template, so forced software pins were never used on ESP8266.Fix (mirrors the ESP32 fix in #5241)
fastpin_base.h: forced pins onFL_IS_ESP8266selectFL_FASTPIN_HAS_NO_PINMAP. As on ESP32, pins with no specialization stay invalid (validpin() == false, static assert on use).fastpin_esp8266.h: whenFL_FASTPIN_HAS_NO_PINMAPis set,_ESPPIN<REAL_PIN, MASK>derives fromNoPinMapPin<REAL_PIN>. The RAW/D1/NodeMCU logical-to-GPIO mapping is kept andkRealPinis still provided, so the HSPI pair resolution keeps compiling. The register-levelBitbangPinpolicy andHAS_HARDWARE_PIN_SUPPORTare left out in forced mode.clockless_block_esp8266.h: the parallel block driver needssport()/cport(). In forced mode it now fails with a static assert that names the cause instead of a cryptic missing-member error (same pattern as d51/renesas).Production path
User sketch with
-DFASTLED_FORCE_SOFTWARE_PINS->FastLED.h->platforms/fastpin.hESP8266 branch ->fastpin_esp8266.h_FL_DEFPIN-> nowNoPinMapPin<GPIO>->fl::pinMode/fl::digitalWrite.GenericSoftwareSPIOutput(APA102 on non-HSPI pins) detects this throughisNoPinMapPinand uses per-pin writes.Evidence (real ESP8266 SDK builds: fbuild, xtensa-lx106 gcc 10.3, esp8266 Arduino 3.1.2)
A temporary probe (not committed) was appended to
fastpin_esp8266.h:FL_STATIC_ASSERT(isNoPinMapPin(FastPin<FL_PIN_CLOCKLESS_1>)), the same forFL_PIN_SPI_DATA_1, and!FastPin<17>::validpin().#errorifFL_FASTPIN_HAS_NO_PINMAPis defined orHAS_HARDWARE_PIN_SUPPORTis missing.FASTLED_NO_PINMAPFASTLED_FORCE_SOFTWARE_SPIAlso run:
bash lint(green);uv run pyteston allci/tests/test_*forced_software_pins.pyplustest_esp8266_default_pins.py(pass);bash test fastpin,fastpin_forced_no_pinmapandfastpin_no_pinmap(pass). The newci/tests/test_esp8266_forced_software_pins.pypins the selection guard and the block-driver rejection.Scope / not claimed
sendPixel) still writes GPIO registers directly. That is the timing-critical path, and the ESP32 RMT/forced behavior is the same.FASTLED_FORCE_SOFTWARE_SPI's job, same as ESP32).Summary by CodeRabbit