ESP32 prints some weird characters on i2c lcd using AsyncWebServer
Posted: Thu Apr 09, 2020 4:20 pm
Hi, I use github.com/me-no-dev/ESPAsyncWebServer library for WiFi, SSD1306 from Adafruit for lcd, I coded something like this, on request "/setAlarm" ESP prints on LCD string "testing", but that prints me weird characters, code lloks like that, calling the same function from any different class works, only doesnt work if called from asynwebserver library
I tried using xTaskCreate but that gave me same error.
that shows how it looks like for me
- void ManageWifi::setupServerHandling() {
- server.on("/getTimeData", HTTP_GET, [] (AsyncWebServerRequest *request) {
- request->send(200, "text/plain", R"({"currentTime":")" + wifiTimeManager.getTime() + "\"}");
- Serial.print("received/get");
- });
- server.on("/setAlarm", HTTP_GET, [](AsyncWebServerRequest * request) {
- if(request->hasParam("time")) {
- AsyncWebParameter* p = request->getParam("time");
- Serial.printf("Received %s with value %s from IP: \n", p->name().c_str(), p->value().c_str());
- Serial.println(request->client()->remoteIP());
- request->send(200, "text/plain", "OK");
- wifiTimeManager.saveAlarmTime(String(p->value()));
- String outputMsg = "New request!\n Time: " + String(p->value()) + "\n IP: " + request->client()->remoteIP().toString();
- lcdManager.printTextLcd("testing", 1);
- }
- });
- server.onNotFound(notFound);
- server.begin();
- }
- void ManageLcd::printTextLcd(String lcdText, int fontSize){
- clearLcd();
- display.setTextSize(fontSize);
- display.print(lcdText);
- display.display();
- delay(1000);
- }
- void ManageLcd::clearLcd() {
- display.setTextColor(WHITE);
- display.setCursor(10, 0);
- display.clearDisplay();
- display.display();
- }