From 5a029fb1593a42cacbbd7d64ddddf4d74607b883 Mon Sep 17 00:00:00 2001 From: biver Date: Wed, 12 Jan 2022 11:05:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B4=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B7=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=B8=20=D1=81=D0=BE=D0=B4=D0=B5=D1=80=D0=B6=D0=B8=D0=BC?= =?UTF-8?q?=D0=BE=D0=B5=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B8=D0=BC=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/items/vSensorLCD2004.h | 1 + src/items/vSensorLCD2004.cpp | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) 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;