|
@@ -27,13 +27,7 @@ static const char PAGE_CONFIG[] PROGMEM = R"(
|
|
|
"value": "<hr style=\"height:1px;border-width:0;color:gray;background-color:#52a6ed\">",
|
|
|
"posterior": "par"
|
|
|
},
|
|
|
- {
|
|
|
- "name": "HOSTNAME",
|
|
|
- "type": "ACInput",
|
|
|
- "label": "Hostname",
|
|
|
- "placeholder": "This area accepts hostname patterns",
|
|
|
- "pattern": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$"
|
|
|
- },
|
|
|
+
|
|
|
{
|
|
|
"name": "OSC_SECTION_TEXT",
|
|
|
"type": "ACText",
|
|
@@ -63,6 +57,14 @@ static const char PAGE_CONFIG[] PROGMEM = R"(
|
|
|
"pattern": "\\d*"
|
|
|
},
|
|
|
{
|
|
|
+ "name": "HOSTNAME",
|
|
|
+ "type": "ACInput",
|
|
|
+ "label": "Hostname",
|
|
|
+ "apply": "text",
|
|
|
+ "placeholder": "This area accepts hostname patterns",
|
|
|
+ "pattern": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$"
|
|
|
+ },
|
|
|
+ {
|
|
|
"name": "hr2",
|
|
|
"type": "ACElement",
|
|
|
"value": "<hr style=\"height:1px;border-width:0;color:gray;background-color:#52a6ed\">",
|
|
@@ -121,31 +123,7 @@ AutoConnectConfig config;
|
|
|
AutoConnectAux configAux;
|
|
|
AutoConnectAux saveAux;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-void setup_wifimgr(void) {
|
|
|
-
|
|
|
- server.on("/", []() {
|
|
|
- String content = "<head> <meta http-equiv=\"refresh\" content=\"0; URL=/config\" /></head>";
|
|
|
- content += AUTOCONNECT_LINK(COG_24);
|
|
|
- server.send(200, "text/html", content);
|
|
|
- });
|
|
|
-
|
|
|
- server.on("/reset", []() {
|
|
|
- String content = "<head> <meta http-equiv=\"refresh\" content=\"15; URL=/config\" /></head>";
|
|
|
- content += "waiting 15s for sensor to reboot";
|
|
|
- server.send(200, "text/html", content);
|
|
|
- delay(100);
|
|
|
- ESP.restart();
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- configAux.load(FPSTR(PAGE_CONFIG));
|
|
|
- configAux.on([] (AutoConnectAux& aux, PageArgument& arg) {
|
|
|
+String loadAux_cb (AutoConnectAux& aux, PageArgument& arg) {
|
|
|
if (portal.where() == "/config") {
|
|
|
|
|
|
|
|
@@ -160,10 +138,10 @@ void setup_wifimgr(void) {
|
|
|
FlashFS.end();
|
|
|
}
|
|
|
return String();
|
|
|
- });
|
|
|
+ }
|
|
|
|
|
|
- saveAux.load(FPSTR(PAGE_SAVE));
|
|
|
- saveAux.on([] (AutoConnectAux& aux, PageArgument& arg) {
|
|
|
+
|
|
|
+String saveAux_cb (AutoConnectAux& aux, PageArgument& arg) {
|
|
|
|
|
|
|
|
|
|
|
@@ -195,8 +173,37 @@ void setup_wifimgr(void) {
|
|
|
}
|
|
|
FlashFS.end();
|
|
|
return String();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+void setup_wifimgr(void) {
|
|
|
+
|
|
|
+ server.on("/", []() {
|
|
|
+ String content = "<head> <meta http-equiv=\"refresh\" content=\"0; URL=/config\" /></head>";
|
|
|
+ content += AUTOCONNECT_LINK(COG_24);
|
|
|
+ server.send(200, "text/html", content);
|
|
|
});
|
|
|
|
|
|
+ server.on("/reset", []() {
|
|
|
+ String content = "<head> <meta http-equiv=\"refresh\" content=\"15; URL=/config\" /></head>";
|
|
|
+ content += "waiting 15s for sensor to reboot";
|
|
|
+ server.send(200, "text/html", content);
|
|
|
+ delay(100);
|
|
|
+ ESP.restart();
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ configAux.load(FPSTR(PAGE_CONFIG));
|
|
|
+ configAux.on(loadAux_cb);
|
|
|
+
|
|
|
+ saveAux.load(FPSTR(PAGE_SAVE));
|
|
|
+ saveAux.on(saveAux_cb);
|
|
|
+
|
|
|
|
|
|
FlashFS.begin();
|
|
|
File param = FlashFS.open(CONFIG_FILE, "r");
|
|
@@ -214,4 +221,5 @@ void setup_wifimgr(void) {
|
|
|
config.hostName = hostname;
|
|
|
portal.config(config);
|
|
|
portal.begin();
|
|
|
+
|
|
|
}
|