mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-16 13:25:03 +01:00
improve pixel example
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user