|
@@ -136,14 +136,13 @@ class NeoPatterns : public Adafruit_NeoP
|
|
|
TotalSteps = numPixels() / 2;
|
|
|
PixelColor = color;
|
|
|
Index = 0;
|
|
|
}
|
|
|
|
|
|
void DoubleColorWipeUpdate() {
|
|
|
setPixelColor(Index, PixelColor);
|
|
|
setPixelColor(numPixels() - 1 - Index, PixelColor);
|
|
|
DoubleSet(Index, PixelColor);
|
|
|
Increment();
|
|
|
}
|
|
|
|
|
|
void Scanner(uint32_t color, uint16_t interval) {
|
|
|
ActivePattern = SCANNER;
|
|
|
Interval = interval;
|
|
@@ -151,21 +150,20 @@ class NeoPatterns : public Adafruit_NeoP
|
|
|
PixelColor = color;
|
|
|
Index = 0;
|
|
|
}
|
|
|
|
|
|
void ScannerUpdate() {
|
|
|
for (int i = 0; i < numPixels(); i++) {
|
|
|
if (i == Index) {
|
|
|
setPixelColor(i, PixelColor);
|
|
|
}
|
|
|
else if (i == TotalSteps - Index) {
|
|
|
setPixelColor(i, PixelColor);
|
|
|
uint32_t c;
|
|
|
if (i == Index || i == TotalSteps - Index) {
|
|
|
c = PixelColor;
|
|
|
}
|
|
|
else {
|
|
|
setPixelColor(i, DimColor(getPixelColor(i)));
|
|
|
c = DimColor(getPixelColor(i));
|
|
|
}
|
|
|
setPixelColor(i, c);
|
|
|
}
|
|
|
Increment();
|
|
|
}
|
|
|
|
|
|
void DoubleScanner(uint32_t color, uint16_t interval) {
|
|
|
ActivePattern = DOUBLE_SCANNER;
|
|
@@ -174,20 +172,20 @@ class NeoPatterns : public Adafruit_NeoP
|
|
|
PixelColor = color;
|
|
|
Index = 0;
|
|
|
}
|
|
|
|
|
|
void DoubleScannerUpdate() {
|
|
|
for (int i = 0; i < numPixels() / 2; i++) {
|
|
|
uint32_t c;
|
|
|
if (i == Index) {
|
|
|
setPixelColor(i, PixelColor); // First Eye
|
|
|
setPixelColor(numPixels() - 1 - i, PixelColor); // Second Eye
|
|
|
c = PixelColor;
|
|
|
}
|
|
|
else {
|
|
|
setPixelColor(i, DimColor(getPixelColor(i)));
|
|
|
setPixelColor(numPixels() - 1 - i, DimColor(getPixelColor(i)));
|
|
|
c = DimColor(getPixelColor(i));
|
|
|
}
|
|
|
DoubleSet(i, c);
|
|
|
}
|
|
|
Increment();
|
|
|
}
|
|
|
|
|
|
void Random(uint32_t color, uint16_t steps, uint16_t interval) {
|
|
|
ActivePattern = RANDOM;
|
|
@@ -208,15 +206,14 @@ class NeoPatterns : public Adafruit_NeoP
|
|
|
TotalSteps = steps;
|
|
|
PixelColor = color;
|
|
|
Index = 0;
|
|
|
}
|
|
|
|
|
|
void DoubleRandomUpdate() {
|
|
|
int i = random(numPixels() / 2);
|
|
|
setPixelColor(i, PixelColor);
|
|
|
setPixelColor(numPixels() - 1 - i, PixelColor);
|
|
|
int i = random(numPixels() / 2); // this saves 4 bytes instead of calling random in the function call of DoubleSet
|
|
|
DoubleSet(i, PixelColor);
|
|
|
Increment();
|
|
|
}
|
|
|
|
|
|
void Blink(uint32_t color, uint16_t steps, uint16_t interval) {
|
|
|
ActivePattern = BLINK;
|
|
|
Interval = interval;
|
|
@@ -275,12 +272,17 @@ class NeoPatterns : public Adafruit_NeoP
|
|
|
|
|
|
void ColorSet(uint32_t color) {
|
|
|
for (int i = 0; i < numPixels(); i++) {
|
|
|
setPixelColor(i, color);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void DoubleSet(uint16_t i, uint32_t color) {
|
|
|
setPixelColor(i, color);
|
|
|
setPixelColor(numPixels() - 1 - i, color);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
void RingsComplete();
|
|
|
|
|
|
NeoPatterns Rings(32, PIN, NEO_GRB + NEO_KHZ800, &RingsComplete);
|
|
|
uint8_t mode = 0;
|