From a353a64568001ff07dc3b92c5b2a46885b00f23b Mon Sep 17 00:00:00 2001 From: Dschogo <36862419+Dschogo@users.noreply.github.com> Date: Sat, 15 Mar 2025 13:38:34 +0100 Subject: [PATCH] Fix wipe effect smoothness With update to 15.x many vars got changed to unsigned. Wipe relies on truncation (of an uint16_t) for modulo operation, and was therefore broken. Using directly an uint16_t like my proposal *should* be overall faster than using an unsigned and then doing a modulo. (Not an expert) --- wled00/FX.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index ccc8e2d83..b516a41c8 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -183,8 +183,7 @@ uint16_t color_wipe(bool rev, bool useRandomColors) { } unsigned ledIndex = (prog * SEGLEN) >> 15; - unsigned rem = 0; - rem = (prog * SEGLEN) * 2; //mod 0xFFFF + uint16_t rem = (prog * SEGLEN) * 2; //mod 0xFFFF by truncating rem /= (SEGMENT.intensity +1); if (rem > 255) rem = 255;