Skip to content

Arduino Nano ESP32 (BOARD_HAS_PIN_REMAP) fails to compile: io_pin_remap.h macros mangle fl/system/pin.h declarations #4914

Closed

Description

@zackees

Building any sketch for `board = arduino_nano_esp32` (Arduino-ESP32 3.3.11, pioarduino 55.03.311) fails in `src/fl/build/fl.system.analog+.cpp`:

```
cores/esp32/io_pin_remap.h:47:49: error: variable or field 'pinMode' declared void
47 | #define pinMode(pin, mode) pinMode(digitalPinToGPIONumber(pin), mode)
src/fl/system/pin.h:75:6: note: in expansion of macro 'pinMode'
75 | void pinMode(int pin, PinMode mode) FL_NO_EXCEPT;
```
Same for `digitalWrite`, `analogRead`, `analogWrite` (pin.h:80, :95, ...).

Cause: `fl/system/arduino.h` includes `Arduino.h`, which on remap boards includes `io_pin_remap.h`; its function-like macros then rewrite FastLED's own `fl::pinMode(...)` declarations. Fix direction: declare them as `void (pinMode)(int pin, ...)` (parenthesised names suppress function-like macro expansion), or include pin.h before Arduino.h / `#undef` locally in the TU.

Found while testing #4913 (unrelated to it; reproduces with the gate off).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions