       scanResp += "]}}";
       //ETS_SPI_INTR_ENABLE();
       server.send(200, "text/plain", scanResp);
-
     });
 
     server.on("/connect", []() {
-
       newSSID_param = server.arg("essid");
       newPASSWORD_param = server.arg("passwd");
       server.send(200, "text/plain", "1");
-      WiFi.begin(newSSID_param.c_str(),newPASSWORD_param.c_str());
-      //WiFi.softAPConfig(default_IP, default_IP, IPAddress(255, 255, 255, 0));   //set default ip for AP mode
-      //WiFi.hostname(WiFi.hostname());
+      //WiFi.begin(newSSID_param.c_str(),newPASSWORD_param.c_str());
       Config.setParam("ssid", newSSID_param);
       Config.setParam("password", newPASSWORD_param);
-
+      connect_wifi = true;
     });
 
     server.on("/connstatus", []() {
-
         String ipadd = (WiFi.getMode() == 1 || WiFi.getMode() == 3) ? toStringIp(WiFi.localIP()) : toStringIp(WiFi.softAPIP());
         server.send(200, "text/plain", String("{\"url\":\"got IP address\", \"ip\":\""+ipadd+"\", \"modechange\":\"no\", \"ssid\":\""+WiFi.SSID()+"\", \"reason\":\"-\", \"status\":\""+ toStringWifiStatus(WiFi.status()) +"\"}"));
-
     });
 
 
     server.on("/setmode", []() {
-
       int newMode = server.arg("mode").toInt();
 
       switch (newMode){


  //"wifi/info" information
  server.on("/wifi/info", []() {

    //ETS_SPI_INTR_DISABLE();
    String ipadd = (WiFi.getMode() == 1 || WiFi.getMode() == 3) ? toStringIp(WiFi.localIP()) : toStringIp(WiFi.softAPIP());
    String staticadd = dhcp.equals("on") ? "0.0.0.0" : staticIP_param;
    int change = WiFi.getMode() == 1 ? 3 : 1;


bool handleFileRead(String path){
  if(path.endsWith("/")) path += "index.html";
  String contentType = getContentType(path);
  File file = SPIFFS.open(path, "r");
  size_t sent = server.streamFile(file, contentType);
  file.close();
  return true;
}

String toStringIp(IPAddress ip) {
