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) {