diff --git a/VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp b/VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp index 89a593f1a5..1246690963 100644 --- a/VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp @@ -9,6 +9,8 @@ HueShiftPattern::HueShiftPattern(const PatternArgs &args) : MultiLedPattern(args), m_blinkOnDuration(0), m_blinkOffDuration(0), + m_blendDelay(0), + m_delayCounter(0), m_blinkTimer(), m_cur(0), m_next(0) @@ -16,6 +18,7 @@ HueShiftPattern::HueShiftPattern(const PatternArgs &args) : m_patternID = PATTERN_HUE_SCROLL; REGISTER_ARG(m_blinkOnDuration); REGISTER_ARG(m_blinkOffDuration); + REGISTER_ARG(m_blendDelay); setArgs(args); } @@ -65,8 +68,17 @@ void HueShiftPattern::play() // it will cause oscillation around the target hue // because it will never reach the target hue and // always over/under shoot - m_cur.hue += sign; - HSVColor showColor = m_cur; + // only increment every blendDelay times + int timetest = ((Time::getCurtime() - 1) % m_blendDelay); + ++m_delayCounter; + if (m_delayCounter >= m_blendDelay) { + m_delayCounter = 0; + m_cur.hue += sign; + } + HSVColor showColor; + showColor.hue = m_cur.hue; + showColor.sat = 255; + showColor.val = 255; // set the target led with the current HSV color for (LedPos pos = LED_FIRST; pos < LED_COUNT; ++pos) { Leds::setIndex(pos, hsv_to_rgb_generic(showColor)); diff --git a/VortexEngine/src/Patterns/Multi/HueShiftPattern.h b/VortexEngine/src/Patterns/Multi/HueShiftPattern.h index f095a9082f..691b3cb2e9 100644 --- a/VortexEngine/src/Patterns/Multi/HueShiftPattern.h +++ b/VortexEngine/src/Patterns/Multi/HueShiftPattern.h @@ -21,6 +21,8 @@ class HueShiftPattern : public MultiLedPattern private: uint8_t m_blinkOnDuration; uint8_t m_blinkOffDuration; + uint8_t m_blendDelay; + uint8_t m_delayCounter; Timer m_blinkTimer;