ripple effects: bugfix for 1D
ripple effects were showing random crashes in 1D mode. Root cause: negative and out-of-range index passed to getPixelColor(i, col).
This commit is contained in:
@@ -2422,12 +2422,14 @@ uint16_t ripple_base()
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int16_t left = rippleorigin - propI -1;
|
int left = rippleorigin - propI -1;
|
||||||
for (int16_t v = left; v < left +4; v++) {
|
for (int v = left; v < left +4; v++) {
|
||||||
uint8_t mag = scale8(cubicwave8((propF>>2)+(v-left)*64), amp);
|
uint8_t mag = scale8(cubicwave8((propF>>2)+(v-left)*64), amp);
|
||||||
SEGMENT.setPixelColor(v, color_blend(SEGMENT.getPixelColor(v), col, mag)); // TODO
|
if ((v >= 0) && (v < SEGLEN)) // WLEDMM bugfix: v and w can be negative or out-of-range
|
||||||
int16_t w = left + propI*2 + 3 -(v-left);
|
SEGMENT.setPixelColor(v, color_blend(SEGMENT.getPixelColor(v), col, mag)); // TODO
|
||||||
SEGMENT.setPixelColor(w, color_blend(SEGMENT.getPixelColor(w), col, mag)); // TODO
|
int w = left + propI*2 + 3 -(v-left);
|
||||||
|
if ((v >= 0) && (v < SEGLEN)) // WLEDMM bugfix: v and w can be negative or out-of-range
|
||||||
|
SEGMENT.setPixelColor(w, color_blend(SEGMENT.getPixelColor(w), col, mag)); // TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ripplestate += rippledecay;
|
ripplestate += rippledecay;
|
||||||
|
|||||||
Reference in New Issue
Block a user