make "if" statement instead of just ifdef

This commit is contained in:
Joey Babcock 2016-12-30 14:23:54 -08:00 committed by GitHub
parent 35d1ab23de
commit 443d8961ae

View File

@ -48,10 +48,11 @@ void setup() {
} }
uint8_t N = 0; uint8_t N = 0;
#ifdef PRINT_FPS if(PRINT_FPS == 1)
int fpsCounter = 0; {
int secondTimer = 0; int fpsCounter = 0;
#endif int secondTimer = 0;
}
void loop() { void loop() {
// Read data over socket // Read data over socket
int packetSize = port.parsePacket(); int packetSize = port.parsePacket();
@ -66,12 +67,14 @@ void loop() {
pixels[N].B = (uint8_t)packetBuffer[i+3]; pixels[N].B = (uint8_t)packetBuffer[i+3];
} }
ledstrip.show(pixels); ledstrip.show(pixels);
Serial.print("*");
#ifdef PRINT_FPS if(PRINT_FPS == 1)
{
Serial.print("*");
fpsCounter++; fpsCounter++;
#endif }
} }
#ifdef PRINT_FPS if(PRINT_FPS == 1){
if(millis() - secondTimer >= 1000) if(millis() - secondTimer >= 1000)
{ {
secondTimer = millis(); secondTimer = millis();
@ -79,5 +82,5 @@ void loop() {
Serial.printf("FPS: %d\n", fpsCounter); Serial.printf("FPS: %d\n", fpsCounter);
fpsCounter = 0; fpsCounter = 0;
} }
#endif }
} }