{"action":"opened","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/5571","repository_url":"https://api.github.com/repos/esp8266/Arduino","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/5571/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/5571/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/5571/events","html_url":"https://github.com/esp8266/Arduino/issues/5571","id":395214197,"node_id":"MDU6SXNzdWUzOTUyMTQxOTc=","number":5571,"title":"Exception (9) when connecting to router while in AP","user":{"login":"llucixxeu","id":15967122,"node_id":"MDQ6VXNlcjE1OTY3MTIy","avatar_url":"https://avatars3.githubusercontent.com/u/15967122?v=4","gravatar_id":"","url":"https://api.github.com/users/llucixxeu","html_url":"https://github.com/llucixxeu","followers_url":"https://api.github.com/users/llucixxeu/followers","following_url":"https://api.github.com/users/llucixxeu/following{/other_user}","gists_url":"https://api.github.com/users/llucixxeu/gists{/gist_id}","starred_url":"https://api.github.com/users/llucixxeu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llucixxeu/subscriptions","organizations_url":"https://api.github.com/users/llucixxeu/orgs","repos_url":"https://api.github.com/users/llucixxeu/repos","events_url":"https://api.github.com/users/llucixxeu/events{/privacy}","received_events_url":"https://api.github.com/users/llucixxeu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-02T11:05:52Z","updated_at":"2019-01-02T11:05:52Z","closed_at":null,"author_association":"NONE","body":"Hello everyone, I believe that this problem may be already discussed in another topics, but, I still can't manage to make it work, so I would really appreciate some help here please.\r\nIn my sketch I start by creating a webserver over port 80, which is exposed on a local AP. On roothandle ESP scan all networks in the area and display them in a dropdown list from which you can choose and fill in the password. On formular submission, the ESP then takes SID and Password and connects to that router. \r\nWhen the connection is done, it suddenly throw Exception and wdt_reset. I've tried many things but nothing seems to work:\r\n\r\n\r\n#include <ESP8266WiFi.h>\r\n#include <ESP8266WebServer.h>\r\n\r\nchar ssid[] = \"\";\r\nchar pass[] = \"\";\r\n\r\nIPAddress timeServerIP(192, 168, 100, 99);\r\nIPAddress gateway(192, 168, 100, 1);\r\nIPAddress subnet(255, 255, 255, 0);\r\nIPAddress webServerIp(192, 168, 100, 1);\r\n\r\nESP8266WebServer server(webServerIp, 80);\r\n\r\nchar wlanList[100][100];\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  WiFi.mode(WIFI_AP_STA);\r\n  WiFi.softAP(\"ESP_CLOCK\", \"\", 1);\r\n  WiFi.softAPConfig(webServerIp, gateway, subnet);\r\n\r\n  server.on(\"/\", handleRoot);\r\n  server.on(\"/change-wlan\", changeWlan);\r\n  server.begin();\r\n}\r\n\r\nvoid scanWLAN() {\r\n  int n = WiFi.scanNetworks();\r\n  for (int i = 0; i < n; ++i) {\r\n    Serial.print(WiFi.SSID(i));\r\n    Serial.print(\" - channel: \");\r\n    Serial.print(WiFi.channel(i));\r\n    Serial.println();\r\n    WiFi.SSID(i).toCharArray(wlanList[i], WiFi.SSID(i).length() + 1);\r\n  }\r\n}\r\n\r\nvoid changeWlan() {\r\n  Serial.println(\"- change WLAN: \");\r\n  Serial.print(server.arg(\"sid\"));\r\n  if (server.arg(\"sid\") && server.arg(\"pass\")) {\r\n    server.arg(\"sid\").toCharArray(ssid, server.arg(\"sid\").length() + 1);\r\n    server.arg(\"pass\").toCharArray(ssid, server.arg(\"pass\").length() + 1);\r\n  }\r\n  server.send(200, \"text/plain\", \"connected\");\r\n  delay(1000);\r\n  // CONECTION TO ROUTER IS CALLED\r\n  connectToLan();\r\n}\r\n\r\nvoid connectToLan() {\r\n  Serial.println(\"- connecting to WLAN: \");\r\n\r\n  WiFi.begin(ssid, pass);\r\n\r\n  while (WiFi.status() != WL_CONNECTED) {\r\n    delay(1000);\r\n    Serial.print(\".\");\r\n  }\r\n}\r\n\r\nvoid handleRoot() {\r\n  Serial.println(\"- handel root request\");\r\n  // SCAN ALL NETWORKS AND LIST ON WEBPAGE\r\n  scanWLAN();\r\n  String options = \"\";\r\n  String response = \"\";\r\n  for (int i = 0; i < 30; ++i) {\r\n    options += \"<option value='\" + String(wlanList[i]) + \"'>\" + String(wlanList[i]) + \"</option>\";\r\n  }\r\n  response += String(\"<hmtl><form action='/change-wlan'>\") + \"<select name='sid'>\" + String(options) + \"</select>\" +\r\n              \"<input type='password' name='pass'>\" +\r\n              \"<input type='submit' value='Connect'>\" +\r\n              \"</form></html>\";\r\n  server.send(200, \"text/html\", response);\r\n}\r\n\r\nvoid loop() {\r\n  server.handleClient();\r\n}\r\n\r\n#######################################################################\r\nException (9):\r\nepc1=0x40202938 epc2=0x00000000 epc3=0x00000000 excvaddr=0x38393169 depc=0x00000000\r\n\r\nctx: sys \r\nsp: 3ffffdd0 end: 3fffffb0 offset: 01a0\r\n\r\n>>>stack>>>\r\n3fffff70:  4021cb48 3ffe9054 3fff46ec 40202930  \r\n3fffff80:  4021cb6e 3fffdab0 00000000 3ffee5a8  \r\n3fffff90:  3fffdc10 00000000 3fff46ec 4021fea0  \r\n3fffffa0:  40000f49 3fffdab0 3fffdab0 40000f49  \r\n<<<stack<<<\r\n\r\n ets Jan  8 2013,rst cause:2, boot mode:(1,6)\r\n\r\n\r\n ets Jan  8 2013,rst cause:4, boot mode:(1,6)\r\n\r\nwdt reset\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"llucixxeu"}}