fix indentation
This commit is contained in:
parent
3d7a089e0e
commit
bf61e4c937
@ -191,7 +191,6 @@ void setup() {
|
|||||||
// start ticker with 0.5 because we start in AP mode and try to connect
|
// start ticker with 0.5 because we start in AP mode and try to connect
|
||||||
ticker.attach(0.6, toggle_led);
|
ticker.attach(0.6, toggle_led);
|
||||||
|
|
||||||
|
|
||||||
//clean FS, for testing
|
//clean FS, for testing
|
||||||
//SPIFFS.format();
|
//SPIFFS.format();
|
||||||
|
|
||||||
@ -209,18 +208,15 @@ void setup() {
|
|||||||
size_t size = configFile.size();
|
size_t size = configFile.size();
|
||||||
// Allocate a buffer to store contents of the file.
|
// Allocate a buffer to store contents of the file.
|
||||||
std::unique_ptr<char[]> buf(new char[size]);
|
std::unique_ptr<char[]> buf(new char[size]);
|
||||||
|
|
||||||
configFile.readBytes(buf.get(), size);
|
configFile.readBytes(buf.get(), size);
|
||||||
DynamicJsonBuffer jsonBuffer;
|
DynamicJsonBuffer jsonBuffer;
|
||||||
JsonObject& json = jsonBuffer.parseObject(buf.get());
|
JsonObject& json = jsonBuffer.parseObject(buf.get());
|
||||||
json.printTo(Serial);
|
json.printTo(Serial);
|
||||||
if (json.success()) {
|
if (json.success()) {
|
||||||
Serial.println("\nparsed json");
|
Serial.println("\nparsed json");
|
||||||
|
|
||||||
strcpy(mqtt_server, json["mqtt_server"]);
|
strcpy(mqtt_server, json["mqtt_server"]);
|
||||||
strcpy(mqtt_port, json["mqtt_port"]);
|
strcpy(mqtt_port, json["mqtt_port"]);
|
||||||
strcpy(mqtt_topic, json["mqtt_topic"]);
|
strcpy(mqtt_topic, json["mqtt_topic"]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Serial.println("failed to load json config");
|
Serial.println("failed to load json config");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user