From 37e16247296801684d84912753fa6bd179aad0f3 Mon Sep 17 00:00:00 2001 From: Ewoud Date: Sun, 1 Oct 2023 21:13:16 +0200 Subject: [PATCH] Make Soap effect Super Sync compatible --- wled00/FX.cpp | 12 +++++++----- wled00/wled.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 9d86068561..8cd6d92e18 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -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); } } diff --git a/wled00/wled.h b/wled00/wled.h index 2fd0aa15fb..f7ceed7668 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -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