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