Added calibration mode

This commit is contained in:
David Madison 2016-12-20 10:07:35 -05:00
parent baaa63ff46
commit 9ee23cee1b
1 changed files with 14 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#define GROUND_PIN 10 // additional grounding pin (optional) #define GROUND_PIN 10 // additional grounding pin (optional)
#define BRIGHTNESS 255 // maximum brightness #define BRIGHTNESS 255 // maximum brightness
#define SPEED 115200 // serial port speed, max available #define SPEED 115200 // serial port speed, max available
//#define CALIBRATE // uncomment to set calibration mode
// If no serial data is received for a while, the LEDs are shut off // If no serial data is received for a while, the LEDs are shut off
// automatically. Value in milliseconds. // automatically. Value in milliseconds.
@ -139,8 +140,19 @@ void setup()
if(bytesRemaining > 0) { if(bytesRemaining > 0) {
if(bytesBuffered > 0) { if(bytesBuffered > 0) {
if (outPos < sizeof(leds)) if (outPos < sizeof(leds)){
#ifdef CALIBRATE
if(outPos < 3)
ledsRaw[outPos++] = buffer[indexOut++];
else{
ledsRaw[outPos] = ledsRaw[outPos%3]; // Sets RGB data to first LED color
outPos++;
indexOut++;
}
#else
ledsRaw[outPos++] = buffer[indexOut++]; // Issue next byte ledsRaw[outPos++] = buffer[indexOut++]; // Issue next byte
#endif
}
bytesBuffered--; bytesBuffered--;
bytesRemaining--; bytesRemaining--;
} }