Refactor and store to EEPROM, restore on reboot

Save the current URL to EEPROM on each change, and try and restart it
after a power loss or reset
This commit is contained in:
Earle F. Philhower, III committed 2017-12-14 10:35:14 -08:00
1 parent 143c4e65ae
commit ee7febe1ec
1 file changed
+9 -3
+9 -3
View File
@@ -169,9 +169,8 @@ void RedirectToIndex(WiFiClient *client)
WebError(client, 301, PSTR("Location: /\r\n"), true);
}
void HandleStop(WiFiClient *client)
void StopPlaying()
{
Serial.printf_P(PSTR("HandleStop()\n"));
if (decoder) {
decoder->stop();
delete decoder;
@@ -193,6 +192,13 @@ void HandleStop(WiFiClient *client)
file = NULL;
}
strcpy_P(status, PSTR("Stopped"));
strcpy_P(title, PSTR("Stopped"));
}
void HandleStop(WiFiClient *client)
{
Serial.printf_P(PSTR("HandleStop()\n"));
StopPlaying();
RedirectToIndex(client);
}
@@ -321,7 +327,7 @@ void loop()
if (!decoder->loop()) {
Serial.printf_P(PSTR("Stopping decoder\n"));
decoder->stop();
strcpy_P(title, PSTR("Stopped"));
StopPlaying();
}
} else {
// Nothing here