{"action":"created","issue":{"url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1100","repository_url":"https://api.github.com/repos/espressif/arduino-esp32","labels_url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1100/labels{/name}","comments_url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1100/comments","events_url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1100/events","html_url":"https://github.com/espressif/arduino-esp32/issues/1100","id":296262874,"node_id":"MDU6SXNzdWUyOTYyNjI4NzQ=","number":1100,"title":"SmartConfig fails connection - appears not saving SSID ","user":{"login":"mickeypop","id":8009588,"node_id":"MDQ6VXNlcjgwMDk1ODg=","avatar_url":"https://avatars2.githubusercontent.com/u/8009588?v=4","gravatar_id":"","url":"https://api.github.com/users/mickeypop","html_url":"https://github.com/mickeypop","followers_url":"https://api.github.com/users/mickeypop/followers","following_url":"https://api.github.com/users/mickeypop/following{/other_user}","gists_url":"https://api.github.com/users/mickeypop/gists{/gist_id}","starred_url":"https://api.github.com/users/mickeypop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mickeypop/subscriptions","organizations_url":"https://api.github.com/users/mickeypop/orgs","repos_url":"https://api.github.com/users/mickeypop/repos","events_url":"https://api.github.com/users/mickeypop/events{/privacy}","received_events_url":"https://api.github.com/users/mickeypop/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-02-12T04:17:44Z","updated_at":"2018-06-16T22:35:18Z","closed_at":"2018-02-12T05:41:59Z","author_association":"NONE","body":"### Hardware:\r\nBoard:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ESP32 Core Dev Module, Generic Modules, and ESP32-VROOM\r\nCore Installation/update date:&nbsp;&nbsp;I do git update weekly, this update 2/10/18\r\nIDE name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Arduino IDE, 1.8.5\r\nFlash Frequency:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;80Mhz\r\nUpload Speed:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;921600\r\n\r\n### Description:\r\nI may have found what is failing, but not sure how to fix this.\r\nNote the print statements between \"SmartConfig done.\" and \"Waiting for WiFi\".\r\n\r\nVerbose Log shows SSID: myplace was passed but appears not to be saving.  This is reproduced on 4 different boards.\r\n\r\nReading NVR the password is stored correctly but SSID does not seem to be saved, more so its blank.\r\nThis seems to be the fault resulting in connection failure. \r\n\r\nLike others; the \"Waiting for WiFi\" loop never exits with  AUTH_FAIL.\r\n\r\nNote i added 2 extra log statements to the _smartConfigCallback()  for better info\r\n```\r\n\t\tlog_d(\"bssid_set: %d\", sta_conf->bssid_set);\r\n\t\tlog_d(\"BSSID: %x\", sta_conf->bssid); \r\n```\r\n\t\t\r\n BASIC demo sketch with just a few prints added (indented)\r\n```\r\n#include \"WiFi.h\"\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  WiFi.mode(WIFI_AP_STA);\r\n  WiFi.beginSmartConfig();\r\n\r\n  Serial.println(\"Waiting for SmartConfig.\");\r\n  while (!WiFi.smartConfigDone()) {\r\n    delay(500);\r\n    Serial.print(\".\");\r\n  }\r\n  Serial.println(\"\");\r\n  Serial.println(\"SmartConfig done.\");\r\n\r\n\tSerial.print( \"\\n\\tREADING NVR\\n\");\r\n\tSerial.printf( \"\\tSSID = %s\\n\"   , WiFi.SSID().c_str() );\r\n\tSerial.printf( \"\\tPSK  = %s\\n\\n\" , WiFi.psk().c_str()  );\r\n\r\n  Serial.println(\"Waiting for WiFi\");\r\n\r\n  while (WiFi.status() != WL_CONNECTED) {\r\n    delay(500);\r\n    Serial.print(\".\");\r\n  }\r\n  Serial.print(\"WiFi Connected.\\nIP Address: \");\r\n  Serial.println(WiFi.localIP());\r\n}\r\nvoid loop() {\r\n}\r\n```\r\n\r\n\r\n=== Verbose Log ==============\r\n```\r\nets Jun  8 2016 00:22:57\r\n\r\nrst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)\r\nconfigsip: 0, SPIWP:0xee\r\nclk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00\r\nmode:DIO, clock div:1\r\nload:0x3fff0018,len:4\r\nload:0x3fff001c,len:956\r\nload:0x40078000,len:0\r\nload:0x40078000,len:11904\r\nentry 0x40078a3c\r\n[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 13 - AP_STOP\r\n[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 14 - AP_STACONNECTED\r\n[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 14 - AP_STACONNECTED\r\nWaiting for SmartConfig.\r\n.........[D][WiFiSTA.cpp:621] _smartConfigCallback(): Status: FIND_CHANNEL\r\n...............[D][WiFiSTA.cpp:621] _smartConfigCallback(): Status: GETTING_SSID_PSWD\r\n[D][WiFiSTA.cpp:624] _smartConfigCallback(): Type: ESPTOUCH\r\n.....[D][WiFiSTA.cpp:621] _smartConfigCallback(): Status: LINK\r\n[D][WiFiSTA.cpp:627] _smartConfigCallback(): SSID: myplace\r\n[D][WiFiSTA.cpp:629] _smartConfigCallback(): bssid_set: 131\r\n.\r\nSmartConfig done.\r\n\r\n\tREADING NVR\r\n\tSSID = \r\n\tPSK  = J************e\r\n\r\n\tWaiting for WiFi\r\n....[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 5 - STA_DISCONNECTED\r\n[W][WiFiGeneric.cpp:270] _eventCallback(): Reason: 201 - AUTH_FAIL\r\n..........................\r\n```\r\n\r\nMy modified WiFiSTAClass::_smartConfigCallback( )\r\n```\r\nvoid WiFiSTAClass::_smartConfigCallback(uint32_t st, void* result) {\r\n    smartconfig_status_t status = (smartconfig_status_t) st;\r\n    log_d(\"Status: %s\", sc_status_strings[st % 5]);\r\n    if (status == SC_STATUS_GETTING_SSID_PSWD) {\r\n        smartconfig_type_t * type = (smartconfig_type_t *)result;\r\n        log_d(\"Type: %s\", sc_type_strings[*type % 3]);\r\n    } else if (status == SC_STATUS_LINK) {\r\n        wifi_sta_config_t *sta_conf = reinterpret_cast<wifi_sta_config_t *>(result);\r\n        log_d(\"SSID: %s\", (char *)(sta_conf->ssid));\r\n\t\t\r\n\t\tlog_d(\"bssid_set: %d\", sta_conf->bssid_set);\r\n\t\tlog_d(\"BSSID: %x\", sta_conf->bssid);\r\n\t\t\r\n        esp_wifi_set_config(WIFI_IF_STA, (wifi_config_t *)sta_conf);\r\n        esp_wifi_connect();\r\n        _smartConfigDone = true;\r\n    } else if (status == SC_STATUS_LINK_OVER) {\r\n        if(result){\r\n            ip4_addr_t * ip = (ip4_addr_t *)result;\r\n            log_d(\"Sender IP: \" IPSTR, IP2STR(ip));\r\n        }\r\n        WiFi.stopSmartConfig();\r\n    }\r\n}\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/espressif/arduino-esp32/issues/comments/397842536","html_url":"https://github.com/espressif/arduino-esp32/issues/1100#issuecomment-397842536","issue_url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1100","id":397842536,"node_id":"MDEyOklzc3VlQ29tbWVudDM5Nzg0MjUzNg==","user":{"login":"mickeypop","id":8009588,"node_id":"MDQ6VXNlcjgwMDk1ODg=","avatar_url":"https://avatars2.githubusercontent.com/u/8009588?v=4","gravatar_id":"","url":"https://api.github.com/users/mickeypop","html_url":"https://github.com/mickeypop","followers_url":"https://api.github.com/users/mickeypop/followers","following_url":"https://api.github.com/users/mickeypop/following{/other_user}","gists_url":"https://api.github.com/users/mickeypop/gists{/gist_id}","starred_url":"https://api.github.com/users/mickeypop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mickeypop/subscriptions","organizations_url":"https://api.github.com/users/mickeypop/orgs","repos_url":"https://api.github.com/users/mickeypop/repos","events_url":"https://api.github.com/users/mickeypop/events{/privacy}","received_events_url":"https://api.github.com/users/mickeypop/received_events","type":"User","site_admin":false},"created_at":"2018-06-16T22:35:18Z","updated_at":"2018-06-16T22:35:18Z","author_association":"NONE","body":"**vinot**\r\nGlad you like it\r\n\r\nYou want to see what it can do?\r\n\r\nWhile it is running unplug your router and watch.\r\nIn about 15-30 seconds it will see the wifi is down.\r\n\r\nPlug it back in and in about 40 seconds it will reconnect automatically. and be back on line.\r\n  \r\n\r\n"}}
{"actor":{"display_login":"mickeypop"}}