mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 14:42:18 +03:00
запустил первый сенсор в прошивке 4 той версии
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
#include "Configuration.h"
|
||||
#include "modules/IoTSensorA.h"
|
||||
|
||||
void configure(String& path) {
|
||||
std::vector<IoTSensor*> iotSensors;
|
||||
|
||||
void configure(String path) {
|
||||
File file = seekFile(path);
|
||||
file.find("[");
|
||||
while (file.available()) {
|
||||
String jsonArrayElement = file.readStringUntil('}') + "}";
|
||||
if (jsonArrayElement.startsWith(",")) {
|
||||
jsonArrayElement = jsonArrayElement.substring(1, jsonArrayElement.length()); //это нужно оптимизировать в последствии
|
||||
}
|
||||
String subtype;
|
||||
if (jsonRead(jsonArrayElement, F("subtype"), subtype)) {
|
||||
if (subtype == F("button-out")) {
|
||||
@@ -11,12 +18,13 @@ void configure(String& path) {
|
||||
} else if (subtype == F("pwm-out")) {
|
||||
//=============================
|
||||
} else if (subtype == F("analog-adc")) {
|
||||
// iotSensors.push_back(new IoTSensorAnalog(jsonArrayElement));
|
||||
mySensorAnalog = new IoTSensorA(jsonArrayElement);
|
||||
iotSensors.push_back(mySensorAnalog);
|
||||
} else {
|
||||
SerialPrint(F("E"), F("Config"), F("config.json error, type not exist"));
|
||||
SerialPrint(F("E"), F("Config"), "type not exist " + subtype);
|
||||
}
|
||||
} else {
|
||||
SerialPrint(F("E"), F("Config"), F("config.json error, type wrong or missing"));
|
||||
SerialPrint(F("E"), F("Config"), F("json error"));
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
|
||||
Reference in New Issue
Block a user