improve pixel example

This commit is contained in:
2018-08-29 15:13:24 +02:00
parent 945bf78459
commit 30593fd2be
11 changed files with 91 additions and 39 deletions

View File

@@ -57,7 +57,7 @@ class NeoPattern : public Adafruit_NeoPixel
NeoPattern(uint16_t pixels, uint8_t pin, uint8_t type)
:Adafruit_NeoPixel(pixels, pin, type)
{
bind(&NeoPattern::onCompleteDefault, this, pixels);
}
void onCompleteDefault(int pixels) {
@@ -111,10 +111,12 @@ class NeoPattern : public Adafruit_NeoPixel
if (Index >= TotalSteps)
{
Index = 0;
completed = 1;
if (OnComplete != NULL)
{
completed = 1;
OnComplete(numPixels()); // call the comlpetion callback
} else {
Reverse();
}
}
}
@@ -124,10 +126,12 @@ class NeoPattern : public Adafruit_NeoPixel
if (Index <= 0)
{
Index = TotalSteps-1;
completed = 1;
if (OnComplete != NULL)
{
completed = 1;
OnComplete(numPixels()); // call the comlpetion callback
} else {
Reverse();
}
}
}