mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-15 13:08:21 +01:00
save whole config file
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef __WEB_CONFIG_PLUGIN_H__
|
||||
#define __WEB_CONFIG_PLUGIN_H__
|
||||
|
||||
#include <FS.h>
|
||||
#include "TaskSchedulerDeclarations.h"
|
||||
#include "ArduinoOTA.h"
|
||||
#include "MeshNet.h"
|
||||
@@ -37,10 +38,17 @@ class WebConfigPlugin : public Plugin {
|
||||
Serial.println("POST /config");
|
||||
if(request->hasParam("config", true)) {
|
||||
String inStr = request->getParam("config", true)->value();
|
||||
MeshSprocketConfig config;
|
||||
config.fromJsonString(inStr);
|
||||
Serial.println(config.toJsonString());
|
||||
config.saveFile("/config.json");
|
||||
//MeshSprocketConfig config;
|
||||
//config.fromJsonString(inStr);
|
||||
//Serial.println(config.toJsonString());
|
||||
//config.saveFile("/config.json");
|
||||
File f = SPIFFS.open("/config.json", "w");
|
||||
if (!f) {
|
||||
Serial.println("file open for write failed");
|
||||
}
|
||||
Serial.println("====== Writing to SPIFFS file =========");
|
||||
f.print(inStr);
|
||||
f.close();
|
||||
}
|
||||
request->redirect("/");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user