Skip to content

Commit 59d5ff0

Browse files
committed
Flat GEQ improvement for shorter stips
only center bars if we more than 4 pixels per bar.
1 parent 8ff0223 commit 59d5ff0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

wled00/FX.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8110,10 +8110,11 @@ static void setFlatPixelXY(bool flatMode, int x, int y, uint32_t color, unsigned
81108110

81118111
if (!flatMode) SEGMENT.setPixelColorXY(x, y, color); // normal 2D
81128112
else {
8113-
y = rows - y -1 ; // reverse y
8114-
if (y & 0x01) y = (rows + y) / 2; // center bars: odd pixels to the right
8115-
else y = (rows - 1 - y) / 2; // even pixels to the left
8116-
8113+
y = rows - y - 1; // reverse y
8114+
if (rows > 4) { // center y if we have more than 4 pixels per bar
8115+
if (y & 0x01) y = (rows + y) / 2; // center bars: odd pixels to the right
8116+
else y = (rows - 1 - y) / 2; // even pixels to the left
8117+
}
81178118
int pix = x*rows + y + offset; // flatten -> transpose x y so that bars stay bars
81188119
if (unsigned(pix) >= SEGLEN) return; // skip invisible
81198120
SEGMENT.setPixelColor(pix, color);

0 commit comments

Comments
 (0)