Nested serial timeout check
Should give a significant performance improvement, reducing the delay before a received byte is processed. Limits timeout periods to increments of 1000, though.
This commit is contained in:
parent
92362303b8
commit
92e65abde7
|
@ -222,13 +222,14 @@ void timeouts(){
|
|||
if((t - lastAckTime) > 1000) {
|
||||
Serial.print("Ada\n"); // Send ACK string to host
|
||||
lastAckTime = t; // Reset counter
|
||||
}
|
||||
|
||||
// If no data received for an extended time, turn off all LEDs.
|
||||
if((t - lastByteTime) > SerialTimeout) {
|
||||
memset(leds, 0, Num_Leds * sizeof(struct CRGB)); //filling Led array by zeroes
|
||||
FastLED.show();
|
||||
lastByteTime = t; // Reset counter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void loop(){
|
||||
|
|
Loading…
Reference in New Issue