Switch to M5Unified

M5EPD is deprecated and is causing problems during setup.
This commit is contained in:
Correl Roush 2023-01-20 12:23:23 -05:00
parent 324befebb9
commit d6ecad9be6
2 changed files with 15 additions and 17 deletions

View file

@ -13,8 +13,9 @@ platform = espressif32
board = m5stack-fire board = m5stack-fire
framework = arduino framework = arduino
lib_deps = lib_deps =
M5Unified @ ^0.1.2
M5GFX @ ^0.1.2
https://github.com/me-no-dev/ESPAsyncWebServer.git https://github.com/me-no-dev/ESPAsyncWebServer.git
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,24 +1,18 @@
#include <M5EPD.h> #include <Arduino.h>
#include <M5Unified.h>
#include <WiFi.h> #include <WiFi.h>
#include <ESPAsyncWebSrv.h> #include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h> #include <AsyncElegantOTA.h>
const char* ssid = "REPLACE_WITH_YOUR_SSID"; const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD"; const char* password = "REPLACE_WITH_YOUR_PASSWORD";
AsyncWebServer server(80); AsyncWebServer server(80);
M5EPD_Canvas canvas(&M5.EPD);
void setup_wifi() {
}
void setup(void) { void setup(void) {
M5.begin(); auto cfg = M5.config();
M5.EPD.SetRotation(90); M5.begin(cfg);
M5.EPD.Clear(true); M5.Display.setTextSize(3);
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);
@ -43,10 +37,13 @@ void setup(void) {
server.begin(); server.begin();
Serial.println("HTTP server started"); Serial.println("HTTP server started");
canvas.setTextSize(3); M5.Display.printf("SSID: %s\n", ssid);
canvas.drawString(ssid, 0, 0); M5.Display.printf("IP Address: %s\n", WiFi.localIP().toString());
canvas.drawString(WiFi.localIP().toString(), 0, 20); M5.Display.printf("\n\n");
canvas.pushCanvas(0, 0, UPDATE_MODE_DU4); 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() void loop()