Просмотр исходного кода

Fix misleading flow config allocation logs

SybexXx 1 день назад
Родитель
Сommit
aebfbfaad8
1 измененных файлов с 12 добавлено и 7 удалено
  1. 12 7
      code/components/jomjol_flowcontroll/ClassFlowControll.cpp

+ 12 - 7
code/components/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -304,10 +304,14 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
         flowpostprocessing = (ClassFlowPostProcessing*) cfc;
     }
 
+    const std::string normalizedType = toUpper(_type);
+    const bool disabledSection = !_type.empty() && (_type[0] == ';');
+
     if (cfc) {
         FlowControll.push_back(cfc);
-    } else if (_type != "[AUTOTIMER]" && _type != "[DATALOGGING]" &&
-               _type != "[DEBUG]" && _type != "[SYSTEM]") {
+    } else if (!disabledSection &&
+               normalizedType != "[AUTOTIMER]" && normalizedType != "[DATALOGGING]" &&
+               normalizedType != "[DEBUG]" && normalizedType != "[SYSTEM]") {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Unable to allocate flow component " + _type);
     }
 
@@ -365,11 +369,12 @@ void ClassFlowControll::InitFlow(std::string config)
             cfc->ReadParameter(pFile, line);
         }
         else {
-            line = "";
-		
-            if (fgets(zw, 1024, pFile) && !feof(pFile)) {
-                ESP_LOGD(TAG, "Read: %s", zw);
-                line = std::string(zw);
+            // This controller only instantiates flow steps. Other or disabled
+            // config sections (for example GPIO and commented-out integrations)
+            // are handled elsewhere or intentionally inactive. Skip their whole
+            // paragraph instead of treating each key/value line as a flow name.
+            if (!this->GetNextParagraph(pFile, line)) {
+                line.clear();
             }
         }
     }