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)
This commit is contained in:
Dschogo
2025-03-15 13:38:34 +01:00
committed by GitHub
parent 7b521c7c40
commit a353a64568

View File

@@ -183,8 +183,7 @@ uint16_t color_wipe(bool rev, bool useRandomColors) {
} }
unsigned ledIndex = (prog * SEGLEN) >> 15; unsigned ledIndex = (prog * SEGLEN) >> 15;
unsigned rem = 0; uint16_t rem = (prog * SEGLEN) * 2; //mod 0xFFFF by truncating
rem = (prog * SEGLEN) * 2; //mod 0xFFFF
rem /= (SEGMENT.intensity +1); rem /= (SEGMENT.intensity +1);
if (rem > 255) rem = 255; if (rem > 255) rem = 255;