Skip to content

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
* Changes to webserver reponses
* no FPS drop from above change
  • Loading branch information
debsahu committed Dec 16, 2018
1 parent 34e3f50 commit 1af6766
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 13 additions & 5 deletions Arduino/E131_PixelPusher/E131_PixelPusher.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ uint64_t PM = 0;
float interval = 10 * 1000.0; // 10s
#endif

bool shouldReboot = false;
char update_html[] PROGMEM = R"=====(<!DOCTYPE html><html lang="en"><head><title>Firmware Update</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width"><link rel="shortcut icon" type="image/x-icon" href="favicon.ico"></head><body><h3>Update Firmware</h3><br><form method="POST" action="/update" enctype="multipart/form-data"><input type="file" name="update"> <input type="submit" value="Update"></form></body></html>)=====";

void setup()
Expand All @@ -62,7 +63,7 @@ void setup()
Serial.println(WiFi.localIP());

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "text/plain", "Send E1.31 Multicast UDP Request to " + WiFi.localIP().toString());
request->send(200, "text/html", "<body align=center><h2>Send E1.31 Multicast UDP Request to " + WiFi.localIP().toString() + "</h2><br><br> Update <a href='/update'>Firmware?</a><br><br><a href='https://github.com/debsahu/E131_PixelPusher'>E131_PixelPusher</a> by @debsahu</body>");
});
server.on("/status", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "text/plain", SKETCH_VERSION);
Expand All @@ -72,12 +73,11 @@ void setup()
request->send(response);
});
server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request) {
bool shouldReboot = !Update.hasError();
AsyncWebServerResponse *response = request->beginResponse(200, "text/plain", shouldReboot?"OK":"FAIL");
shouldReboot = !Update.hasError();
AsyncWebServerResponse *response = request->beginResponse(200, "text/html", shouldReboot ? "<META http-equiv='refresh' content='15;URL=/'>Update Success, rebooting..." : "FAIL");
response->addHeader("Connection", "close");
request->send(response);
if(shouldReboot) ESP.reset(); },
[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
}, [](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
if (!filename.endsWith(".bin")) {
return;
}
Expand Down Expand Up @@ -175,4 +175,12 @@ void loop()
frameCt = 0;
}
#endif

if(shouldReboot) {
#ifdef SHOW_FPS_SERIAL
Serial.println("Rebooting...");
#endif
delay(100);
ESP.reset();
}
}
6 changes: 5 additions & 1 deletion Arduino/E131_PixelPusher/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define SKETCH_VERSION "1.1.1"
#define SKETCH_VERSION "1.1.2"

/*
* Dec 13, 2018 v1.0.0
Expand All @@ -12,4 +12,8 @@
* - Minor bug fixes
* - Add MDNS (new implementation on ESP8266 core v 2.5.0)
* - Remove dist folder, supply dist with release
*
* Dec 16,2018 v1.1.2
* - Changes to webserver reponses
* - no FPS drop from above change
*/

0 comments on commit 1af6766

Please sign in to comment.