Skip to content

Possible bug with "Palette wrapping" setting? #5295

@JoaDick

Description

@JoaDick

What happened?

While reviewing some WLED code, I came across this macro in FX.cpp - which is heavily used:
#define PALETTE_SOLID_WRAP (strip.paletteBlend_X == 1 || strip.paletteBlend_X == 3)
Apparently it references WS2812FX::paletteBlend. And it seems as if this variable represents the "Palette wrapping" setting from the UI - but does it really?

There's also a global variable WLED_GLOBAL uint8_t paletteBlend _INIT(0); in wled.h - which (to my understanding) is actually updated by the UI. Shouldn't that one be used by the macro (and also by PALETTE_MOVING_WRAP)?

I renamed WS2812FX::paletteBlend (+ its usage in the macros) and made it const, expecting the compiler to fail. But the build was successful! That's a clear proof that this variable is never getting updated with the setting from the UI.

Or am I missing something?

To Reproduce Bug

n/a (code review)

Expected Behavior

see problem description

Install Method

Self-Compiled

What version of WLED?

current main

Which microcontroller/board are you seeing the problem on?

ESP32-C3

Relevant log/trace output

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions