From 4abaf13598b751a4e849cf129ff1084e191a9ccb Mon Sep 17 00:00:00 2001 From: Will Miles Date: Sat, 7 Jun 2025 11:08:11 -0400 Subject: [PATCH] Fix Segment::fade_out for 2d expansion Since we're using get/setPixelColorRaw, we need the true length, not the virtual length. --- wled00/FX_fcn.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 438c36d5a..34d668e3e 100755 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -989,7 +989,8 @@ void Segment::fade_out(uint8_t rate) const { if (!isActive()) return; // not active rate = (256-rate) >> 1; const int mappedRate = 256 / (rate + 1); - for (unsigned j = 0; j < vLength(); j++) { + const size_t length = is2D() ? (vWidth() * vHeight()) : vLength(); + for (unsigned j = 0; j < length; j++) { uint32_t color = getPixelColorRaw(j); if (color == colors[1]) continue; // already at target color for (int i = 0; i < 32; i += 8) {