From 9f42358f3129011f7116f3d334787b0df12c5a42 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Thu, 14 Dec 2017 15:58:39 -0800 Subject: [PATCH] Try and restart a stream 2secs after a disconnect. --- examples/WebRadio/WebRadio.ino | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/WebRadio/WebRadio.ino b/examples/WebRadio/WebRadio.ino index 8904ce3..701bc5b 100644 --- a/examples/WebRadio/WebRadio.ino +++ b/examples/WebRadio/WebRadio.ino @@ -334,11 +334,18 @@ void StartNewURL() void loop() { static int lastms = 0; + static int retryms = 0; + if (millis()-lastms > 1000) { lastms = millis(); Serial.printf_P(PSTR("Running for %d seconds...Free mem=%d\n"), lastms/1000, ESP.getFreeHeap()); } - + + if (retryms && millis()-retryms>0) { + retryms = 0; + newUrl = true; + } + if (newUrl) { StartNewURL(); } @@ -349,6 +356,7 @@ void loop() Serial.printf_P(PSTR("Stopping decoder\n")); decoder->stop(); StopPlaying(); + retryms = millis() + 2000; } } else { // Nothing here