Skip to content

Commit

Permalink
Mutliled pattern args for orbit
Browse files Browse the repository at this point in the history
  • Loading branch information
LivingSynthesis committed Nov 29, 2023
1 parent cc2ddc9 commit bebaa9e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
9 changes: 8 additions & 1 deletion 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_blendRepeats(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,7 +68,11 @@ 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;
// only increment every blendDelay times
if (!m_blendRepeats) {
m_cur.hue += sign;
}
m_blendRepeats = (m_blendRepeats +1) % (m_blendDelay + 1);
HSVColor showColor = m_cur;
// set the target led with the current HSV color
for (LedPos pos = LED_FIRST; pos < LED_COUNT; ++pos) {
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_blendRepeats;

Timer m_blinkTimer;

Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/Patterns/Multi/VortexPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void VortexPattern::blinkOn()
void VortexPattern::poststep()
{
m_progress = (m_progress + 1) % RING_COUNT;
if (RING_COUNT - m_progress == RING_LAST) {
if (RING_COUNT - m_progress == RING_COUNT) {
m_colorset.getNext();
}
}
4 changes: 2 additions & 2 deletions VortexEngine/src/Patterns/Multi/ZigzagPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void ZigzagPattern::init()
m_stepTimer.start();

// initialize the snakes with dops timing
m_snake1.init(m_onDuration, m_offDuration, m_colorset, 0, 0, m_snakeSize, m_fadeAmount, 3);
m_snake2.init(m_onDuration, m_offDuration, m_colorset, 1, HALF_ZIGZAG_STEPS, m_snakeSize, m_fadeAmount, 8);
m_snake1.init(m_onDuration, m_offDuration, m_colorset, 0, 0, m_snakeSize, m_fadeAmount, 4);
m_snake2.init(m_onDuration, m_offDuration, m_colorset, 1, HALF_ZIGZAG_STEPS, m_snakeSize, m_fadeAmount, 7);
}

// pure virtual must override the play function
Expand Down
32 changes: 16 additions & 16 deletions VortexEngine/src/Patterns/PatternBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,28 +164,28 @@ PatternArgs PatternBuilder::getDefaultArgs(PatternID id)
// =====================
// Multi Led Patterns:
#if VORTEX_SLIM == 0
case PATTERN_HUE_SCROLL: return PatternArgs(1, 1);
case PATTERN_HUE_SCROLL: return PatternArgs(1, 1, 10);
case PATTERN_THEATER_CHASE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 28);
case PATTERN_CHASER: return PatternArgs();
case PATTERN_ZIGZAG: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 55, 1, 55);
case PATTERN_ZIPFADE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 100, 4, 1);
case PATTERN_DRIP: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 250);
case PATTERN_ZIGZAG: return PatternArgs(DOPS_ON_DURATION, 3, 3, 5, 55);
case PATTERN_ZIPFADE: return PatternArgs(DOPS_ON_DURATION, 2, 75, 9, 230);
case PATTERN_DRIP: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 150);
case PATTERN_DRIPMORPH: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 1);
case PATTERN_CROSSDOPS: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 100);
case PATTERN_CROSSDOPS: return PatternArgs(DOPS_ON_DURATION, 2, 25);
case PATTERN_DOUBLESTROBE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 115);
case PATTERN_METEOR: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 55, 75);
case PATTERN_SPARKLETRACE: return PatternArgs(5, 0, 50);
case PATTERN_VORTEXWIPE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 130);
case PATTERN_WARP: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 150);
case PATTERN_WARPWORM: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 110);
case PATTERN_SNOWBALL: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 110);
case PATTERN_LIGHTHOUSE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 100, 25, 5);
case PATTERN_PULSISH: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, STROBE_ON_DURATION, STROBE_OFF_DURATION, 250);
case PATTERN_FILL: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 200);
case PATTERN_BOUNCE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 200, 10);
case PATTERN_METEOR: return PatternArgs(1, 1, 20, 130);
case PATTERN_SPARKLETRACE: return PatternArgs(1, 5, 3);
case PATTERN_VORTEXWIPE: return PatternArgs(DOPS_ON_DURATION, 3, 80);
case PATTERN_WARP: return PatternArgs(3, DOPS_OFF_DURATION, 50);
case PATTERN_WARPWORM: return PatternArgs(DOPS_ON_DURATION, 10, 100);
case PATTERN_SNOWBALL: return PatternArgs(3, 3, 33);
case PATTERN_LIGHTHOUSE: return PatternArgs(DOPS_ON_DURATION, 5, 22, 3, 3);
case PATTERN_PULSISH: return PatternArgs(DOPS_ON_DURATION, 6, 5, 1, 100);
case PATTERN_FILL: return PatternArgs(DOPS_ON_DURATION, 5, 50);
case PATTERN_BOUNCE: return PatternArgs(10, 5, 50, 10);
case PATTERN_SPLITSTROBIE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 0, 16, 3, 10, PATTERN_DOPS, PATTERN_STROBIE);
case PATTERN_BACKSTROBE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 0, HYPERSTROBE_ON_DURATION, HYPERSTROBE_OFF_DURATION, 10, PATTERN_DOPS, PATTERN_HYPERSTROBE);
case PATTERN_VORTEX: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 130);
case PATTERN_VORTEX: return PatternArgs(1, 1, 130);
case PATTERN_NONE: break;
default: break;
#else
Expand Down

0 comments on commit bebaa9e

Please sign in to comment.