From 111486c7c3fd7f26e851a0d10de6f14a511166e3 Mon Sep 17 00:00:00 2001 From: biver Date: Fri, 7 Oct 2022 22:17:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A7=D1=83=D1=82=D1=8C=20=D0=BE=D0=BF=D1=82?= =?UTF-8?q?=D0=B8=D0=BC=D0=B8=D0=B7=D0=B8=D1=80=D1=83=D0=B5=D0=BC=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D1=83=20LCD16XX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/display/Lcd2004/Lcd2004.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/display/Lcd2004/Lcd2004.cpp b/src/modules/display/Lcd2004/Lcd2004.cpp index 3feee118..74f3080d 100644 --- a/src/modules/display/Lcd2004/Lcd2004.cpp +++ b/src/modules/display/Lcd2004/Lcd2004.cpp @@ -36,9 +36,11 @@ class Lcd2004 : public IoTItem { LCDI2C = new LiquidCrystal_I2C(hexStringToUint8(addr), w, h); if (LCDI2C != nullptr) { LCDI2C->init(); - LCDI2C->backlight(); } } + + LCDI2C->clear(); + LCDI2C->backlight(); jsonRead(parameters, "coord", xy); _x = selectFromMarkerToMarker(xy, ",", 0).toInt(); @@ -52,14 +54,13 @@ class Lcd2004 : public IoTItem { if (LCDI2C != nullptr) { printBlankStr(_prevStrSize); - String tmpStr = ""; - if (_descr != "none") tmpStr = _descr + " " + getItemValue(_id2show); - else tmpStr = getItemValue(_id2show); + String tmpStr = getItemValue(_id2show); + if (_descr != "none") tmpStr = _descr + " " + tmpStr; LCDI2C->setCursor(_x, _y); LCDI2C->print(tmpStr); //LCDI2C->print("Helloy,Manager 404 !"); - + //Serial.printf("ffff %s\n", _id2show); _prevStrSize = tmpStr.length(); } } @@ -113,7 +114,10 @@ class Lcd2004 : public IoTItem { LCDI2C->print(tmpStr); } - ~Lcd2004(){}; + ~Lcd2004(){ + if (LCDI2C) delete LCDI2C; + LCDI2C = nullptr; + }; }; void *getAPI_Lcd2004(String subtype, String param) {