{"action":"created","comment":{"url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/comments/178055082","pull_request_review_id":108044420,"id":178055082,"diff_hunk":"@@ -396,19 +402,47 @@ void TheThingsNetwork::autoBaud()\n   while (attempts-- && length == 0)\n   {\n     delay(100);\n+    // Send break + Autobaud \n     modemStream->write((byte)0x00);\n     modemStream->write(0x55);\n     modemStream->write(SEND_MSG);\n-    sendCommand(SYS_TABLE, 0, true, false);\n-    sendCommand(SYS_TABLE, SYS_GET, true, false);\n-    sendCommand(SYS_TABLE, SYS_GET_VER, false, false);\n-    modemStream->write(SEND_MSG);\n-    length = modemStream->readBytesUntil('\\n', buffer, sizeof(buffer));\n+    // check we can talk\n+    length = checkModuleAvailable();\n+    \n+    // We succeded talking to the module ?\n+    baudDetermined = length > 0 ;\n   }\n   delay(100);\n   clearReadBuffer();\n   modemStream->setTimeout(10000);\n-  baudDetermined = true;\n+}\n+\n+bool TheThingsNetwork::isSleeping()\n+{  \n+  return baudDetermined ? false : true ;\n+}\n+\n+void TheThingsNetwork::wake()\n+{  \n+  // If sleeping\n+  if (!baudDetermined) \n+  {\n+    // Send a 0 at lower speed to be sure always received\n+    // as a character a 57600 baud rate\n+    modemStream->flush();\n+    modemStream->begin(2400);\n+    modemStream->write((uint8_t) 0x00);\n+    modemStream->flush();\n+    delay(20);\n+    // set baudrate back to normal and send autobaud\n+    modemStream->begin(57600);","path":"src/TheThingsNetwork.cpp","position":65,"original_position":65,"commit_id":"bab08ab865752ff5208c71f6f9dae807e6be8fba","original_commit_id":"bab08ab865752ff5208c71f6f9dae807e6be8fba","user":{"login":"johanstokking","id":13334001,"avatar_url":"https://avatars2.githubusercontent.com/u/13334001?v=4","gravatar_id":"","url":"https://api.github.com/users/johanstokking","html_url":"https://github.com/johanstokking","followers_url":"https://api.github.com/users/johanstokking/followers","following_url":"https://api.github.com/users/johanstokking/following{/other_user}","gists_url":"https://api.github.com/users/johanstokking/gists{/gist_id}","starred_url":"https://api.github.com/users/johanstokking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanstokking/subscriptions","organizations_url":"https://api.github.com/users/johanstokking/orgs","repos_url":"https://api.github.com/users/johanstokking/repos","events_url":"https://api.github.com/users/johanstokking/events{/privacy}","received_events_url":"https://api.github.com/users/johanstokking/received_events","type":"User","site_admin":false},"body":"Again, `Stream` does not have `begin()`, right? If so, where is it defined?\r\n\r\nI.e. this code is still breaking when `SerialType` cannot be determined and falls back to `Stream`.","created_at":"2018-03-29T13:28:56Z","updated_at":"2018-03-29T13:29:25Z","html_url":"https://github.com/TheThingsNetwork/arduino-device-lib/pull/231#discussion_r178055082","pull_request_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/231","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/comments/178055082"},"html":{"href":"https://github.com/TheThingsNetwork/arduino-device-lib/pull/231#discussion_r178055082"},"pull_request":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/231"}}},"pull_request":{"url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/231","id":172357035,"html_url":"https://github.com/TheThingsNetwork/arduino-device-lib/pull/231","diff_url":"https://github.com/TheThingsNetwork/arduino-device-lib/pull/231.diff","patch_url":"https://github.com/TheThingsNetwork/arduino-device-lib/pull/231.patch","issue_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/issues/231","number":231,"state":"open","locked":false,"title":"Fixed LoRa module not waked from sleep by autoBaud sometimes","user":{"login":"hallard","id":2471931,"avatar_url":"https://avatars2.githubusercontent.com/u/2471931?v=4","gravatar_id":"","url":"https://api.github.com/users/hallard","html_url":"https://github.com/hallard","followers_url":"https://api.github.com/users/hallard/followers","following_url":"https://api.github.com/users/hallard/following{/other_user}","gists_url":"https://api.github.com/users/hallard/gists{/gist_id}","starred_url":"https://api.github.com/users/hallard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hallard/subscriptions","organizations_url":"https://api.github.com/users/hallard/orgs","repos_url":"https://api.github.com/users/hallard/repos","events_url":"https://api.github.com/users/hallard/events{/privacy}","received_events_url":"https://api.github.com/users/hallard/received_events","type":"User","site_admin":false},"body":"I increased the break time condition setting up serial port to lower baud rate when writing 0 (break) on wake method\r\nBug could be reproduced by non stop shaking the node, with this code, seem fixed\r\n\r\nMay be we could also arrange autoBaud to reflect this change and do only one method.","created_at":"2018-03-01T21:21:39Z","updated_at":"2018-03-29T13:29:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"935926db37984c742ab2d071e82cefc1dbecef5a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/231/commits","review_comments_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/231/comments","review_comment_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/issues/231/comments","statuses_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/statuses/bab08ab865752ff5208c71f6f9dae807e6be8fba","head":{"label":"ch2i:master","ref":"master","sha":"bab08ab865752ff5208c71f6f9dae807e6be8fba","user":{"login":"ch2i","id":12666656,"avatar_url":"https://avatars1.githubusercontent.com/u/12666656?v=4","gravatar_id":"","url":"https://api.github.com/users/ch2i","html_url":"https://github.com/ch2i","followers_url":"https://api.github.com/users/ch2i/followers","following_url":"https://api.github.com/users/ch2i/following{/other_user}","gists_url":"https://api.github.com/users/ch2i/gists{/gist_id}","starred_url":"https://api.github.com/users/ch2i/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ch2i/subscriptions","organizations_url":"https://api.github.com/users/ch2i/orgs","repos_url":"https://api.github.com/users/ch2i/repos","events_url":"https://api.github.com/users/ch2i/events{/privacy}","received_events_url":"https://api.github.com/users/ch2i/received_events","type":"Organization","site_admin":false},"repo":{"id":121230390,"name":"arduino-device-lib","full_name":"ch2i/arduino-device-lib","owner":{"login":"ch2i","id":12666656,"avatar_url":"https://avatars1.githubusercontent.com/u/12666656?v=4","gravatar_id":"","url":"https://api.github.com/users/ch2i","html_url":"https://github.com/ch2i","followers_url":"https://api.github.com/users/ch2i/followers","following_url":"https://api.github.com/users/ch2i/following{/other_user}","gists_url":"https://api.github.com/users/ch2i/gists{/gist_id}","starred_url":"https://api.github.com/users/ch2i/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ch2i/subscriptions","organizations_url":"https://api.github.com/users/ch2i/orgs","repos_url":"https://api.github.com/users/ch2i/repos","events_url":"https://api.github.com/users/ch2i/events{/privacy}","received_events_url":"https://api.github.com/users/ch2i/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ch2i/arduino-device-lib","description":"Arduino Library for TTN Devices","fork":true,"url":"https://api.github.com/repos/ch2i/arduino-device-lib","forks_url":"https://api.github.com/repos/ch2i/arduino-device-lib/forks","keys_url":"https://api.github.com/repos/ch2i/arduino-device-lib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ch2i/arduino-device-lib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ch2i/arduino-device-lib/teams","hooks_url":"https://api.github.com/repos/ch2i/arduino-device-lib/hooks","issue_events_url":"https://api.github.com/repos/ch2i/arduino-device-lib/issues/events{/number}","events_url":"https://api.github.com/repos/ch2i/arduino-device-lib/events","assignees_url":"https://api.github.com/repos/ch2i/arduino-device-lib/assignees{/user}","branches_url":"https://api.github.com/repos/ch2i/arduino-device-lib/branches{/branch}","tags_url":"https://api.github.com/repos/ch2i/arduino-device-lib/tags","blobs_url":"https://api.github.com/repos/ch2i/arduino-device-lib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ch2i/arduino-device-lib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ch2i/arduino-device-lib/git/refs{/sha}","trees_url":"https://api.github.com/repos/ch2i/arduino-device-lib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ch2i/arduino-device-lib/statuses/{sha}","languages_url":"https://api.github.com/repos/ch2i/arduino-device-lib/languages","stargazers_url":"https://api.github.com/repos/ch2i/arduino-device-lib/stargazers","contributors_url":"https://api.github.com/repos/ch2i/arduino-device-lib/contributors","subscribers_url":"https://api.github.com/repos/ch2i/arduino-device-lib/subscribers","subscription_url":"https://api.github.com/repos/ch2i/arduino-device-lib/subscription","commits_url":"https://api.github.com/repos/ch2i/arduino-device-lib/commits{/sha}","git_commits_url":"https://api.github.com/repos/ch2i/arduino-device-lib/git/commits{/sha}","comments_url":"https://api.github.com/repos/ch2i/arduino-device-lib/comments{/number}","issue_comment_url":"https://api.github.com/repos/ch2i/arduino-device-lib/issues/comments{/number}","contents_url":"https://api.github.com/repos/ch2i/arduino-device-lib/contents/{+path}","compare_url":"https://api.github.com/repos/ch2i/arduino-device-lib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ch2i/arduino-device-lib/merges","archive_url":"https://api.github.com/repos/ch2i/arduino-device-lib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ch2i/arduino-device-lib/downloads","issues_url":"https://api.github.com/repos/ch2i/arduino-device-lib/issues{/number}","pulls_url":"https://api.github.com/repos/ch2i/arduino-device-lib/pulls{/number}","milestones_url":"https://api.github.com/repos/ch2i/arduino-device-lib/milestones{/number}","notifications_url":"https://api.github.com/repos/ch2i/arduino-device-lib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ch2i/arduino-device-lib/labels{/name}","releases_url":"https://api.github.com/repos/ch2i/arduino-device-lib/releases{/id}","deployments_url":"https://api.github.com/repos/ch2i/arduino-device-lib/deployments","created_at":"2018-02-12T10:07:19Z","updated_at":"2018-03-28T22:54:22Z","pushed_at":"2018-03-28T22:54:20Z","git_url":"git://github.com/ch2i/arduino-device-lib.git","ssh_url":"git@github.com:ch2i/arduino-device-lib.git","clone_url":"https://github.com/ch2i/arduino-device-lib.git","svn_url":"https://github.com/ch2i/arduino-device-lib","homepage":"","size":371,"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":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"TheThingsNetwork:master","ref":"master","sha":"20d69645cc52e09c83047c87c0780dc36ef50306","user":{"login":"TheThingsNetwork","id":13333576,"avatar_url":"https://avatars0.githubusercontent.com/u/13333576?v=4","gravatar_id":"","url":"https://api.github.com/users/TheThingsNetwork","html_url":"https://github.com/TheThingsNetwork","followers_url":"https://api.github.com/users/TheThingsNetwork/followers","following_url":"https://api.github.com/users/TheThingsNetwork/following{/other_user}","gists_url":"https://api.github.com/users/TheThingsNetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/TheThingsNetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheThingsNetwork/subscriptions","organizations_url":"https://api.github.com/users/TheThingsNetwork/orgs","repos_url":"https://api.github.com/users/TheThingsNetwork/repos","events_url":"https://api.github.com/users/TheThingsNetwork/events{/privacy}","received_events_url":"https://api.github.com/users/TheThingsNetwork/received_events","type":"Organization","site_admin":false},"repo":{"id":65997719,"name":"arduino-device-lib","full_name":"TheThingsNetwork/arduino-device-lib","owner":{"login":"TheThingsNetwork","id":13333576,"avatar_url":"https://avatars0.githubusercontent.com/u/13333576?v=4","gravatar_id":"","url":"https://api.github.com/users/TheThingsNetwork","html_url":"https://github.com/TheThingsNetwork","followers_url":"https://api.github.com/users/TheThingsNetwork/followers","following_url":"https://api.github.com/users/TheThingsNetwork/following{/other_user}","gists_url":"https://api.github.com/users/TheThingsNetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/TheThingsNetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheThingsNetwork/subscriptions","organizations_url":"https://api.github.com/users/TheThingsNetwork/orgs","repos_url":"https://api.github.com/users/TheThingsNetwork/repos","events_url":"https://api.github.com/users/TheThingsNetwork/events{/privacy}","received_events_url":"https://api.github.com/users/TheThingsNetwork/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheThingsNetwork/arduino-device-lib","description":"Arduino Library for TTN Devices","fork":false,"url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib","forks_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/forks","keys_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/teams","hooks_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/hooks","issue_events_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/issues/events{/number}","events_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/events","assignees_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/assignees{/user}","branches_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/branches{/branch}","tags_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/tags","blobs_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/statuses/{sha}","languages_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/languages","stargazers_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/stargazers","contributors_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/contributors","subscribers_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/subscribers","subscription_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/subscription","commits_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/contents/{+path}","compare_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/merges","archive_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/downloads","issues_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/issues{/number}","pulls_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls{/number}","milestones_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/milestones{/number}","notifications_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/labels{/name}","releases_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/releases{/id}","deployments_url":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/deployments","created_at":"2016-08-18T13:04:36Z","updated_at":"2018-03-16T13:40:38Z","pushed_at":"2018-03-28T22:54:22Z","git_url":"git://github.com/TheThingsNetwork/arduino-device-lib.git","ssh_url":"git@github.com:TheThingsNetwork/arduino-device-lib.git","clone_url":"https://github.com/TheThingsNetwork/arduino-device-lib.git","svn_url":"https://github.com/TheThingsNetwork/arduino-device-lib","homepage":"","size":329,"stargazers_count":50,"watchers_count":50,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":41,"open_issues":6,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/231"},"html":{"href":"https://github.com/TheThingsNetwork/arduino-device-lib/pull/231"},"issue":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/issues/231"},"comments":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/issues/231/comments"},"review_comments":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/231/comments"},"review_comment":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/pulls/231/commits"},"statuses":{"href":"https://api.github.com/repos/TheThingsNetwork/arduino-device-lib/statuses/bab08ab865752ff5208c71f6f9dae807e6be8fba"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"johanstokking"}}