Skip to content

ghost pixels with "Use global LED buffer" #58

@softhack007

Description

@softhack007

What happened?

The "Use global LED buffer" (LED preferences) option can add ghost pixels which are not there without global buffer.

To Reproduce Bug

It seems that "ingredients" are

  • using global leds buffer, plus
  • some segments have width different from the overall 2D layout, plus
  • a smaller segment overlaps with the bigger one, plus
  • a) the bigger segment does something that reads buffered leds -> blur, fade-out, move, ...
  • b) or the smaller segment is an overlay

Example:

  • global leds size 24x37
  • segment 0: black hole effect
  • segment 1: android effect
  • segment 2: size 12x8 (scrolling text overlay "45")
  • the white pixels to the right of "45" should not be there. They are "ghosts" from segment 2.

GlobalLEDs_epic_fail

First Analysis

  • when drawing a pixel into segment[2], two things happen in setpixelcolorXY
    1. if (ledsrgb) ledsrgb[XY(x,y)] = col; // buffer assigned to segment
    1. strip.setPixelColorXY(start + xX, startY + yY, col); // write-thru to NPB driver

the "ghost pixels" are from the write to ledsrgb, which assumes wrong buffer coordinates; XY() is computed using segment boundaries only. As Segment#0 later uses "blur()", the global ledsrgb buffer pixels are used and ghost pixels appear next to the white text.

Conclusion

It seems we need a different XY() function for global buffer, as it must consider the "global" width instead of segment width. I think this new global_XY() needs to also use rotation and mirroring of a segment in the calculation.

Expected Behavior

Effects look (almost) the same, independent from using global buffer or not.

Install Method

Self-Compiled or other

What version/release of MM WLED?

any 0.14.0 build

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

No response

Anything else?

This problem exists since "global buffer" was introduced in upstream WLED 0.14.
We can either

  • wait until 0.14.0-beta4 is available (where global buffer will be removed)
  • find our own solution for MM (in case we want to keep global double-buffering)

To avoid wrong pixels, I would suggest to not use global buffer unless all segments have the same width as your overall layout. Without global buffer, there are no wrong pixels.

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions