Skip to content

Commit 6c427b7

Browse files
authored
Update user_fx.cpp
made CodeRabbit Changes to reflect what's going in the README.
1 parent ee7e2bb commit 6c427b7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

usermods/user_fx/user_fx.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static uint16_t mode_diffusionfire(void) {
2727
const uint8_t spark_rate = SEGMENT.intensity;
2828
const uint8_t turbulence = SEGMENT.custom2;
2929

30-
unsigned dataSize = cols * rows; // or: SEGLEN for virtual length
30+
unsigned dataSize = cols * rows; // SEGLEN (virtual length) is equivalent to vWidth()*vHeight() for 2D
3131
if (!SEGENV.allocateData(dataSize))
3232
return mode_static(); // allocation failed
3333

@@ -37,6 +37,7 @@ unsigned dataSize = cols * rows; // or: SEGLEN for virtual length
3737
}
3838

3939
if ((strip.now - SEGENV.step) >= refresh_ms) {
40+
// Keep for ≤~1 KiB; otherwise consider heap or reuse SEGENV.data as scratch.
4041
uint8_t tmp_row[cols];
4142
SEGENV.step = strip.now;
4243
// scroll up
@@ -61,7 +62,7 @@ unsigned dataSize = cols * rows; // or: SEGLEN for virtual length
6162
// diffuse
6263
for (unsigned y = 0; y < rows; y++) {
6364
for (unsigned x = 0; x < cols; x++) {
64-
unsigned v = SEGENV.data[XY(x, y)];
65+
uint16_t v = SEGENV.data[XY(x, y)];
6566
if (x > 0) {
6667
v += SEGENV.data[XY(x - 1, y)];
6768
}
@@ -73,7 +74,7 @@ unsigned dataSize = cols * rows; // or: SEGLEN for virtual length
7374

7475
for (unsigned x = 0; x < cols; x++) {
7576
SEGENV.data[XY(x, y)] = tmp_row[x];
76-
if (SEGMENT.option1) {
77+
if (SEGMENT.check1) {
7778
uint32_t color = SEGMENT.color_from_palette(tmp_row[x], true, false, 0);
7879
SEGMENT.setPixelColorXY(x, y, color);
7980
} else {

0 commit comments

Comments
 (0)