diff --git a/include/items/vSensorLCD2004.h b/include/items/vSensorLCD2004.h index eecc392b..a280315c 100644 --- a/include/items/vSensorLCD2004.h +++ b/include/items/vSensorLCD2004.h @@ -19,6 +19,7 @@ class SensorLCD2004 { void writeLCD2004(); void execute(String command); String _key; + void printBlankStr(int strSize); private: unsigned long currentMillis; diff --git a/src/items/vSensorLCD2004.cpp b/src/items/vSensorLCD2004.cpp index afdf1f48..a0330ef0 100644 --- a/src/items/vSensorLCD2004.cpp +++ b/src/items/vSensorLCD2004.cpp @@ -24,10 +24,10 @@ SensorLCD2004::SensorLCD2004(String key, unsigned long interval, unsigned int x, SensorLCD2004::~SensorLCD2004() {} //печать пустой строки нужной длинны для затирания предыдущего значения на экране -void printBlankStr(int x, int y, int strSize){ +void SensorLCD2004::printBlankStr(int strSize){ String tmpStr = ""; for(int i=0; isetCursor(x, y); + LCDI2C->setCursor(_x, _y); LCDI2C->print(tmpStr); } @@ -37,21 +37,25 @@ void SensorLCD2004::execute(String command) { else if (command == "noDisplay") LCDI2C->noDisplay(); else if (command == "display") LCDI2C->display(); else if (command == "x") { - printBlankStr(_x, _y, _prevStrSize); + printBlankStr(_prevStrSize); String par = sCmd.next(); _x = par.toInt(); } else if (command == "y") { + printBlankStr(_prevStrSize); String par = sCmd.next(); _y = par.toInt(); } - else { //не команда, значит данные (параметры - x и y) - + else if (command == "descr") { + printBlankStr(_prevStrSize); + String par = sCmd.next(); + _descr = par; + } + else { //не команда, значит данные + _val = command; } writeLCD2004(); - - //SerialPrint("I", "execute", command + " " + par); } void SensorLCD2004::loop() { @@ -65,7 +69,7 @@ void SensorLCD2004::loop() { void SensorLCD2004::writeLCD2004() { if (LCDI2C != nullptr) { - printBlankStr(_x, _y, _prevStrSize); + printBlankStr(_prevStrSize); String tmpStr = getValue(_val); if (tmpStr == "no value") tmpStr = _val;