diff --git a/include/Class/ScenarioClass.h b/include/Class/ScenarioClass.h index 2576064b..ead99d5b 100644 --- a/include/Class/ScenarioClass.h +++ b/include/Class/ScenarioClass.h @@ -1,39 +1,30 @@ #pragma once #include - #include "Cmd.h" #include "Global.h" class Scenario { protected: String _scenarioTmp; - String _condition; String _conditionParam; String _conditionSign; String _conditionValue; - String _scenBlok; - String _event; String _eventParam; String _eventValue; public: Scenario() : _scenarioTmp{""}, - _condition{""}, _conditionParam{""}, _conditionSign{""}, _conditionValue{""}, - _scenBlok{""}, - _event{""}, _eventParam{""}, - _eventValue{""} - - {}; + _eventValue{""} {}; void load() { _scenarioTmp = scenario; @@ -95,9 +86,12 @@ class Scenario { } void loop() { + if (!this->isScenarioEnabled()) { + return; + } this->load(); //после этого мы получили все сценарии while (_scenarioTmp.length() > 1) { - this->calculate1(); + this->calculate1(); if (this->isIncommingEventInScenario()) { //если вошедшее событие есть в сценарии this->calculate2(); if (this->isConditionSatisfied()) { //если вошедшее событие выполняет условие сценария @@ -110,5 +104,9 @@ class Scenario { } this->delOneEvent(); } + + bool isScenarioEnabled() { + return jsonReadBool(configSetupJson, "scen") && eventBuf != ""; + } }; extern Scenario* myScenario; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 6980f52b..fbd877f1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -78,10 +78,8 @@ void setup() { SsdpInit(); ts.add( - TEST, 30000, [&](void*) { - //pm.info(printMemoryStatus()); - - //myScenario->loop(); + TEST, 1000 * 60, [&](void*) { + pm.info(printMemoryStatus()); }, nullptr, true);