From d6ecad9be62b5a7c3b9cb353d48813f9099940c5 Mon Sep 17 00:00:00 2001 From: Correl Date: Fri, 20 Jan 2023 12:23:23 -0500 Subject: [PATCH] Switch to M5Unified M5EPD is deprecated and is causing problems during setup. --- platformio.ini | 3 ++- src/main.cpp | 29 +++++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/platformio.ini b/platformio.ini index 2be4567..3e9db79 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,8 +13,9 @@ platform = espressif32 board = m5stack-fire framework = arduino lib_deps = + M5Unified @ ^0.1.2 + M5GFX @ ^0.1.2 https://github.com/me-no-dev/ESPAsyncWebServer.git - 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 0f1d342..3463fcb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,24 +1,18 @@ -#include +#include +#include #include -#include +#include #include const char* ssid = "REPLACE_WITH_YOUR_SSID"; const char* password = "REPLACE_WITH_YOUR_PASSWORD"; AsyncWebServer server(80); -M5EPD_Canvas canvas(&M5.EPD); - -void setup_wifi() { -} void setup(void) { - M5.begin(); - M5.EPD.SetRotation(90); - M5.EPD.Clear(true); - M5.RTC.begin(); - Serial.println("createCanvas"); - canvas.createCanvas(540, 960); + auto cfg = M5.config(); + M5.begin(cfg); + M5.Display.setTextSize(3); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); @@ -43,10 +37,13 @@ void setup(void) { server.begin(); Serial.println("HTTP server started"); - canvas.setTextSize(3); - canvas.drawString(ssid, 0, 0); - canvas.drawString(WiFi.localIP().toString(), 0, 20); - canvas.pushCanvas(0, 0, UPDATE_MODE_DU4); + M5.Display.printf("SSID: %s\n", ssid); + M5.Display.printf("IP Address: %s\n", WiFi.localIP().toString()); + M5.Display.printf("\n\n"); + M5.Display.printf("Web server running on port 80\n"); + M5.Display.printf("ElegantOTA available at\n" + "http://%s/update\n", + WiFi.localIP().toString()); } void loop()