Add an OTA update server

This commit is contained in:
Correl Roush 2023-01-20 11:26:41 -05:00
parent f4c1e163af
commit 324befebb9
2 changed files with 13 additions and 10 deletions

View file

@ -14,7 +14,7 @@ board = m5stack-fire
framework = arduino framework = arduino
lib_deps = lib_deps =
https://github.com/me-no-dev/ESPAsyncWebServer.git https://github.com/me-no-dev/ESPAsyncWebServer.git
m5stack/M5EPD @ ^0.1.1 m5stack/M5EPD @ ^0.1.4
bblanchon/ArduinoJson @ ^6.17.3 bblanchon/ArduinoJson @ ^6.17.3
ayushsharma82/AsyncElegantOTA @ ^2.2.7 ayushsharma82/AsyncElegantOTA @ ^2.2.7
upload_speed = 2000000 upload_speed = 2000000

View file

@ -1,6 +1,6 @@
#include <M5EPD.h> #include <M5EPD.h>
#include <WiFi.h> #include <WiFi.h>
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebSrv.h>
#include <AsyncElegantOTA.h> #include <AsyncElegantOTA.h>
const char* ssid = "REPLACE_WITH_YOUR_SSID"; const char* ssid = "REPLACE_WITH_YOUR_SSID";
@ -9,8 +9,17 @@ const char* password = "REPLACE_WITH_YOUR_PASSWORD";
AsyncWebServer server(80); AsyncWebServer server(80);
M5EPD_Canvas canvas(&M5.EPD); M5EPD_Canvas canvas(&M5.EPD);
void setup_wifi() {
}
void setup(void) { void setup(void) {
Serial.begin(115200); M5.begin();
M5.EPD.SetRotation(90);
M5.EPD.Clear(true);
M5.RTC.begin();
Serial.println("createCanvas");
canvas.createCanvas(540, 960);
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
Serial.println(""); Serial.println("");
@ -34,13 +43,6 @@ void setup(void) {
server.begin(); server.begin();
Serial.println("HTTP server started"); Serial.println("HTTP server started");
disableCore0WDT();
M5.begin();
M5.TP.SetRotation(90);
M5.EPD.SetRotation(90);
M5.EPD.Clear(true);
M5.RTC.begin();
canvas.createCanvas(400, 300);
canvas.setTextSize(3); canvas.setTextSize(3);
canvas.drawString(ssid, 0, 0); canvas.drawString(ssid, 0, 0);
canvas.drawString(WiFi.localIP().toString(), 0, 20); canvas.drawString(WiFi.localIP().toString(), 0, 20);
@ -49,4 +51,5 @@ void setup(void) {
void loop() void loop()
{ {
yield();
} }