Skip to content

Commit

Permalink
Flat GEQ improvement for shorter stips
Browse files Browse the repository at this point in the history
only center bars if we more than 4 pixels per bar.
  • Loading branch information
softhack007 committed Nov 27, 2024
1 parent 8ff0223 commit 59d5ff0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8110,10 +8110,11 @@ static void setFlatPixelXY(bool flatMode, int x, int y, uint32_t color, unsigned

if (!flatMode) SEGMENT.setPixelColorXY(x, y, color); // normal 2D
else {
y = rows - y -1 ; // reverse y
if (y & 0x01) y = (rows + y) / 2; // center bars: odd pixels to the right
else y = (rows - 1 - y) / 2; // even pixels to the left

y = rows - y - 1; // reverse y
if (rows > 4) { // center y if we have more than 4 pixels per bar
if (y & 0x01) y = (rows + y) / 2; // center bars: odd pixels to the right
else y = (rows - 1 - y) / 2; // even pixels to the left
}
int pix = x*rows + y + offset; // flatten -> transpose x y so that bars stay bars
if (unsigned(pix) >= SEGLEN) return; // skip invisible
SEGMENT.setPixelColor(pix, color);
Expand Down

0 comments on commit 59d5ff0

Please sign in to comment.