Skip to content

Commit

Permalink
Fixes for HueShift
Browse files Browse the repository at this point in the history
  • Loading branch information
LivingSynthesis committed Dec 5, 2023
1 parent a4a5746 commit 9bfc4a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ HueShiftPattern::HueShiftPattern(const PatternArgs &args) :
m_blinkOnDuration(0),
m_blinkOffDuration(0),
m_blendDelay(0),
m_delayCounter(0),
m_blinkTimer(),
m_cur(0),
m_next(0)
Expand Down Expand Up @@ -68,10 +69,16 @@ void HueShiftPattern::play()
// because it will never reach the target hue and
// always over/under shoot
// only increment every blendDelay times
if (!m_blendDelay || (Time::getCurtime() % m_blendDelay) == 0) {
int timetest = ((Time::getCurtime() - 1) % m_blendDelay);
++m_delayCounter;
if (m_delayCounter >= m_blendDelay) {
m_delayCounter = 0;
m_cur.hue += sign;
}
HSVColor showColor = m_cur;
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));
Expand Down
1 change: 1 addition & 0 deletions VortexEngine/src/Patterns/Multi/HueShiftPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class HueShiftPattern : public MultiLedPattern
uint8_t m_blinkOnDuration;
uint8_t m_blinkOffDuration;
uint8_t m_blendDelay;
uint8_t m_delayCounter;

Timer m_blinkTimer;

Expand Down

0 comments on commit 9bfc4a6

Please sign in to comment.