image/svg+xml
ESP8266WebServer server(80);//holds the current uploadFile fsUploadFile;//SERVER INIT//list directoryserver.on("/list", HTTP_GET, handleFileList);//load editorserver.on("/edit", HTTP_GET, []() { if (!handleFileRead("/edit.htm")) { server.send(404, "text/plain", "FileNotFound"); }});//create fileserver.on("/edit", HTTP_PUT, handleFileCreate);//delete fileserver.on("/edit", HTTP_DELETE, handleFileDelete);//first callback is called after the request has ended with all parsed arguments//second callback handles file uploads at that locationserver.on("/edit", HTTP_POST, []() { server.send(200, "text/plain", "");}, handleFileUpload);//called when the url is not defined here//use it to load content from SPIFFSserver.onNotFound([]() { if (!handleFileRead(server.uri())) { server.send(404, "text/plain", "FileNotFound"); }});//get heap status, analog input value and all GPIO statuses in one json callserver.on("/all", HTTP_GET, []() { String json = "{"; json += "\"heap\":" + String(ESP.getFreeHeap()); json += ", \"analog\":" + String(analogRead(A0)); json += ", \"gpio\":" + String((uint32_t)(((GPI | GPO) & 0xFFFF) | ((GP16I & 0x01) << 16))); json += "}"; server.send(200, "text/json", json); json = String();});server.begin();
ESP8266WebServer server(80);//Add below lines for AutoConnect.AutoConnect portal(server);AutoConnectConfig config;//holds the current uploadFile fsUploadFile;//SERVER INIT//list directoryserver.on("/list", HTTP_GET, handleFileList);//load editorserver.on("/edit", HTTP_GET, []() { if (!handleFileRead("/edit.htm")) { server.send(404, "text/plain", "FileNotFound"); }});//create fileserver.on("/edit", HTTP_PUT, handleFileCreate);//delete fileserver.on("/edit", HTTP_DELETE, handleFileDelete);//first callback is called after the request has ended with all parsed arguments//second callback handles file uploads at that locationserver.on("/edit", HTTP_POST, []() { server.send(200, "text/plain", "");}, handleFileUpload);//called when the url is not defined here//use it to load content from SPIFFS//Replacement as follows to make AutoConnect recognition.portal.onNotFound([](){ if(!handleFileRead(server.uri())) { server.send(404, "text/plain", "FileNotFound"); }});//get heap status, analog input value and all GPIO statuses in one json callserver.on("/all", HTTP_GET, [](){ String json = "{"; json += "\"heap\":"+String(ESP.getFreeHeap()); json += ", \"analog\":"+String(analogRead(A0)); json += ", \"gpio\":"+String((uint32_t)(((GPI | GPO) & 0xFFFF) | ((GP16I & 0x01) << 16))); json += "}"; server.send(200, "text/json", json); json = String();});//Set menu titleconfig.title = "FSBrowser";portal.config(config);//Register AutoConnect menuportal.append("/edit", "Edit");portal.append("/list?dir=\"/\"", "List");//Replacement as follows to make AutoConnect recognition.portal.begin();
Original FSbrowser.ino (a part of code)
Modified FSbrowser.ino (a part of code)
Insert for AutoConnect menu
{
Insert for attaching the menu
{
Replace for AutoConnect
Replace for AutoConnect