From 324befebb998063fc0bfd0841b1e7feadfda470b Mon Sep 17 00:00:00 2001 From: Correl Date: Fri, 20 Jan 2023 11:26:41 -0500 Subject: [PATCH] Add an OTA update server --- platformio.ini | 2 +- src/main.cpp | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/platformio.ini b/platformio.ini index dc5aea6..2be4567 100644 --- a/platformio.ini +++ b/platformio.ini @@ -14,7 +14,7 @@ board = m5stack-fire framework = arduino lib_deps = https://github.com/me-no-dev/ESPAsyncWebServer.git - m5stack/M5EPD @ ^0.1.1 + m5stack/M5EPD @ ^0.1.4 bblanchon/ArduinoJson @ ^6.17.3 ayushsharma82/AsyncElegantOTA @ ^2.2.7 upload_speed = 2000000 diff --git a/src/main.cpp b/src/main.cpp index e889e23..0f1d342 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include const char* ssid = "REPLACE_WITH_YOUR_SSID"; @@ -9,8 +9,17 @@ const char* password = "REPLACE_WITH_YOUR_PASSWORD"; AsyncWebServer server(80); M5EPD_Canvas canvas(&M5.EPD); +void setup_wifi() { +} + 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.begin(ssid, password); Serial.println(""); @@ -34,13 +43,6 @@ void setup(void) { server.begin(); 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.drawString(ssid, 0, 0); canvas.drawString(WiFi.localIP().toString(), 0, 20); @@ -49,4 +51,5 @@ void setup(void) { void loop() { + yield(); }