Skip to content

Commit

Permalink
Merge branch 'master' into gloves
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Dec 8, 2023
2 parents 52a268e + 16cb871 commit c4db361
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 14 additions & 2 deletions VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ 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)
{
m_patternID = PATTERN_HUE_SCROLL;
REGISTER_ARG(m_blinkOnDuration);
REGISTER_ARG(m_blinkOffDuration);
REGISTER_ARG(m_blendDelay);
setArgs(args);
}

Expand Down Expand Up @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions VortexEngine/src/Patterns/Multi/HueShiftPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c4db361

Please sign in to comment.