Skip to content

separate led structures #27959

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 1 commit into
base: bugfix-2.1.x
Choose a base branch
from

Conversation

ellensp
Copy link
Contributor

@ellensp ellensp commented Jul 2, 2025

Description

Some combinations of LED strips broke compiling the code

In particular

  #define NEOPIXEL_TYPE          NEO_GRB
  #define NEOPIXEL2_TYPE          NEO_GRBW
  #define NEOPIXEL2_SEPARATE

Currently errors with

Marlin\src\feature\leds\leds.cpp:283:97: error: 'const LEDColor' {aka 'const struct LEDColor'} has no member named 'w'
  283 |                             : neo2.Color(incol.r, incol.g, incol.b OPTARG(HAS_WHITE_LED2, incol.w));

The cause is that both led strings use a common struct LEDColor
But LEDColor dynamically changes at compile time to include white support or not. It also only looked at NEOPIXEL_TYPE for a white led.

I separated the two led strings to use their own unique LEDColor that allows either to have a white led.

Requirements

#define NEOPIXEL_TYPE NEO_GRB
#define NEOPIXEL2_TYPE NEO_GRBW
#define NEOPIXEL2_SEPARATE

Benefits

Builds and works as expected

Configurations

Example config for a RAMPS with two LED strips

  #define NEOPIXEL_TYPE          NEO_GRB
  #define NEOPIXEL_PIN                4 // LED driving pin
  #define NEOPIXEL2_TYPE          NEO_GRBW
  #define NEOPIXEL2_PIN               5
  #define NEOPIXEL2_SEPARATE

Example Configuration.zip

Related Issues

  • [BUG] Cannot successfully build when using separate NEO_RGB and NEO_RGBW Neopixel LEDs #27810
  • @ellensp ellensp added this to the Version 2.1.3 milestone Jul 2, 2025
    @ellensp
    Copy link
    Contributor Author

    ellensp commented Jul 2, 2025

    Although I have tested this lots, there are so many LED options it is possible I missed or broke something.

    Check thoroughly

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    [BUG] Cannot successfully build when using separate NEO_RGB and NEO_RGBW Neopixel LEDs
    1 participant