From d4f9069f6f440a8d5199d4328fa9bb7b453b5fdd Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <67171972+IoTManagerProject@users.noreply.github.com> Date: Fri, 14 Jan 2022 20:42:11 +0100 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=B0=20?= =?UTF-8?q?esp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/Config.h | 2 +- src/Config.cpp | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/Config.h b/include/Config.h index 96c0630e..28e326b9 100644 --- a/include/Config.h +++ b/include/Config.h @@ -1,4 +1,4 @@ #pragma once #include "Global.h" -extern void configuration(String& path); \ No newline at end of file +extern void configure(String& path); \ No newline at end of file diff --git a/src/Config.cpp b/src/Config.cpp index 0b8698e0..30244f3f 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -1,5 +1,20 @@ #include "Config.h" -void configuration(String& path) { - file = seekFile(path); +void configure(String& path) { + File file = seekFile(path); + + while (file.available()) { + String jsonArrayElement = file.readStringUntil('}') + "}"; + String value; + if (jsonRead(jsonArrayElement, F("subtype"), value)) { + if (value == F("button-out")) { + //============================= + } else if (value == F("pwm-out")) { + //============================= + } + } else { + SerialPrint(F("E"), F("System"), F("Fatal configuration error, type wrong or missing")); + } + } + file.close(); } \ No newline at end of file