mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 11:59:12 +03:00
Чуть оптимизируем работу LCD16XX
This commit is contained in:
@@ -36,10 +36,12 @@ class Lcd2004 : public IoTItem {
|
|||||||
LCDI2C = new LiquidCrystal_I2C(hexStringToUint8(addr), w, h);
|
LCDI2C = new LiquidCrystal_I2C(hexStringToUint8(addr), w, h);
|
||||||
if (LCDI2C != nullptr) {
|
if (LCDI2C != nullptr) {
|
||||||
LCDI2C->init();
|
LCDI2C->init();
|
||||||
LCDI2C->backlight();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LCDI2C->clear();
|
||||||
|
LCDI2C->backlight();
|
||||||
|
|
||||||
jsonRead(parameters, "coord", xy);
|
jsonRead(parameters, "coord", xy);
|
||||||
_x = selectFromMarkerToMarker(xy, ",", 0).toInt();
|
_x = selectFromMarkerToMarker(xy, ",", 0).toInt();
|
||||||
_y = selectFromMarkerToMarker(xy, ",", 1).toInt();
|
_y = selectFromMarkerToMarker(xy, ",", 1).toInt();
|
||||||
@@ -52,14 +54,13 @@ class Lcd2004 : public IoTItem {
|
|||||||
if (LCDI2C != nullptr) {
|
if (LCDI2C != nullptr) {
|
||||||
printBlankStr(_prevStrSize);
|
printBlankStr(_prevStrSize);
|
||||||
|
|
||||||
String tmpStr = "";
|
String tmpStr = getItemValue(_id2show);
|
||||||
if (_descr != "none") tmpStr = _descr + " " + getItemValue(_id2show);
|
if (_descr != "none") tmpStr = _descr + " " + tmpStr;
|
||||||
else tmpStr = getItemValue(_id2show);
|
|
||||||
LCDI2C->setCursor(_x, _y);
|
LCDI2C->setCursor(_x, _y);
|
||||||
LCDI2C->print(tmpStr);
|
LCDI2C->print(tmpStr);
|
||||||
|
|
||||||
//LCDI2C->print("Helloy,Manager 404 !");
|
//LCDI2C->print("Helloy,Manager 404 !");
|
||||||
|
//Serial.printf("ffff %s\n", _id2show);
|
||||||
_prevStrSize = tmpStr.length();
|
_prevStrSize = tmpStr.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,7 +114,10 @@ class Lcd2004 : public IoTItem {
|
|||||||
LCDI2C->print(tmpStr);
|
LCDI2C->print(tmpStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Lcd2004(){};
|
~Lcd2004(){
|
||||||
|
if (LCDI2C) delete LCDI2C;
|
||||||
|
LCDI2C = nullptr;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
void *getAPI_Lcd2004(String subtype, String param) {
|
void *getAPI_Lcd2004(String subtype, String param) {
|
||||||
|
|||||||
Reference in New Issue
Block a user