Skip to content

Commit 4abaf13

Browse files
committed
Fix Segment::fade_out for 2d expansion
Since we're using get/setPixelColorRaw, we need the true length, not the virtual length.
1 parent 8b65d87 commit 4abaf13

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wled00/FX_fcn.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@ void Segment::fade_out(uint8_t rate) const {
989989
if (!isActive()) return; // not active
990990
rate = (256-rate) >> 1;
991991
const int mappedRate = 256 / (rate + 1);
992-
for (unsigned j = 0; j < vLength(); j++) {
992+
const size_t length = is2D() ? (vWidth() * vHeight()) : vLength();
993+
for (unsigned j = 0; j < length; j++) {
993994
uint32_t color = getPixelColorRaw(j);
994995
if (color == colors[1]) continue; // already at target color
995996
for (int i = 0; i < 32; i += 8) {

0 commit comments

Comments
 (0)