From 59d5ff02c551d82abeccae6b61f68468ad10395a Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:18:43 +0100 Subject: [PATCH] Flat GEQ improvement for shorter stips only center bars if we more than 4 pixels per bar. --- wled00/FX.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 838f763c..694239d7 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -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);