 #include <FastLED.h>
 
 // Serial DEBUG mode on/off
+#undef DEBUG_SERIAL
+#undef DEBUG_ANIMATION
 #undef DEBUG_POTS
 
 // Analog input pins.

// Initial setup, called once on boot.
void setup() {
    FastLED.addLeds<NEOPIXEL, PIN_LED>(leds, NUM_LEDS).setCorrection(TypicalSMD5050);
#ifdef DEBUG_POTS
    Serial.begin(115200);
#endif
}


// Fill all LEDs with a single color. Animate the intensity as a sine wave.
void modeBreathe() {
    uint8_t start;
    uint8_t sine;
    uint8_t value;

    sine = sin8(animation());
    start = pots.val - 100;
    if (start > pots.val) {
        start = 0;
    }
    value = map(sine, 0, 255, start, pots.val);

#ifdef DEBUG_ANIMATION
    char buf[128];
    sprintf(buf, "sine:%4d  start:%4d  pot:%4d  value:%4d", sine, start, pots.val, value);
    Serial.println(buf);
    delay(20);
#endif

    fill_solid(&leds[0], NUM_LEDS, CHSV(pots.hue, pots.sat, value));
}

// Animate each LED's intensity according to a sine wave.
