{"action":"created","comment":{"url":"https://api.github.com/repos/esp8266/Arduino/pulls/comments/223898584","pull_request_review_id":163139897,"id":223898584,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzg5ODU4NA==","diff_hunk":"@@ -369,12 +369,14 @@ bool ESP8266WiFiSTAClass::getAutoReconnect() {\n  * returns the status reached or disconnect if STA is off\r\n  * @return wl_status_t\r\n  */\r\n-uint8_t ESP8266WiFiSTAClass::waitForConnectResult() {\r\n+uint8_t ESP8266WiFiSTAClass::waitForConnectResult(uint32_t wait_secs) {\r\n     //1 and 3 have STA enabled\r\n     if((wifi_get_opmode() & 1) == 0) {\r\n         return WL_DISCONNECTED;\r\n     }\r\n-    while(status() == WL_DISCONNECTED) {\r\n+    int i = 0; \r\n+    int try_times = wait_secs*10;\r\n+    while((!status() || status() >= WL_DISCONNECTED) && ((wait_secs==0)? true : (i++ < try_times))) {\r","path":"libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp","position":13,"original_position":13,"commit_id":"cba45eab4d487a016868eb71ae5db08d48e15aaa","original_commit_id":"cba45eab4d487a016868eb71ae5db08d48e15aaa","user":{"login":"yoursunny","id":1141273,"node_id":"MDQ6VXNlcjExNDEyNzM=","avatar_url":"https://avatars2.githubusercontent.com/u/1141273?v=4","gravatar_id":"","url":"https://api.github.com/users/yoursunny","html_url":"https://github.com/yoursunny","followers_url":"https://api.github.com/users/yoursunny/followers","following_url":"https://api.github.com/users/yoursunny/following{/other_user}","gists_url":"https://api.github.com/users/yoursunny/gists{/gist_id}","starred_url":"https://api.github.com/users/yoursunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoursunny/subscriptions","organizations_url":"https://api.github.com/users/yoursunny/orgs","repos_url":"https://api.github.com/users/yoursunny/repos","events_url":"https://api.github.com/users/yoursunny/events{/privacy}","received_events_url":"https://api.github.com/users/yoursunny/received_events","type":"User","site_admin":false},"body":"This line is difficult to read.\r\n* `!status()` tests whether the status is non-zero, but status is an enum and it’s unobvious which value is zero.\r\n* The part after && is really complicated.\r\n\r\nHow about:\r\n```\r\nfor (int timeout = wait_secs * 10; wait_secs == 0 || timeout > 0; --timeout) {\r\n  auto st = status();\r\n  switch (st) {\r\n    case WL_CONNECTED:\r\n    case WL_NO_SSID_AVAIL:\r\n    case WL_CONNECT_FAILED:\r\n      return st;\r\n    default:\r\n      delay(100);\r\n      break;\r\n  }\r\n}\r\n\r\n  ","created_at":"2018-10-09T23:44:18Z","updated_at":"2018-10-09T23:44:19Z","html_url":"https://github.com/esp8266/Arduino/pull/4985#discussion_r223898584","pull_request_url":"https://api.github.com/repos/esp8266/Arduino/pulls/4985","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/esp8266/Arduino/pulls/comments/223898584"},"html":{"href":"https://github.com/esp8266/Arduino/pull/4985#discussion_r223898584"},"pull_request":{"href":"https://api.github.com/repos/esp8266/Arduino/pulls/4985"}}},"pull_request":{"url":"https://api.github.com/repos/esp8266/Arduino/pulls/4985","id":204709496,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NzA5NDk2","html_url":"https://github.com/esp8266/Arduino/pull/4985","diff_url":"https://github.com/esp8266/Arduino/pull/4985.diff","patch_url":"https://github.com/esp8266/Arduino/pull/4985.patch","issue_url":"https://api.github.com/repos/esp8266/Arduino/issues/4985","number":4985,"state":"open","locked":false,"title":"Update ESP8266WiFiSTAClass::waitForConnectResult()  for the same behavior with ESP32.","user":{"login":"ShinDaiIchi","id":28639594,"node_id":"MDQ6VXNlcjI4NjM5NTk0","avatar_url":"https://avatars0.githubusercontent.com/u/28639594?v=4","gravatar_id":"","url":"https://api.github.com/users/ShinDaiIchi","html_url":"https://github.com/ShinDaiIchi","followers_url":"https://api.github.com/users/ShinDaiIchi/followers","following_url":"https://api.github.com/users/ShinDaiIchi/following{/other_user}","gists_url":"https://api.github.com/users/ShinDaiIchi/gists{/gist_id}","starred_url":"https://api.github.com/users/ShinDaiIchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShinDaiIchi/subscriptions","organizations_url":"https://api.github.com/users/ShinDaiIchi/orgs","repos_url":"https://api.github.com/users/ShinDaiIchi/repos","events_url":"https://api.github.com/users/ShinDaiIchi/events{/privacy}","received_events_url":"https://api.github.com/users/ShinDaiIchi/received_events","type":"User","site_admin":false},"body":"Add  counter i for trying WIFi-connection 100 times","created_at":"2018-07-30T06:51:46Z","updated_at":"2018-10-09T23:44:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a16fb39d71ccb3e598bc73a6631add18fe4dc16d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/esp8266/Arduino/pulls/4985/commits","review_comments_url":"https://api.github.com/repos/esp8266/Arduino/pulls/4985/comments","review_comment_url":"https://api.github.com/repos/esp8266/Arduino/pulls/comments{/number}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/4985/comments","statuses_url":"https://api.github.com/repos/esp8266/Arduino/statuses/cba45eab4d487a016868eb71ae5db08d48e15aaa","head":{"label":"ShinDaiIchi:master","ref":"master","sha":"cba45eab4d487a016868eb71ae5db08d48e15aaa","user":{"login":"ShinDaiIchi","id":28639594,"node_id":"MDQ6VXNlcjI4NjM5NTk0","avatar_url":"https://avatars0.githubusercontent.com/u/28639594?v=4","gravatar_id":"","url":"https://api.github.com/users/ShinDaiIchi","html_url":"https://github.com/ShinDaiIchi","followers_url":"https://api.github.com/users/ShinDaiIchi/followers","following_url":"https://api.github.com/users/ShinDaiIchi/following{/other_user}","gists_url":"https://api.github.com/users/ShinDaiIchi/gists{/gist_id}","starred_url":"https://api.github.com/users/ShinDaiIchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShinDaiIchi/subscriptions","organizations_url":"https://api.github.com/users/ShinDaiIchi/orgs","repos_url":"https://api.github.com/users/ShinDaiIchi/repos","events_url":"https://api.github.com/users/ShinDaiIchi/events{/privacy}","received_events_url":"https://api.github.com/users/ShinDaiIchi/received_events","type":"User","site_admin":false},"repo":{"id":142835954,"node_id":"MDEwOlJlcG9zaXRvcnkxNDI4MzU5NTQ=","name":"Arduino","full_name":"ShinDaiIchi/Arduino","private":false,"owner":{"login":"ShinDaiIchi","id":28639594,"node_id":"MDQ6VXNlcjI4NjM5NTk0","avatar_url":"https://avatars0.githubusercontent.com/u/28639594?v=4","gravatar_id":"","url":"https://api.github.com/users/ShinDaiIchi","html_url":"https://github.com/ShinDaiIchi","followers_url":"https://api.github.com/users/ShinDaiIchi/followers","following_url":"https://api.github.com/users/ShinDaiIchi/following{/other_user}","gists_url":"https://api.github.com/users/ShinDaiIchi/gists{/gist_id}","starred_url":"https://api.github.com/users/ShinDaiIchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShinDaiIchi/subscriptions","organizations_url":"https://api.github.com/users/ShinDaiIchi/orgs","repos_url":"https://api.github.com/users/ShinDaiIchi/repos","events_url":"https://api.github.com/users/ShinDaiIchi/events{/privacy}","received_events_url":"https://api.github.com/users/ShinDaiIchi/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ShinDaiIchi/Arduino","description":"ESP8266 core for Arduino","fork":true,"url":"https://api.github.com/repos/ShinDaiIchi/Arduino","forks_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/forks","keys_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/teams","hooks_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/hooks","issue_events_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/issues/events{/number}","events_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/events","assignees_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/assignees{/user}","branches_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/branches{/branch}","tags_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/tags","blobs_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/git/refs{/sha}","trees_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/statuses/{sha}","languages_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/languages","stargazers_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/stargazers","contributors_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/contributors","subscribers_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/subscribers","subscription_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/subscription","commits_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/commits{/sha}","git_commits_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/git/commits{/sha}","comments_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/comments{/number}","issue_comment_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/issues/comments{/number}","contents_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/contents/{+path}","compare_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/merges","archive_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/downloads","issues_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/issues{/number}","pulls_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/pulls{/number}","milestones_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/milestones{/number}","notifications_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/labels{/name}","releases_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/releases{/id}","deployments_url":"https://api.github.com/repos/ShinDaiIchi/Arduino/deployments","created_at":"2018-07-30T06:46:17Z","updated_at":"2018-09-19T07:33:34Z","pushed_at":"2018-09-19T07:33:19Z","git_url":"git://github.com/ShinDaiIchi/Arduino.git","ssh_url":"git@github.com:ShinDaiIchi/Arduino.git","clone_url":"https://github.com/ShinDaiIchi/Arduino.git","svn_url":"https://github.com/ShinDaiIchi/Arduino","homepage":"","size":47884,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"lgpl-2.1","name":"GNU Lesser General Public License v2.1","spdx_id":"LGPL-2.1","url":"https://api.github.com/licenses/lgpl-2.1","node_id":"MDc6TGljZW5zZTEx"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"esp8266:master","ref":"master","sha":"1a44f79a9e26ebb72900caef8e03a2b7df78724d","user":{"login":"esp8266","id":8943775,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg5NDM3NzU=","avatar_url":"https://avatars1.githubusercontent.com/u/8943775?v=4","gravatar_id":"","url":"https://api.github.com/users/esp8266","html_url":"https://github.com/esp8266","followers_url":"https://api.github.com/users/esp8266/followers","following_url":"https://api.github.com/users/esp8266/following{/other_user}","gists_url":"https://api.github.com/users/esp8266/gists{/gist_id}","starred_url":"https://api.github.com/users/esp8266/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esp8266/subscriptions","organizations_url":"https://api.github.com/users/esp8266/orgs","repos_url":"https://api.github.com/users/esp8266/repos","events_url":"https://api.github.com/users/esp8266/events{/privacy}","received_events_url":"https://api.github.com/users/esp8266/received_events","type":"Organization","site_admin":false},"repo":{"id":32969220,"node_id":"MDEwOlJlcG9zaXRvcnkzMjk2OTIyMA==","name":"Arduino","full_name":"esp8266/Arduino","private":false,"owner":{"login":"esp8266","id":8943775,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg5NDM3NzU=","avatar_url":"https://avatars1.githubusercontent.com/u/8943775?v=4","gravatar_id":"","url":"https://api.github.com/users/esp8266","html_url":"https://github.com/esp8266","followers_url":"https://api.github.com/users/esp8266/followers","following_url":"https://api.github.com/users/esp8266/following{/other_user}","gists_url":"https://api.github.com/users/esp8266/gists{/gist_id}","starred_url":"https://api.github.com/users/esp8266/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esp8266/subscriptions","organizations_url":"https://api.github.com/users/esp8266/orgs","repos_url":"https://api.github.com/users/esp8266/repos","events_url":"https://api.github.com/users/esp8266/events{/privacy}","received_events_url":"https://api.github.com/users/esp8266/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/esp8266/Arduino","description":"ESP8266 core for Arduino","fork":false,"url":"https://api.github.com/repos/esp8266/Arduino","forks_url":"https://api.github.com/repos/esp8266/Arduino/forks","keys_url":"https://api.github.com/repos/esp8266/Arduino/keys{/key_id}","collaborators_url":"https://api.github.com/repos/esp8266/Arduino/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/esp8266/Arduino/teams","hooks_url":"https://api.github.com/repos/esp8266/Arduino/hooks","issue_events_url":"https://api.github.com/repos/esp8266/Arduino/issues/events{/number}","events_url":"https://api.github.com/repos/esp8266/Arduino/events","assignees_url":"https://api.github.com/repos/esp8266/Arduino/assignees{/user}","branches_url":"https://api.github.com/repos/esp8266/Arduino/branches{/branch}","tags_url":"https://api.github.com/repos/esp8266/Arduino/tags","blobs_url":"https://api.github.com/repos/esp8266/Arduino/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/esp8266/Arduino/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/esp8266/Arduino/git/refs{/sha}","trees_url":"https://api.github.com/repos/esp8266/Arduino/git/trees{/sha}","statuses_url":"https://api.github.com/repos/esp8266/Arduino/statuses/{sha}","languages_url":"https://api.github.com/repos/esp8266/Arduino/languages","stargazers_url":"https://api.github.com/repos/esp8266/Arduino/stargazers","contributors_url":"https://api.github.com/repos/esp8266/Arduino/contributors","subscribers_url":"https://api.github.com/repos/esp8266/Arduino/subscribers","subscription_url":"https://api.github.com/repos/esp8266/Arduino/subscription","commits_url":"https://api.github.com/repos/esp8266/Arduino/commits{/sha}","git_commits_url":"https://api.github.com/repos/esp8266/Arduino/git/commits{/sha}","comments_url":"https://api.github.com/repos/esp8266/Arduino/comments{/number}","issue_comment_url":"https://api.github.com/repos/esp8266/Arduino/issues/comments{/number}","contents_url":"https://api.github.com/repos/esp8266/Arduino/contents/{+path}","compare_url":"https://api.github.com/repos/esp8266/Arduino/compare/{base}...{head}","merges_url":"https://api.github.com/repos/esp8266/Arduino/merges","archive_url":"https://api.github.com/repos/esp8266/Arduino/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/esp8266/Arduino/downloads","issues_url":"https://api.github.com/repos/esp8266/Arduino/issues{/number}","pulls_url":"https://api.github.com/repos/esp8266/Arduino/pulls{/number}","milestones_url":"https://api.github.com/repos/esp8266/Arduino/milestones{/number}","notifications_url":"https://api.github.com/repos/esp8266/Arduino/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/esp8266/Arduino/labels{/name}","releases_url":"https://api.github.com/repos/esp8266/Arduino/releases{/id}","deployments_url":"https://api.github.com/repos/esp8266/Arduino/deployments","created_at":"2015-03-27T05:22:06Z","updated_at":"2018-10-09T20:43:54Z","pushed_at":"2018-10-09T23:42:20Z","git_url":"git://github.com/esp8266/Arduino.git","ssh_url":"git@github.com:esp8266/Arduino.git","clone_url":"https://github.com/esp8266/Arduino.git","svn_url":"https://github.com/esp8266/Arduino","homepage":"","size":49596,"stargazers_count":8069,"watchers_count":8069,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5394,"mirror_url":null,"archived":false,"open_issues_count":544,"license":{"key":"lgpl-2.1","name":"GNU Lesser General Public License v2.1","spdx_id":"LGPL-2.1","url":"https://api.github.com/licenses/lgpl-2.1","node_id":"MDc6TGljZW5zZTEx"},"forks":5394,"open_issues":544,"watchers":8069,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/esp8266/Arduino/pulls/4985"},"html":{"href":"https://github.com/esp8266/Arduino/pull/4985"},"issue":{"href":"https://api.github.com/repos/esp8266/Arduino/issues/4985"},"comments":{"href":"https://api.github.com/repos/esp8266/Arduino/issues/4985/comments"},"review_comments":{"href":"https://api.github.com/repos/esp8266/Arduino/pulls/4985/comments"},"review_comment":{"href":"https://api.github.com/repos/esp8266/Arduino/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/esp8266/Arduino/pulls/4985/commits"},"statuses":{"href":"https://api.github.com/repos/esp8266/Arduino/statuses/cba45eab4d487a016868eb71ae5db08d48e15aaa"}},"author_association":"NONE"}}
{"actor":{"display_login":"yoursunny"}}