From 628ac413f9dd6ba1f78ed245c9691b97ea65b527 Mon Sep 17 00:00:00 2001 From: biver Date: Wed, 27 Apr 2022 14:32:02 +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=BF=D0=B5=D1=80=D0=B5=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=20=D1=80=D0=B0=D0=BE=D1=82=D1=8B?= =?UTF-8?q?=20=D0=B4=D0=B8=D1=81=D0=BF=D0=BB=D0=B5=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/lcd/Lcd2004/Lcd2004.cpp | 34 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/modules/lcd/Lcd2004/Lcd2004.cpp b/src/modules/lcd/Lcd2004/Lcd2004.cpp index c7396a61..de587229 100644 --- a/src/modules/lcd/Lcd2004/Lcd2004.cpp +++ b/src/modules/lcd/Lcd2004/Lcd2004.cpp @@ -14,6 +14,8 @@ class Lcd2004 : public IoTItem { String _descr; int _prevStrSize; + bool _isShow = true; // экран показывает + public: Lcd2004(String parameters) : IoTItem(parameters) { String addr, size, xy; @@ -60,18 +62,36 @@ class Lcd2004 : public IoTItem { LCDI2C->noBacklight(); else if (command == "backlight") LCDI2C->backlight(); - else if (command == "noDisplay") + else if (command == "noDisplay") { LCDI2C->noDisplay(); - else if (command == "display") + _isShow = false; + } else if (command == "display") { LCDI2C->display(); - else if (command == "x") { - _x = param[0].valD; + _isShow = true; + } else if (command == "toggle") { + if (_isShow) { + LCDI2C->noDisplay(); + _isShow = false; + } else { + LCDI2C->display(); + _isShow = true; + } + } else if (command == "x") { + if (param.size()) { + _x = param[0].valD; + } } else if (command == "y") { - _y = param[0].valD; + if (param.size()) { + _y = param[0].valD; + } } else if (command == "descr") { - _descr = param[0].valS; + if (param.size()) { + _descr = param[0].valS; + } } else if (command == "id2show") { - _id2show = param[0].valS; + if (param.size()) { + _id2show = param[0].valS; + } } doByInterval();