Add an OTA update webserver
This commit is contained in:
parent
5e7ed723d8
commit
4d828e874e
2 changed files with 35 additions and 2 deletions
|
@ -13,8 +13,10 @@ platform = espressif32
|
||||||
board = m5stack-fire
|
board = m5stack-fire
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
https://github.com/me-no-dev/ESPAsyncWebServer.git
|
||||||
m5stack/M5EPD @ ^0.1.1
|
m5stack/M5EPD @ ^0.1.1
|
||||||
bblanchon/ArduinoJson @ ^6.17.3
|
bblanchon/ArduinoJson @ ^6.17.3
|
||||||
|
ayushsharma82/AsyncElegantOTA @ ^2.2.7
|
||||||
upload_speed = 2000000
|
upload_speed = 2000000
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
board_build.partitions = default_16MB.csv
|
board_build.partitions = default_16MB.csv
|
||||||
|
|
35
src/main.cpp
35
src/main.cpp
|
@ -1,7 +1,38 @@
|
||||||
#include <M5EPD.h>
|
#include <M5EPD.h>
|
||||||
|
#include <WiFi.h>
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
#include <AsyncElegantOTA.h>
|
||||||
|
|
||||||
|
const char* ssid = "REPLACE_WITH_YOUR_SSID";
|
||||||
|
const char* password = "REPLACE_WITH_YOUR_PASSWORD";
|
||||||
|
|
||||||
|
AsyncWebServer server(80);
|
||||||
|
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
WiFi.begin(ssid, password);
|
||||||
|
Serial.println("");
|
||||||
|
|
||||||
|
// Wait for connection
|
||||||
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
|
delay(500);
|
||||||
|
Serial.print(".");
|
||||||
|
}
|
||||||
|
Serial.println("");
|
||||||
|
Serial.print("Connected to ");
|
||||||
|
Serial.println(ssid);
|
||||||
|
Serial.print("IP address: ");
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
|
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
|
||||||
|
request->send(200, "text/plain", "Hi! I am ESP32.");
|
||||||
|
});
|
||||||
|
|
||||||
|
AsyncElegantOTA.begin(&server); // Start ElegantOTA
|
||||||
|
server.begin();
|
||||||
|
Serial.println("HTTP server started");
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
disableCore0WDT();
|
disableCore0WDT();
|
||||||
M5.begin();
|
M5.begin();
|
||||||
M5.TP.SetRotation(90);
|
M5.TP.SetRotation(90);
|
||||||
|
|
Loading…
Reference in a new issue