Skip to content

Commit 9a66ac9

Browse files
authored
Merge pull request #13 from dmadison/timeouts
Updated Timeouts
2 parents 377362d + 79edc69 commit 9a66ac9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Arduino/LEDstream_FastLED/LEDstream_FastLED.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static const uint8_t
3636
static const unsigned long
3737
SerialSpeed = 115200; // serial port speed
3838
static const uint16_t
39-
SerialTimeout = 150; // time before LEDs are shut off if no data (in seconds)
39+
SerialTimeout = 60; // time before LEDs are shut off if no data (in seconds), 0 to disable
4040

4141
// --- Optional Settings (uncomment to add)
4242
#define SERIAL_FLUSH // Serial buffer cleared on LED latch
@@ -234,12 +234,12 @@ void dataSet(){
234234
void timeouts(){
235235
// No data received. If this persists, send an ACK packet
236236
// to host once every second to alert it to our presence.
237-
if((t - lastAckTime) > 1000) {
237+
if((t - lastAckTime) >= 1000) {
238238
Serial.print("Ada\n"); // Send ACK string to host
239239
lastAckTime = t; // Reset counter
240240

241241
// If no data received for an extended time, turn off all LEDs.
242-
if((t - lastByteTime) > SerialTimeout * 1000) {
242+
if(SerialTimeout != 0 && (t - lastByteTime) >= (uint32_t) SerialTimeout * 1000) {
243243
memset(leds, 0, Num_Leds * sizeof(struct CRGB)); //filling Led array by zeroes
244244
FastLED.show();
245245
mode = Header;

0 commit comments

Comments
 (0)