2018-06-23 21:49:11 +02:00
|
|
|
/*
|
2018-06-24 12:13:46 +02:00
|
|
|
* To upload through terminal you can use: curl -F "image=@firmware.bin" http://<ip>:8080/update
|
2018-06-24 12:01:58 +02:00
|
|
|
*
|
|
|
|
*
|
2018-06-24 12:03:05 +02:00
|
|
|
* bin file location on windows: C:\Users\<your username>\AppData\Local\Temp\arduino_build_<id>
|
2018-06-24 12:01:58 +02:00
|
|
|
*/
|
2018-06-23 21:49:11 +02:00
|
|
|
|
|
|
|
#include <ESP8266WiFi.h>
|
|
|
|
#include <WiFiClient.h>
|
|
|
|
#include <ESP8266WebServer.h>
|
|
|
|
#include <ESP8266mDNS.h>
|
|
|
|
#include <ESP8266HTTPUpdateServer.h>
|
|
|
|
|
|
|
|
ESP8266WebServer httpServer(8080);
|
|
|
|
ESP8266HTTPUpdateServer httpUpdater;
|
|
|
|
|
|
|
|
void setupWebUpdater(void)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
Serial.println();
|
|
|
|
Serial.println("Starting WebUpdater...");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
httpUpdater.setup(&httpServer);
|
|
|
|
httpServer.begin();
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
Serial.println("HTTPUpdateServer ready!");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void doWebUpdater(void)
|
|
|
|
{
|
|
|
|
digitalWrite(D0, HIGH);
|
|
|
|
httpServer.handleClient();
|
|
|
|
}
|
|
|
|
|