Skip to content

Commit

Permalink
Make Soap effect Super Sync compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
ewowi committed Oct 1, 2023
1 parent 342f99c commit 37e1624
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7847,23 +7847,25 @@ uint16_t mode_2Dsoap() {
const uint32_t mov = MIN(cols,rows)*(SEGMENT.speed+2)/2;
const uint8_t smoothness = MIN(250,SEGMENT.intensity); // limit as >250 produces very little changes

//WLEDMM: changing noise calculation for super sync to make it deterministic using strip.now
// init
if (SEGENV.call == 0) {
random16_set_seed(535);
SEGMENT.setUpLeds();
*noise32_x = random16();
*noise32_y = random16();
*noise32_z = random16();
} else {
*noise32_x += mov;
*noise32_y += mov;
*noise32_z += mov;
}

uint32_t noise32_x_MM = *noise32_x + mov * strip.now / 100; //10 fps (original 20-40 fps, depending on realized fps)
uint32_t noise32_y_MM = *noise32_y + mov * strip.now / 100;
uint32_t noise32_z_MM = *noise32_z + mov * strip.now / 100;

for (int i = 0; i < cols; i++) {
int32_t ioffset = scale32_x * (i - cols / 2);
for (int j = 0; j < rows; j++) {
int32_t joffset = scale32_y * (j - rows / 2);
uint8_t data = inoise16(*noise32_x + ioffset, *noise32_y + joffset, *noise32_z) >> 8;
uint8_t data = inoise16(noise32_x_MM + ioffset, noise32_y_MM + joffset, noise32_z_MM) >> 8;
noise3d[XY(i,j)] = scale8(noise3d[XY(i,j)], smoothness) + scale8(data, 255 - smoothness);
}
}
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// version code in format yymmddb (b = daily build)
#define VERSION 2309300
#define VERSION 2310010

//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG
Expand Down

0 comments on commit 37e1624

Please sign in to comment.