{"action":"created","comment":{"url":"https://api.github.com/repos/tessel/t2-firmware/pulls/comments/36791350","id":36791350,"diff_hunk":"@@ -212,16 +212,25 @@ Tessel.Port.prototype._status_cmd = function(buf, cb) {\n };\n \n Tessel.Port.prototype._tx = function(buf, cb) {\n+  var chunk = 0,\n+      cbuf;\n+\n   if (buf.length === 0) {\n     throw new Error('Length must be non-zero');\n-  } else if (buf.length > 255) {\n-    // TODO: split into sequence of commands\n-    throw new Error('Buffer size must be less than 255');\n   }\n \n   this.cork();\n-  this.sock.write(new Buffer([CMD.TX, buf.length]));\n-  this.sock.write(buf);\n+\n+  // The protocol only supports <256 byte transfers, chunk if buf is bigger\n+  while (chunk < buf.length) {\n+    cbuf = buf.slice(chunk, chunk+255);","path":"node/tessel.js","position":20,"original_position":20,"commit_id":"285b89198de5c3c369646837a72998a32738f7df","original_commit_id":"285b89198de5c3c369646837a72998a32738f7df","user":{"login":"rwaldron","id":27985,"avatar_url":"https://avatars.githubusercontent.com/u/27985?v=3","gravatar_id":"","url":"https://api.github.com/users/rwaldron","html_url":"https://github.com/rwaldron","followers_url":"https://api.github.com/users/rwaldron/followers","following_url":"https://api.github.com/users/rwaldron/following{/other_user}","gists_url":"https://api.github.com/users/rwaldron/gists{/gist_id}","starred_url":"https://api.github.com/users/rwaldron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwaldron/subscriptions","organizations_url":"https://api.github.com/users/rwaldron/orgs","repos_url":"https://api.github.com/users/rwaldron/repos","events_url":"https://api.github.com/users/rwaldron/events{/privacy}","received_events_url":"https://api.github.com/users/rwaldron/received_events","type":"User","site_admin":false},"body":"nit: `cbuf` is the \"chunk\" and `chunk` is an \"offset\" ;)","created_at":"2015-08-11T20:01:32Z","updated_at":"2015-08-11T20:01:32Z","html_url":"https://github.com/tessel/t2-firmware/pull/87#discussion_r36791350","pull_request_url":"https://api.github.com/repos/tessel/t2-firmware/pulls/87","_links":{"self":{"href":"https://api.github.com/repos/tessel/t2-firmware/pulls/comments/36791350"},"html":{"href":"https://github.com/tessel/t2-firmware/pull/87#discussion_r36791350"},"pull_request":{"href":"https://api.github.com/repos/tessel/t2-firmware/pulls/87"}}},"pull_request":{"url":"https://api.github.com/repos/tessel/t2-firmware/pulls/87","id":42164995,"html_url":"https://github.com/tessel/t2-firmware/pull/87","diff_url":"https://github.com/tessel/t2-firmware/pull/87.diff","patch_url":"https://github.com/tessel/t2-firmware/pull/87.patch","issue_url":"https://api.github.com/repos/tessel/t2-firmware/issues/87","number":87,"state":"open","locked":false,"title":"Chunked >255 byte transfers in Tessel.Port.prototype._tx (fixes #81)","user":{"login":"flaki","id":2089432,"avatar_url":"https://avatars.githubusercontent.com/u/2089432?v=3","gravatar_id":"","url":"https://api.github.com/users/flaki","html_url":"https://github.com/flaki","followers_url":"https://api.github.com/users/flaki/followers","following_url":"https://api.github.com/users/flaki/following{/other_user}","gists_url":"https://api.github.com/users/flaki/gists{/gist_id}","starred_url":"https://api.github.com/users/flaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaki/subscriptions","organizations_url":"https://api.github.com/users/flaki/orgs","repos_url":"https://api.github.com/users/flaki/repos","events_url":"https://api.github.com/users/flaki/events{/privacy}","received_events_url":"https://api.github.com/users/flaki/received_events","type":"User","site_admin":false},"body":"Taken a stab at this because I needed the functionality to be able to properly communicate with the [digole OLED displays] I have.\r\n\r\nThis is a partial/naive fix for #81, but it [got the screen working], at least for was adequate for the 9600 baud UART the display was using which is quite latency-insensitive, but at this low baudrate I've ended up with quite abysmal refresh rate, pretty much unusable for anything more than static images.\r\n\r\nI also tried this approach with SPI-emulated faking of the Neopixel driver. Got the idea from the [Espruino implementation], which basically quadruples the 800k refresh rate of the WS281x and emulates the PWM output by encoding each databit into 4 \"sub-bits\". As it was to be expected, it didn't (really) work - sometimes I could get a few leds light up, but it was very inconsistent.\r\n\r\nAnyway, the I think the above showcases that there would certainly be market for a fast big-data-rate transfer implementation for SPI/UART that is more-or-less transparent to JavaScript users. Th\r\n only question that remains is: how? :smile: \r\n\r\n[got the screen working]: https://twitter.com/slsoftworks/status/630461621861765120\r\n[digole OLED displays]: http://www.digole.com/index.php?productID=545\r\n[Espruino implementation]: http://www.espruino.com/WS2811","created_at":"2015-08-11T19:02:58Z","updated_at":"2015-08-11T20:01:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f0a619879632e2ef18783c37fa3bdce7ba5d139c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tessel/t2-firmware/pulls/87/commits","review_comments_url":"https://api.github.com/repos/tessel/t2-firmware/pulls/87/comments","review_comment_url":"https://api.github.com/repos/tessel/t2-firmware/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tessel/t2-firmware/issues/87/comments","statuses_url":"https://api.github.com/repos/tessel/t2-firmware/statuses/285b89198de5c3c369646837a72998a32738f7df","head":{"label":"flaki:flaki-chunked-io","ref":"flaki-chunked-io","sha":"285b89198de5c3c369646837a72998a32738f7df","user":{"login":"flaki","id":2089432,"avatar_url":"https://avatars.githubusercontent.com/u/2089432?v=3","gravatar_id":"","url":"https://api.github.com/users/flaki","html_url":"https://github.com/flaki","followers_url":"https://api.github.com/users/flaki/followers","following_url":"https://api.github.com/users/flaki/following{/other_user}","gists_url":"https://api.github.com/users/flaki/gists{/gist_id}","starred_url":"https://api.github.com/users/flaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaki/subscriptions","organizations_url":"https://api.github.com/users/flaki/orgs","repos_url":"https://api.github.com/users/flaki/repos","events_url":"https://api.github.com/users/flaki/events{/privacy}","received_events_url":"https://api.github.com/users/flaki/received_events","type":"User","site_admin":false},"repo":{"id":40557283,"name":"t2-firmware","full_name":"flaki/t2-firmware","owner":{"login":"flaki","id":2089432,"avatar_url":"https://avatars.githubusercontent.com/u/2089432?v=3","gravatar_id":"","url":"https://api.github.com/users/flaki","html_url":"https://github.com/flaki","followers_url":"https://api.github.com/users/flaki/followers","following_url":"https://api.github.com/users/flaki/following{/other_user}","gists_url":"https://api.github.com/users/flaki/gists{/gist_id}","starred_url":"https://api.github.com/users/flaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaki/subscriptions","organizations_url":"https://api.github.com/users/flaki/orgs","repos_url":"https://api.github.com/users/flaki/repos","events_url":"https://api.github.com/users/flaki/events{/privacy}","received_events_url":"https://api.github.com/users/flaki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flaki/t2-firmware","description":"Firmware for Tessel 2's SAMD21 coprocessor and related SoC code","fork":true,"url":"https://api.github.com/repos/flaki/t2-firmware","forks_url":"https://api.github.com/repos/flaki/t2-firmware/forks","keys_url":"https://api.github.com/repos/flaki/t2-firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flaki/t2-firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flaki/t2-firmware/teams","hooks_url":"https://api.github.com/repos/flaki/t2-firmware/hooks","issue_events_url":"https://api.github.com/repos/flaki/t2-firmware/issues/events{/number}","events_url":"https://api.github.com/repos/flaki/t2-firmware/events","assignees_url":"https://api.github.com/repos/flaki/t2-firmware/assignees{/user}","branches_url":"https://api.github.com/repos/flaki/t2-firmware/branches{/branch}","tags_url":"https://api.github.com/repos/flaki/t2-firmware/tags","blobs_url":"https://api.github.com/repos/flaki/t2-firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flaki/t2-firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flaki/t2-firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/flaki/t2-firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flaki/t2-firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/flaki/t2-firmware/languages","stargazers_url":"https://api.github.com/repos/flaki/t2-firmware/stargazers","contributors_url":"https://api.github.com/repos/flaki/t2-firmware/contributors","subscribers_url":"https://api.github.com/repos/flaki/t2-firmware/subscribers","subscription_url":"https://api.github.com/repos/flaki/t2-firmware/subscription","commits_url":"https://api.github.com/repos/flaki/t2-firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/flaki/t2-firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/flaki/t2-firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/flaki/t2-firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/flaki/t2-firmware/contents/{+path}","compare_url":"https://api.github.com/repos/flaki/t2-firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flaki/t2-firmware/merges","archive_url":"https://api.github.com/repos/flaki/t2-firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flaki/t2-firmware/downloads","issues_url":"https://api.github.com/repos/flaki/t2-firmware/issues{/number}","pulls_url":"https://api.github.com/repos/flaki/t2-firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/flaki/t2-firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/flaki/t2-firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flaki/t2-firmware/labels{/name}","releases_url":"https://api.github.com/repos/flaki/t2-firmware/releases{/id}","created_at":"2015-08-11T18:05:41Z","updated_at":"2015-08-11T18:05:42Z","pushed_at":"2015-08-11T19:51:08Z","git_url":"git://github.com/flaki/t2-firmware.git","ssh_url":"git@github.com:flaki/t2-firmware.git","clone_url":"https://github.com/flaki/t2-firmware.git","svn_url":"https://github.com/flaki/t2-firmware","homepage":"","size":1449,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tessel:master","ref":"master","sha":"e42025a499b22c63d5f10d5baaf4a402608449cb","user":{"login":"tessel","id":5573563,"avatar_url":"https://avatars.githubusercontent.com/u/5573563?v=3","gravatar_id":"","url":"https://api.github.com/users/tessel","html_url":"https://github.com/tessel","followers_url":"https://api.github.com/users/tessel/followers","following_url":"https://api.github.com/users/tessel/following{/other_user}","gists_url":"https://api.github.com/users/tessel/gists{/gist_id}","starred_url":"https://api.github.com/users/tessel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tessel/subscriptions","organizations_url":"https://api.github.com/users/tessel/orgs","repos_url":"https://api.github.com/users/tessel/repos","events_url":"https://api.github.com/users/tessel/events{/privacy}","received_events_url":"https://api.github.com/users/tessel/received_events","type":"Organization","site_admin":false},"repo":{"id":29262099,"name":"t2-firmware","full_name":"tessel/t2-firmware","owner":{"login":"tessel","id":5573563,"avatar_url":"https://avatars.githubusercontent.com/u/5573563?v=3","gravatar_id":"","url":"https://api.github.com/users/tessel","html_url":"https://github.com/tessel","followers_url":"https://api.github.com/users/tessel/followers","following_url":"https://api.github.com/users/tessel/following{/other_user}","gists_url":"https://api.github.com/users/tessel/gists{/gist_id}","starred_url":"https://api.github.com/users/tessel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tessel/subscriptions","organizations_url":"https://api.github.com/users/tessel/orgs","repos_url":"https://api.github.com/users/tessel/repos","events_url":"https://api.github.com/users/tessel/events{/privacy}","received_events_url":"https://api.github.com/users/tessel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tessel/t2-firmware","description":"Firmware for Tessel 2's SAMD21 coprocessor and related SoC code","fork":false,"url":"https://api.github.com/repos/tessel/t2-firmware","forks_url":"https://api.github.com/repos/tessel/t2-firmware/forks","keys_url":"https://api.github.com/repos/tessel/t2-firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tessel/t2-firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tessel/t2-firmware/teams","hooks_url":"https://api.github.com/repos/tessel/t2-firmware/hooks","issue_events_url":"https://api.github.com/repos/tessel/t2-firmware/issues/events{/number}","events_url":"https://api.github.com/repos/tessel/t2-firmware/events","assignees_url":"https://api.github.com/repos/tessel/t2-firmware/assignees{/user}","branches_url":"https://api.github.com/repos/tessel/t2-firmware/branches{/branch}","tags_url":"https://api.github.com/repos/tessel/t2-firmware/tags","blobs_url":"https://api.github.com/repos/tessel/t2-firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tessel/t2-firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tessel/t2-firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/tessel/t2-firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tessel/t2-firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/tessel/t2-firmware/languages","stargazers_url":"https://api.github.com/repos/tessel/t2-firmware/stargazers","contributors_url":"https://api.github.com/repos/tessel/t2-firmware/contributors","subscribers_url":"https://api.github.com/repos/tessel/t2-firmware/subscribers","subscription_url":"https://api.github.com/repos/tessel/t2-firmware/subscription","commits_url":"https://api.github.com/repos/tessel/t2-firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/tessel/t2-firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/tessel/t2-firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/tessel/t2-firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/tessel/t2-firmware/contents/{+path}","compare_url":"https://api.github.com/repos/tessel/t2-firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tessel/t2-firmware/merges","archive_url":"https://api.github.com/repos/tessel/t2-firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tessel/t2-firmware/downloads","issues_url":"https://api.github.com/repos/tessel/t2-firmware/issues{/number}","pulls_url":"https://api.github.com/repos/tessel/t2-firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/tessel/t2-firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/tessel/t2-firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tessel/t2-firmware/labels{/name}","releases_url":"https://api.github.com/repos/tessel/t2-firmware/releases{/id}","created_at":"2015-01-14T19:38:00Z","updated_at":"2015-08-06T14:00:25Z","pushed_at":"2015-08-11T19:51:09Z","git_url":"git://github.com/tessel/t2-firmware.git","ssh_url":"git@github.com:tessel/t2-firmware.git","clone_url":"https://github.com/tessel/t2-firmware.git","svn_url":"https://github.com/tessel/t2-firmware","homepage":"","size":1449,"stargazers_count":15,"watchers_count":15,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":28,"forks":5,"open_issues":28,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tessel/t2-firmware/pulls/87"},"html":{"href":"https://github.com/tessel/t2-firmware/pull/87"},"issue":{"href":"https://api.github.com/repos/tessel/t2-firmware/issues/87"},"comments":{"href":"https://api.github.com/repos/tessel/t2-firmware/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/tessel/t2-firmware/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/tessel/t2-firmware/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tessel/t2-firmware/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/tessel/t2-firmware/statuses/285b89198de5c3c369646837a72998a32738f7df"}}}}