 
     if (startAp)
     {
-      WiFi.disconnect();
+      WiFi.disconnect(true);
       setupWifiApMode();
     }
     else

      WiFi.softAPdisconnect(true);
      setupWifiConnect();
    }

  }
  else

  IPAddress NMask(255, 255, 255, 0);
  WiFi.softAPConfig(Ip, Ip, NMask);
  WiFi.softAP(ssidAP, pwd);
  DnsServer.setErrorReplyCode(DNSReplyCode::NoError);
  DnsServer.start(DNS_PORT, "*", Ip);

  Serial.println("AP active");
  Serial.print("SSID: ");
