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,7 +222,7 @@ void timeouts(){
|
||||||
if((t - lastAckTime) > 1000) {
|
if((t - lastAckTime) > 1000) {
|
||||||
Serial.print("Ada\n"); // Send ACK string to host
|
Serial.print("Ada\n"); // Send ACK string to host
|
||||||
lastAckTime = t; // Reset counter
|
lastAckTime = t; // Reset counter
|
||||||
}
|
|
||||||
// If no data received for an extended time, turn off all LEDs.
|
// If no data received for an extended time, turn off all LEDs.
|
||||||
if((t - lastByteTime) > SerialTimeout) {
|
if((t - lastByteTime) > SerialTimeout) {
|
||||||
memset(leds, 0, Num_Leds * sizeof(struct CRGB)); //filling Led array by zeroes
|
memset(leds, 0, Num_Leds * sizeof(struct CRGB)); //filling Led array by zeroes
|
||||||
|
@ -230,6 +230,7 @@ void timeouts(){
|
||||||
lastByteTime = t; // Reset counter
|
lastByteTime = t; // Reset counter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void loop(){
|
void loop(){
|
||||||
// loop() is avoided as even that small bit of function overhead
|
// loop() is avoided as even that small bit of function overhead
|
||||||
|
|
Loading…
Reference in New Issue