-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
109 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "VortexPattern.h" | ||
|
||
#include "../../Serial/ByteStream.h" | ||
#include "../../Time/TimeControl.h" | ||
#include "../../Leds/Leds.h" | ||
#include "../../Log/Log.h" | ||
|
||
// add 1 to prevent the middle point from being led 0 | ||
#define MIDDLE_POINT ((LED_COUNT + 1) / 2) | ||
|
||
VortexPattern::VortexPattern(const PatternArgs& args) : | ||
BlinkStepPattern(args), | ||
m_progress(0) | ||
{ | ||
m_patternID = PATTERN_VORTEXWIPE; | ||
setArgs(args); | ||
} | ||
|
||
VortexPattern::~VortexPattern() | ||
{ | ||
} | ||
|
||
// init the pattern to initial state | ||
void VortexPattern::init() | ||
{ | ||
BlinkStepPattern::init(); | ||
// reset progress | ||
m_progress = 0; | ||
// start colorset at index 0 so cur() works | ||
m_colorset.setCurIndex(0); | ||
} | ||
|
||
void VortexPattern::blinkOn() | ||
{ | ||
// Sets an LED at opposite ends of the strip and progresses towards the center | ||
Leds::setIndex((LedPos)m_progress, m_colorset.peekNext()); | ||
Leds::setIndex((LedPos)(LED_LAST - m_progress), m_colorset.peekNext()); | ||
} | ||
|
||
void VortexPattern::poststep() | ||
{ | ||
// step till the middle point | ||
m_progress = (m_progress + 1) % MIDDLE_POINT; | ||
// each cycle progress to the next color | ||
if (m_progress == 0) { | ||
m_colorset.getNext(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef VORTEX_PATTERN_H | ||
#define VORTEX_PATTERN_H | ||
|
||
#include "BlinkStepPattern.h" | ||
|
||
#include "../../Time/Timings.h" | ||
|
||
class VortexPattern : public BlinkStepPattern | ||
{ | ||
public: | ||
VortexPattern(const PatternArgs& args); | ||
virtual ~VortexPattern(); | ||
|
||
// init the pattern to initial state | ||
virtual void init() override; | ||
|
||
protected: | ||
virtual void blinkOn() override; | ||
virtual void poststep() override; | ||
|
||
private: | ||
// how much the fill has progressed | ||
uint8_t m_progress; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters