{"action":"created","issue":{"url":"https://api.github.com/repos/espressif/esp-idf/issues/738","repository_url":"https://api.github.com/repos/espressif/esp-idf","labels_url":"https://api.github.com/repos/espressif/esp-idf/issues/738/labels{/name}","comments_url":"https://api.github.com/repos/espressif/esp-idf/issues/738/comments","events_url":"https://api.github.com/repos/espressif/esp-idf/issues/738/events","html_url":"https://github.com/espressif/esp-idf/issues/738","id":239008562,"number":738,"title":"WiFi fails to reconnect after AP reappears","user":{"login":"rojer","id":531307,"avatar_url":"https://avatars2.githubusercontent.com/u/531307?v=3","gravatar_id":"","url":"https://api.github.com/users/rojer","html_url":"https://github.com/rojer","followers_url":"https://api.github.com/users/rojer/followers","following_url":"https://api.github.com/users/rojer/following{/other_user}","gists_url":"https://api.github.com/users/rojer/gists{/gist_id}","starred_url":"https://api.github.com/users/rojer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rojer/subscriptions","organizations_url":"https://api.github.com/users/rojer/orgs","repos_url":"https://api.github.com/users/rojer/repos","events_url":"https://api.github.com/users/rojer/events{/privacy}","received_events_url":"https://api.github.com/users/rojer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-27T23:07:46Z","updated_at":"2017-06-27T23:09:59Z","closed_at":null,"body":"This seems so blindingly obvious, that I seriously doubt it's a bug, maybe API usage issue, but anyway.\r\nESP32 fails to reconnect to AP after it goes away and comes back.\r\nMy code invoked `wifi_connect()` immediately on getting `SYSTEM_EVENT_STA_DISCONNECTED` (for any reason), but it just sits there, in a reason 201 loop:\r\n\r\n```\r\n[Jun 27 23:51:06.901] mgos_wifi_set_mode   WiFi mode: STA\r\n[Jun 27 23:51:06.907] E (4042) wifi: esp_wifi_set_mode 774 wifi is not init\r\n[Jun 27 23:51:06.932] I (4042) wifi: wifi firmware version: bf86460\r\n[Jun 27 23:51:06.932] I (4052) wifi: config NVS flash: enabled\r\n[Jun 27 23:51:06.932] I (4052) wifi: config nano formating: disabled\r\n[Jun 27 23:51:06.932] I (4062) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE\r\n[Jun 27 23:51:06.932] I (4062) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE\r\n[Jun 27 23:51:06.945] I (4072) wifi: Init dynamic tx buffer num: 32\r\n[Jun 27 23:51:06.951] I (4082) wifi: Init dynamic rx buffer num: 64\r\n[Jun 27 23:51:06.958] I (4092) wifi: wifi driver task: 3ffbd7d0, prio:23, stack:4096\r\n[Jun 27 23:51:06.969] I (4102) wifi: Init static rx buffer num: 10\r\n[Jun 27 23:51:06.969] I (4102) wifi: Init dynamic rx buffer num: 0\r\n[Jun 27 23:51:06.974] I (4112) wifi: Init rx ampdu len mblock:7\r\n[Jun 27 23:51:06.981] I (4112) wifi: Init lldesc rx ampdu entry mblock:4\r\n[Jun 27 23:51:06.989] I (4122) wifi: wifi power manager task: 0x3ffd022c prio: 21 stack: 2560\r\n[Jun 27 23:51:06.996] E (4132) wifi: esp_wifi_connect 816 wifi not start\r\n[Jun 27 23:51:07.004] I (4132) wifi: wifi timer task: 3ffd12b0, prio:22, stack:3584\r\n[Jun 27 23:51:07.034] I (4162) phy: phy_version: 355.1, 59464c5, Jun 14 2017, 20:25:06, 0, 0\r\n[Jun 27 23:51:07.034] I (4162) wifi: mode : sta (24:0a:c4:05:6b:8c)\r\n[Jun 27 23:51:07.039] event_handler        event: 2\r\n[Jun 27 23:51:07.047] mgos_wifi_setup_sta  WiFi STA: Connecting to 10000_Internets\r\n...\r\n[Jun 27 23:51:08.377] I (5512) wifi: n:11 0, o:1 0, ap:255 255, sta:11 0, prof:1\r\n[Jun 27 23:51:09.228] I (6362) wifi: state: init -> auth (b0)\r\n[Jun 27 23:51:09.274] blink_timer_cb       Tock\r\n[Jun 27 23:51:09.343] I (6482) wifi: state: auth -> assoc (0)\r\n[Jun 27 23:51:09.426] I (6562) wifi: state: assoc -> run (10)\r\n[Jun 27 23:51:09.482] I (6612) wifi: connected with 10000_Internets, channel 11\r\n[Jun 27 23:51:09.488] mgos_wifi_on_change_ Wifi: connected\r\n[Jun 27 23:51:09.540] I (6662) event: ip: 192.168.43.99, mask: 255.255.255.0, gw: 192.168.43.1\r\n[Jun 27 23:51:09.540] mgos_wifi_on_change_ WiFi: ready, IP 192.168.43.99, DNS 192.168.43.1\r\n```\r\nso far so good. now i turn off the AP:\r\n```\r\n[Jun 27 23:51:22.981] I (20112) wifi: state: run -> auth (3a0)\r\n[Jun 27 23:51:22.988] I (20122) wifi: n:11 0, o:11 0, ap:255 255, sta:11 0, prof:1\r\n[Jun 27 23:51:22.996] esp32_wifi_ev        WiFi STA: disconnected, reason 3; reconnecting\r\n[Jun 27 23:51:23.004] I (20142) wifi: pm stop, total sleep time: 0/3568492\r\n[Jun 27 23:51:23.004] \r\n[Jun 27 23:51:23.009] mgos_wifi_on_change_ Wifi: disconnected\r\n[Jun 27 23:51:24.697] esp32_wifi_ev        WiFi STA: disconnected, reason 201; reconnecting\r\n[Jun 27 23:51:24.704] mgos_wifi_on_change_ Wifi: disconnected\r\n[Jun 27 23:51:26.396] esp32_wifi_ev        WiFi STA: disconnected, reason 201; reconnecting\r\n[Jun 27 23:51:26.403] mgos_wifi_on_change_ Wifi: disconnected\r\n```\r\nwhen i turn the AP back on, there's no reaction from the ESP, it just keeps looping, no new wifi messages appear.\r\n\r\nso, the question is: is calling `wifi_connect()` the right thing to do if i want station to stay connected with the same configuration?"},"comment":{"url":"https://api.github.com/repos/espressif/esp-idf/issues/comments/311511219","html_url":"https://github.com/espressif/esp-idf/issues/738#issuecomment-311511219","issue_url":"https://api.github.com/repos/espressif/esp-idf/issues/738","id":311511219,"user":{"login":"rojer","id":531307,"avatar_url":"https://avatars2.githubusercontent.com/u/531307?v=3","gravatar_id":"","url":"https://api.github.com/users/rojer","html_url":"https://github.com/rojer","followers_url":"https://api.github.com/users/rojer/followers","following_url":"https://api.github.com/users/rojer/following{/other_user}","gists_url":"https://api.github.com/users/rojer/gists{/gist_id}","starred_url":"https://api.github.com/users/rojer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rojer/subscriptions","organizations_url":"https://api.github.com/users/rojer/orgs","repos_url":"https://api.github.com/users/rojer/repos","events_url":"https://api.github.com/users/rojer/events{/privacy}","received_events_url":"https://api.github.com/users/rojer/received_events","type":"User","site_admin":false},"created_at":"2017-06-27T23:09:59Z","updated_at":"2017-06-27T23:09:59Z","body":"i should add that this used to work way back when, i remember the device deifnitely reconnected to AP after it reappeared. i had to add this explicit `esp_wifi_connect()` call, but otherwise it worked."}}
{"actor":{"display_login":"rojer"}}