   * API endpoints:
     x reset
     x get data
+    x set calibration
     * set tap name
     * animation (beer) type
-
 */
+
 // This #include statement was automatically added by the Particle IDE.
 #include "neopixel/neopixel.h"
 

}

void recalculateTapColor()
{ //change the color of the tap based on percentFull
  //as percentFull goes from 100 to 0, gradiate 
  //from green (0, 255, 0)
  //to red     (255, 0, 0)
  //the middle (yellow) is (255, 255, 0)

  float multiplier = (255.0f + 255.0f) / 100.0f;
  int value = multiplier * percentFull;
  int red;
  int green;
  if(value > 255)
  { //add to the red
    red = value - 255;
    green = 255;
  }
  else
  { //subtract from green
    red = 255;
    green = value;
  }

  for(int i=0; i<PIXEL_COUNT; i++)
  {
    strip.setPixelColor(i, strip.Color(red, green, 0));
  }
  strip.show();
}

void animateTap(int animationStep)
{ //do the flow animation
  if(animationStep >= PIXEL_COUNT)
    animationStep = 0;

  setAllPixelsOff();
  strip.setPixelColor(animationStep, strip.Color(random(255), random(255), random(255)));
  strip.show();
  delay(100);
  animationStep++;

  {
      // setPixels(instantPulseCount);
      instantPulseCount = 0;
      if(previousPulseCount != pulseCount)
        flowing = true;
      else
        flowing = false;
      previousPulseCount = pulseCount;
      previousSecond = currentSecond;
  }
}
