Changeset - a5be02268126
[Not reviewed]
default
0 1 0
Dennis Fink - 6 years ago 2017-12-13 02:31:58
dennis.fink@c3l.lu
Rename color1 variable
1 file changed with 27 insertions and 27 deletions:
0 comments (0 inline, 0 general)
Neopixel_Goggles.ino
Show inline comments
 
@@ -44,13 +44,13 @@ enum  pattern {
 
class NeoPatterns : public Adafruit_NeoPixel {
 
  public:
 
    pattern  ActivePattern;
 

	
 
    uint16_t Interval;
 
    unsigned long lastUpdate;
 
    uint32_t Color1;
 
    uint32_t PixelColor;
 
    uint16_t TotalSteps;
 
    uint16_t Index;
 

	
 
    void (*OnComplete)();
 

	
 
    NeoPatterns(uint16_t pixels, uint8_t pin, uint8_t type, void (*callback)()) : Adafruit_NeoPixel(pixels, pin, type) {
 
@@ -118,143 +118,143 @@ class NeoPatterns : public Adafruit_NeoP
 
    }
 

	
 
    void ColorWipe(uint32_t color, uint16_t interval) {
 
      ActivePattern = COLOR_WIPE;
 
      Interval = interval;
 
      TotalSteps = numPixels();
 
      Color1 = color;
 
      PixelColor = color;
 
      Index = 0;
 
    }
 

	
 
    void ColorWipeUpdate() {
 
      setPixelColor(Index, Color1);
 
      setPixelColor(Index, PixelColor);
 
      Increment();
 
    }
 

	
 
    void DoubleColorWipe(uint32_t color, uint16_t interval) {
 
      ActivePattern = DOUBLE_COLOR_WIPE;
 
      Interval = interval;
 
      TotalSteps = numPixels() / 2;
 
      Color1 = color;
 
      PixelColor = color;
 
      Index = 0;
 
    }
 

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

	
 
    void Scanner(uint32_t color1, uint16_t interval) {
 
    void Scanner(uint32_t color, uint16_t interval) {
 
      ActivePattern = SCANNER;
 
      Interval = interval;
 
      TotalSteps = (numPixels() - 1) * 2;
 
      Color1 = color1;
 
      PixelColor = color;
 
      Index = 0;
 
    }
 

	
 
    void ScannerUpdate() {
 
      for (int i = 0; i < numPixels(); i++) {
 
        if (i == Index) {
 
          setPixelColor(i, Color1);
 
          setPixelColor(i, PixelColor);
 
        }
 
        else if (i == TotalSteps - Index)  {
 
          setPixelColor(i, Color1);
 
          setPixelColor(i, PixelColor);
 
        }
 
        else {
 
          setPixelColor(i, DimColor(getPixelColor(i)));
 
        }
 
      }
 
      Increment();
 
    }
 

	
 
    void DoubleScanner(uint32_t color1, uint16_t interval) {
 
    void DoubleScanner(uint32_t color, uint16_t interval) {
 
      ActivePattern = DOUBLE_SCANNER;
 
      Interval = interval;
 
      TotalSteps = (numPixels() / 2);
 
      Color1 = color1;
 
      PixelColor = color;
 
      Index = 0;
 
    }
 

	
 
    void DoubleScannerUpdate() {
 
      for (int i = 0; i < numPixels() / 2; i++) {
 
        if (i == Index) {
 
          setPixelColor(i, Color1); // First Eye
 
          setPixelColor(numPixels() - 1 - i, Color1); // Second Eye
 
          setPixelColor(i, PixelColor); // First Eye
 
          setPixelColor(numPixels() - 1 - i, PixelColor); // Second Eye
 
        }
 
        else {
 
          setPixelColor(i, DimColor(getPixelColor(i)));
 
          setPixelColor(numPixels() - 1 - i, DimColor(getPixelColor(i)));
 

	
 
        }
 
      }
 
      Increment();
 
    }
 

	
 
    void Random(uint32_t color1, uint16_t steps, uint16_t interval) {
 
    void Random(uint32_t color, uint16_t steps, uint16_t interval) {
 
      ActivePattern = RANDOM;
 
      Interval = interval;
 
      TotalSteps = steps;
 
      Color1 = color1;
 
      PixelColor = color;
 
      Index = 0;
 
    }
 

	
 
    void RandomUpdate() {
 
      setPixelColor(random(numPixels()), Color1);
 
      setPixelColor(random(numPixels()), PixelColor);
 
      Increment();
 
    }
 

	
 
    void DoubleRandom(uint32_t color1, uint16_t steps, uint16_t interval) {
 
    void DoubleRandom(uint32_t color, uint16_t steps, uint16_t interval) {
 
      ActivePattern = DOUBLE_RANDOM;
 
      Interval = interval;
 
      TotalSteps = steps;
 
      Color1 = color1;
 
      PixelColor = color;
 
      Index = 0;
 
    }
 

	
 
    void DoubleRandomUpdate() {
 
      int i = random(numPixels() / 2);
 
      setPixelColor(i, Color1);
 
      setPixelColor(numPixels() - 1 - i, Color1);
 
      setPixelColor(i, PixelColor);
 
      setPixelColor(numPixels() - 1 - i, PixelColor);
 
      Increment();
 
    }
 

	
 
    void Blink(uint32_t color1, uint16_t steps, uint16_t interval) {
 
    void Blink(uint32_t color, uint16_t steps, uint16_t interval) {
 
      ActivePattern = BLINK;
 
      Interval = interval;
 
      if (steps % 2 != 0) {
 
        steps++;
 
      }
 
      TotalSteps = steps;
 
      Color1 = color1;
 
      PixelColor = color;
 
      Index = 0;
 
    }
 

	
 
    void BlinkUpdate() {
 
      uint32_t c;
 
      if (Index % 2 == 0) {
 
        c = Color1;
 
        c = PixelColor;
 
      } else {
 
        c = Color(0, 0, 0);
 
      }
 
      ColorSet(c);
 
      Increment();
 
    }
 

	
 
    void Dot(uint32_t color1, uint16_t steps, uint16_t interval) {
 
    void Dot(uint32_t color, uint16_t steps, uint16_t interval) {
 
      ActivePattern = DOT;
 
      Interval = interval;
 
      TotalSteps = steps;
 
      Color1 = color1;
 
      PixelColor = color;
 
      Index = 0;
 
    }
 

	
 
    void DotUpdate() {
 
      ColorSet(Color(0, 0, 0));
 
      show();
 
      setPixelColor(random(numPixels()), Color1);
 
      setPixelColor(random(numPixels()), PixelColor);
 
      Increment();
 
    }
 

	
 
    uint32_t DimColor(uint32_t color) {
 
      return Color(((color >> 16) & 0xFF) >> 1, ((color >> 8) & 0xFF) >> 1, (color & 0xFF) >> 1);
 
    }
0 comments (0 inline, 0 general)