From 61b5086eb472498ef2f227a735e845e9c1216dca Mon Sep 17 00:00:00 2001 From: Selene Scriven Date: Sat, 5 Aug 2017 21:09:00 -0600 Subject: [PATCH] Fixed bug with missing red hues in color rotation. Also made colors a bit less erratic and somewhat more coherent. --- src/Kaleidoscope/LED-Wavepool.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Kaleidoscope/LED-Wavepool.cpp b/src/Kaleidoscope/LED-Wavepool.cpp index 413854ba..8394e989 100644 --- a/src/Kaleidoscope/LED-Wavepool.cpp +++ b/src/Kaleidoscope/LED-Wavepool.cpp @@ -166,15 +166,18 @@ void WavepoolEffect::update(void) { uint8_t offset = (r*COLS) + c; int8_t value = oldpg[pgm_read_byte(rc2pos+offset)]; - cRGB color; uint16_t intensity; + intensity = abs(value) * 2; + if (intensity > 254) intensity = 254; - // intensity = abs(value) * 2 - if (value >= 0) intensity = value * 2; - else intensity = (-value) * 2; // color starts white but gets dimmer and more saturated as it fades, // with hue wobbling according to height map - color = hsvToRgb(current_hue + (uint16_t)value + (uint16_t)value, + int16_t hue = current_hue; + hue = hue + value + (value>>1); + hue = hue & 0xff; + + cRGB color; + color = hsvToRgb(hue, 0xff - intensity, intensity*2);