From 97ac17c46663486b75f82743d62847ad49b83c03 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Thu, 11 Aug 2022 15:21:12 +0200 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=BE=D1=80=D0=BC=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=80=D0=B0=D1=81=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=B4=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/classes/IoTItem.cpp | 61 +++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/src/classes/IoTItem.cpp b/src/classes/IoTItem.cpp index 77c99ca7..e36a6b50 100644 --- a/src/classes/IoTItem.cpp +++ b/src/classes/IoTItem.cpp @@ -33,20 +33,19 @@ IoTItem::IoTItem(String parameters) { } } -// IoTItem::~IoTItem() {} - -String IoTItem::getSubtype() { - return _subtype; -} - -String IoTItem::getID() { - return _id; -}; - -void IoTItem::setInterval(unsigned long interval) { - _interval = interval; +//луп выполняющий переодическое дерганье +void IoTItem::loop() { + if (enableDoByInt) { + currentMillis = millis(); + difference = currentMillis - prevMillis; + if (difference >= _interval) { + prevMillis = millis(); + this->doByInterval(); + } + } } +//получить String IoTItem::getValue() { if (value.isDecimal) if (_round >= 0 && _round <= 6) { @@ -59,15 +58,14 @@ String IoTItem::getValue() { return value.valS; } -void IoTItem::loop() { - if (enableDoByInt) { - currentMillis = millis(); - difference = currentMillis - prevMillis; - if (difference >= _interval) { - prevMillis = millis(); - this->doByInterval(); - } +//установить +void IoTItem::setValue(String valStr) { + if (value.isDecimal = isDigitDotCommaStr(valStr)) { + value.valD = valStr.toFloat(); + } else { + value.valS = valStr; } + setValue(value); } void IoTItem::regEvent(String value, String consoleInfo = "") { @@ -121,13 +119,18 @@ void IoTItem::setValue(IoTValue Value) { regEvent(value.valS, ""); } -void IoTItem::setValue(String valStr) { - if (value.isDecimal = isDigitDotCommaStr(valStr)) { - value.valD = valStr.toFloat(); - } else { - value.valS = valStr; - } - setValue(value); +//==========================всякая херня============================================================================================== +//захрена эта хрень? +// String IoTItem::getSubtype() { +// return _subtype; +//} + +String IoTItem::getID() { + return _id; +}; + +void IoTItem::setInterval(unsigned long interval) { + _interval = interval; } externalVariable::externalVariable(String parameters) : IoTItem(parameters) { @@ -144,6 +147,10 @@ void externalVariable::doByInterval() { // для данного класса d iAmDead = true; } +//========================================================================================================================================= + +IoTItem::~IoTItem() {} + IoTItem* myIoTItem; IoTItem* findIoTItem(String name) { // поиск элемента модуля в существующей конфигурации