ToyKeeper / Kaleidoscope-LED-Wavepool

Water / Wavepool lighting effect for Keyboardio Model 01 keyboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

color wheel skips red, does purple twice instead

ToyKeeper opened this issue · comments

I'm still not sure why, but as current_hue rotates from 0 to 255 and back, somehow it skips the red part of the spectrum and instead does purple twice. Maybe this is a bug in hsvToRgb(), maybe it's a bug in my code... but regardless, it's kind of obnoxious.

Nope, doesn't seem to be a bug in hsvToRgb(). If I set the color only to 'current_hue', it works fine. It just doesn't change color based on the wave height in that case, which looks boring.

So something about the hue modification math is messing with it.

Ah, I see the issue. hsvToRgb() says it takes a uint16 but it actually only handles values of 0 to 255... and additionally, it doesn't clip its input values so anything over 255 behaves weird in a way which basically repeats purple shades. Fixed it by clipping the parameters on my end.

Fixed in commit 61b5086.