{"action":"created","comment":{"url":"https://api.github.com/repos/amperka/espruino-modcat/pulls/comments/85962450","pull_request_review_id":6645611,"id":85962450,"diff_hunk":"@@ -0,0 +1,53 @@\n+var RS485 = function(opts) {\n+  if (!opts) {\n+    pts = {};\n+  }\n+  this._serial = opts.serial || Serial3;\n+  this._speed = opts.speed || 9600;\n+  this._dirPin = opts.dirPin || P5;\n+  this._lineEnding = opts.lineEnding || '\\r\\n';\n+  this._kPin = opts.kPin;\n+  this._endPrintID = null;\n+  this._serial.setup(this._speed);\n+  var self = this;\n+\n+  this._serial.on('data', function(data) {\n+    self.emit('data', data);\n+  });\n+  this._serial.on('parity', function() {\n+    self.emit('error', 'parity');\n+  });\n+  this._serial.on('framing', function() {\n+    self.emit('error', 'speed');\n+  });\n+};\n+\n+RS485.prototype.print = function(data) {\n+  var time = (data.length * 12 / this._speed) * 1000;\n+  console.log(time);\n+  this._dirPin.write(true);\n+  this._serial.print(data);\n+  var self = this;\n+  this._endPrintID = setTimeout(function() {\n+    self._dirPin.write(false);\n+  }, time);\n+};\n+\n+RS485.prototype.println = function(data) {\n+  var time = (data.length * 12 / this._speed) * 1000;\n+  console.log(time);\n+  this._dirPin.write(true);  \n+  if (this._lineEnding) {\n+    this._serial.print(data + this._lineEnding);\n+  } else {\n+    this._serial.println(data);\n+  }\n+  var self = this;\n+  this._endPrintID = setTimeout(function() {\n+    self._dirPin.write(false);\n+  }, time);\n+};\n+\n+exports.connect = function(opts) {\n+  return new RS485(opts);\n+};","path":"modules/@amperka/rs-485.js","position":58,"original_position":53,"commit_id":"6e1f9dc38eb4be938e34b53606a879192723e0b2","original_commit_id":"3d3c867b683beba5e7aeeede5247e29016b8dfa5","user":{"login":"Igor89","id":12657561,"avatar_url":"https://avatars.githubusercontent.com/u/12657561?v=3","gravatar_id":"","url":"https://api.github.com/users/Igor89","html_url":"https://github.com/Igor89","followers_url":"https://api.github.com/users/Igor89/followers","following_url":"https://api.github.com/users/Igor89/following{/other_user}","gists_url":"https://api.github.com/users/Igor89/gists{/gist_id}","starred_url":"https://api.github.com/users/Igor89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Igor89/subscriptions","organizations_url":"https://api.github.com/users/Igor89/orgs","repos_url":"https://api.github.com/users/Igor89/repos","events_url":"https://api.github.com/users/Igor89/events{/privacy}","received_events_url":"https://api.github.com/users/Igor89/received_events","type":"User","site_admin":false},"body":"Прогнал)","created_at":"2016-11-01T16:14:20Z","updated_at":"2016-11-01T16:14:20Z","html_url":"https://github.com/amperka/espruino-modcat/pull/35#discussion_r85962450","pull_request_url":"https://api.github.com/repos/amperka/espruino-modcat/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/amperka/espruino-modcat/pulls/comments/85962450"},"html":{"href":"https://github.com/amperka/espruino-modcat/pull/35#discussion_r85962450"},"pull_request":{"href":"https://api.github.com/repos/amperka/espruino-modcat/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/amperka/espruino-modcat/pulls/35","id":90407307,"html_url":"https://github.com/amperka/espruino-modcat/pull/35","diff_url":"https://github.com/amperka/espruino-modcat/pull/35.diff","patch_url":"https://github.com/amperka/espruino-modcat/pull/35.patch","issue_url":"https://api.github.com/repos/amperka/espruino-modcat/issues/35","number":35,"state":"open","locked":false,"title":"Rs485","user":{"login":"Igor89","id":12657561,"avatar_url":"https://avatars.githubusercontent.com/u/12657561?v=3","gravatar_id":"","url":"https://api.github.com/users/Igor89","html_url":"https://github.com/Igor89","followers_url":"https://api.github.com/users/Igor89/followers","following_url":"https://api.github.com/users/Igor89/following{/other_user}","gists_url":"https://api.github.com/users/Igor89/gists{/gist_id}","starred_url":"https://api.github.com/users/Igor89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Igor89/subscriptions","organizations_url":"https://api.github.com/users/Igor89/orgs","repos_url":"https://api.github.com/users/Igor89/repos","events_url":"https://api.github.com/users/Igor89/events{/privacy}","received_events_url":"https://api.github.com/users/Igor89/received_events","type":"User","site_admin":false},"body":"Жду приговора. \nФункций Serial.available() и Serial.read(chars) нет, так как в конструкторе RS485 прописан event Serial.data, который всё время считывает весь буфер.\n@acosinwork \n@niggor \n","created_at":"2016-10-21T15:45:37Z","updated_at":"2016-11-01T16:14:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"009cd4323a26a623f796540aeb1ad1bf0f2f519d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/amperka/espruino-modcat/pulls/35/commits","review_comments_url":"https://api.github.com/repos/amperka/espruino-modcat/pulls/35/comments","review_comment_url":"https://api.github.com/repos/amperka/espruino-modcat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amperka/espruino-modcat/issues/35/comments","statuses_url":"https://api.github.com/repos/amperka/espruino-modcat/statuses/6e1f9dc38eb4be938e34b53606a879192723e0b2","head":{"label":"amperka:rs485","ref":"rs485","sha":"6e1f9dc38eb4be938e34b53606a879192723e0b2","user":{"login":"amperka","id":1061834,"avatar_url":"https://avatars.githubusercontent.com/u/1061834?v=3","gravatar_id":"","url":"https://api.github.com/users/amperka","html_url":"https://github.com/amperka","followers_url":"https://api.github.com/users/amperka/followers","following_url":"https://api.github.com/users/amperka/following{/other_user}","gists_url":"https://api.github.com/users/amperka/gists{/gist_id}","starred_url":"https://api.github.com/users/amperka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amperka/subscriptions","organizations_url":"https://api.github.com/users/amperka/orgs","repos_url":"https://api.github.com/users/amperka/repos","events_url":"https://api.github.com/users/amperka/events{/privacy}","received_events_url":"https://api.github.com/users/amperka/received_events","type":"Organization","site_admin":false},"repo":{"id":43444093,"name":"espruino-modcat","full_name":"amperka/espruino-modcat","owner":{"login":"amperka","id":1061834,"avatar_url":"https://avatars.githubusercontent.com/u/1061834?v=3","gravatar_id":"","url":"https://api.github.com/users/amperka","html_url":"https://github.com/amperka","followers_url":"https://api.github.com/users/amperka/followers","following_url":"https://api.github.com/users/amperka/following{/other_user}","gists_url":"https://api.github.com/users/amperka/gists{/gist_id}","starred_url":"https://api.github.com/users/amperka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amperka/subscriptions","organizations_url":"https://api.github.com/users/amperka/orgs","repos_url":"https://api.github.com/users/amperka/repos","events_url":"https://api.github.com/users/amperka/events{/privacy}","received_events_url":"https://api.github.com/users/amperka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/amperka/espruino-modcat","description":null,"fork":false,"url":"https://api.github.com/repos/amperka/espruino-modcat","forks_url":"https://api.github.com/repos/amperka/espruino-modcat/forks","keys_url":"https://api.github.com/repos/amperka/espruino-modcat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amperka/espruino-modcat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amperka/espruino-modcat/teams","hooks_url":"https://api.github.com/repos/amperka/espruino-modcat/hooks","issue_events_url":"https://api.github.com/repos/amperka/espruino-modcat/issues/events{/number}","events_url":"https://api.github.com/repos/amperka/espruino-modcat/events","assignees_url":"https://api.github.com/repos/amperka/espruino-modcat/assignees{/user}","branches_url":"https://api.github.com/repos/amperka/espruino-modcat/branches{/branch}","tags_url":"https://api.github.com/repos/amperka/espruino-modcat/tags","blobs_url":"https://api.github.com/repos/amperka/espruino-modcat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amperka/espruino-modcat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amperka/espruino-modcat/git/refs{/sha}","trees_url":"https://api.github.com/repos/amperka/espruino-modcat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amperka/espruino-modcat/statuses/{sha}","languages_url":"https://api.github.com/repos/amperka/espruino-modcat/languages","stargazers_url":"https://api.github.com/repos/amperka/espruino-modcat/stargazers","contributors_url":"https://api.github.com/repos/amperka/espruino-modcat/contributors","subscribers_url":"https://api.github.com/repos/amperka/espruino-modcat/subscribers","subscription_url":"https://api.github.com/repos/amperka/espruino-modcat/subscription","commits_url":"https://api.github.com/repos/amperka/espruino-modcat/commits{/sha}","git_commits_url":"https://api.github.com/repos/amperka/espruino-modcat/git/commits{/sha}","comments_url":"https://api.github.com/repos/amperka/espruino-modcat/comments{/number}","issue_comment_url":"https://api.github.com/repos/amperka/espruino-modcat/issues/comments{/number}","contents_url":"https://api.github.com/repos/amperka/espruino-modcat/contents/{+path}","compare_url":"https://api.github.com/repos/amperka/espruino-modcat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amperka/espruino-modcat/merges","archive_url":"https://api.github.com/repos/amperka/espruino-modcat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amperka/espruino-modcat/downloads","issues_url":"https://api.github.com/repos/amperka/espruino-modcat/issues{/number}","pulls_url":"https://api.github.com/repos/amperka/espruino-modcat/pulls{/number}","milestones_url":"https://api.github.com/repos/amperka/espruino-modcat/milestones{/number}","notifications_url":"https://api.github.com/repos/amperka/espruino-modcat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amperka/espruino-modcat/labels{/name}","releases_url":"https://api.github.com/repos/amperka/espruino-modcat/releases{/id}","deployments_url":"https://api.github.com/repos/amperka/espruino-modcat/deployments","created_at":"2015-09-30T16:20:43Z","updated_at":"2016-10-27T10:49:37Z","pushed_at":"2016-11-01T16:11:58Z","git_url":"git://github.com/amperka/espruino-modcat.git","ssh_url":"git@github.com:amperka/espruino-modcat.git","clone_url":"https://github.com/amperka/espruino-modcat.git","svn_url":"https://github.com/amperka/espruino-modcat","homepage":null,"size":1488,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":6,"default_branch":"master"}},"base":{"label":"amperka:master","ref":"master","sha":"326e558d70689a5a1d64a7e952e5c57499fa7d71","user":{"login":"amperka","id":1061834,"avatar_url":"https://avatars.githubusercontent.com/u/1061834?v=3","gravatar_id":"","url":"https://api.github.com/users/amperka","html_url":"https://github.com/amperka","followers_url":"https://api.github.com/users/amperka/followers","following_url":"https://api.github.com/users/amperka/following{/other_user}","gists_url":"https://api.github.com/users/amperka/gists{/gist_id}","starred_url":"https://api.github.com/users/amperka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amperka/subscriptions","organizations_url":"https://api.github.com/users/amperka/orgs","repos_url":"https://api.github.com/users/amperka/repos","events_url":"https://api.github.com/users/amperka/events{/privacy}","received_events_url":"https://api.github.com/users/amperka/received_events","type":"Organization","site_admin":false},"repo":{"id":43444093,"name":"espruino-modcat","full_name":"amperka/espruino-modcat","owner":{"login":"amperka","id":1061834,"avatar_url":"https://avatars.githubusercontent.com/u/1061834?v=3","gravatar_id":"","url":"https://api.github.com/users/amperka","html_url":"https://github.com/amperka","followers_url":"https://api.github.com/users/amperka/followers","following_url":"https://api.github.com/users/amperka/following{/other_user}","gists_url":"https://api.github.com/users/amperka/gists{/gist_id}","starred_url":"https://api.github.com/users/amperka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amperka/subscriptions","organizations_url":"https://api.github.com/users/amperka/orgs","repos_url":"https://api.github.com/users/amperka/repos","events_url":"https://api.github.com/users/amperka/events{/privacy}","received_events_url":"https://api.github.com/users/amperka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/amperka/espruino-modcat","description":null,"fork":false,"url":"https://api.github.com/repos/amperka/espruino-modcat","forks_url":"https://api.github.com/repos/amperka/espruino-modcat/forks","keys_url":"https://api.github.com/repos/amperka/espruino-modcat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amperka/espruino-modcat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amperka/espruino-modcat/teams","hooks_url":"https://api.github.com/repos/amperka/espruino-modcat/hooks","issue_events_url":"https://api.github.com/repos/amperka/espruino-modcat/issues/events{/number}","events_url":"https://api.github.com/repos/amperka/espruino-modcat/events","assignees_url":"https://api.github.com/repos/amperka/espruino-modcat/assignees{/user}","branches_url":"https://api.github.com/repos/amperka/espruino-modcat/branches{/branch}","tags_url":"https://api.github.com/repos/amperka/espruino-modcat/tags","blobs_url":"https://api.github.com/repos/amperka/espruino-modcat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amperka/espruino-modcat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amperka/espruino-modcat/git/refs{/sha}","trees_url":"https://api.github.com/repos/amperka/espruino-modcat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amperka/espruino-modcat/statuses/{sha}","languages_url":"https://api.github.com/repos/amperka/espruino-modcat/languages","stargazers_url":"https://api.github.com/repos/amperka/espruino-modcat/stargazers","contributors_url":"https://api.github.com/repos/amperka/espruino-modcat/contributors","subscribers_url":"https://api.github.com/repos/amperka/espruino-modcat/subscribers","subscription_url":"https://api.github.com/repos/amperka/espruino-modcat/subscription","commits_url":"https://api.github.com/repos/amperka/espruino-modcat/commits{/sha}","git_commits_url":"https://api.github.com/repos/amperka/espruino-modcat/git/commits{/sha}","comments_url":"https://api.github.com/repos/amperka/espruino-modcat/comments{/number}","issue_comment_url":"https://api.github.com/repos/amperka/espruino-modcat/issues/comments{/number}","contents_url":"https://api.github.com/repos/amperka/espruino-modcat/contents/{+path}","compare_url":"https://api.github.com/repos/amperka/espruino-modcat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amperka/espruino-modcat/merges","archive_url":"https://api.github.com/repos/amperka/espruino-modcat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amperka/espruino-modcat/downloads","issues_url":"https://api.github.com/repos/amperka/espruino-modcat/issues{/number}","pulls_url":"https://api.github.com/repos/amperka/espruino-modcat/pulls{/number}","milestones_url":"https://api.github.com/repos/amperka/espruino-modcat/milestones{/number}","notifications_url":"https://api.github.com/repos/amperka/espruino-modcat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amperka/espruino-modcat/labels{/name}","releases_url":"https://api.github.com/repos/amperka/espruino-modcat/releases{/id}","deployments_url":"https://api.github.com/repos/amperka/espruino-modcat/deployments","created_at":"2015-09-30T16:20:43Z","updated_at":"2016-10-27T10:49:37Z","pushed_at":"2016-11-01T16:11:58Z","git_url":"git://github.com/amperka/espruino-modcat.git","ssh_url":"git@github.com:amperka/espruino-modcat.git","clone_url":"https://github.com/amperka/espruino-modcat.git","svn_url":"https://github.com/amperka/espruino-modcat","homepage":null,"size":1488,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amperka/espruino-modcat/pulls/35"},"html":{"href":"https://github.com/amperka/espruino-modcat/pull/35"},"issue":{"href":"https://api.github.com/repos/amperka/espruino-modcat/issues/35"},"comments":{"href":"https://api.github.com/repos/amperka/espruino-modcat/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/amperka/espruino-modcat/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/amperka/espruino-modcat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amperka/espruino-modcat/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/amperka/espruino-modcat/statuses/6e1f9dc38eb4be938e34b53606a879192723e0b2"}}}}
{"actor":{"display_login":"Igor89"}}