Changeset - 03483f073427
[Not reviewed]
default
0 1 0
Dennis Fink - 3 years ago 2018-02-17 00:37:25
dennis.fink@c3l.lu
Add DoubleSet method
1 file changed with 17 insertions and 15 deletions:
0 comments (0 inline, 0 general)
Neopixel_Goggles.ino
Show inline comments
...
 
@@ -139,8 +139,7 @@ class NeoPatterns : public Adafruit_NeoP
 
    }
 

	
 
    void DoubleColorWipeUpdate() {
 
      setPixelColor(Index, PixelColor);
 
      setPixelColor(numPixels() - 1 - Index, PixelColor);
 
      DoubleSet(Index, PixelColor);
 
      Increment();
 
    }
 

	
...
 
@@ -154,15 +153,14 @@ class NeoPatterns : public Adafruit_NeoP
 

	
 
    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();
 
    }
...
 
@@ -177,14 +175,14 @@ class NeoPatterns : public Adafruit_NeoP
 

	
 
    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();
 
    }
...
 
@@ -211,9 +209,8 @@ class NeoPatterns : public Adafruit_NeoP
 
    }
 

	
 
    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();
 
    }
 

	
...
 
@@ -278,6 +275,11 @@ class NeoPatterns : public Adafruit_NeoP
 
        setPixelColor(i, color);
 
      }
 
    }
 

	
 
    void DoubleSet(uint16_t i, uint32_t color) {
 
      setPixelColor(i, color);
 
      setPixelColor(numPixels() - 1 - i, color);
 
    }
 
};
 

	
 
void RingsComplete();
0 comments (0 inline, 0 general)