Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/qpLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ qpPattern &qpLayer::pattern(byte patternIndex) {
return *this->lastReferencedPattern;
}

byte qpLayer::numberOfPatterns() {
return this->patterns.numElements;
}

void qpLayer::removePattern(byte patternIndex) {
qpPattern* pattern = this->patterns.getItem(patternIndex);
if (pattern == nullptr) {
return;
}
if(this->lastReferencedPattern == pattern) {
this->lastReferencedPattern = nullptr;
}
this->patterns.remove(patternIndex);
}

qpPattern &qpLayer::operator()(byte patternIndex) {

return this->pattern(patternIndex);
Expand Down
2 changes: 2 additions & 0 deletions src/qpLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class qpLayer {
// Patterns
qpPattern &pattern(byte patternIndex);
qpPattern &samePattern() { return *this->lastReferencedPattern; }
byte numberOfPatterns();
void removePattern(byte patternIndex);

// Quick access operators
qpPattern &operator()(byte patternIndex);
Expand Down
1 change: 1 addition & 0 deletions src/qpLinkedList.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class qpLinkedList {

delete current->item;
delete current;
numElements--;
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/qpPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ bool qpPattern::activate() {

this->activations++;

this->nextRenderTick = this->ticks;
this->nextRenderTick = this->ticks + 1;

this->onActivate();

Expand Down
2 changes: 1 addition & 1 deletion src/qpPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class qpPattern {
// ~ Animation speed

int ticksBetweenFrames = 1;
int nextRenderTick = 1;
unsigned long nextRenderTick = 1;

// ~ Periodic activation

Expand Down
2 changes: 1 addition & 1 deletion src/quickPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ quickPatterns::~quickPatterns() {

bool quickPatterns::draw() {

uint32_t currentMillis = millis();
unsigned long currentMillis = millis();

if(currentMillis >= this->nextTickMillis) {

Expand Down
2 changes: 1 addition & 1 deletion src/quickPatterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class quickPatterns {
private:

short tickLengthInMillis = 25;
uint32_t nextTickMillis = 0;
unsigned long nextTickMillis = 0;

qpLightStrand *lightStrand;

Expand Down