{"action":"created","comment":{"url":"https://api.github.com/repos/pycom/pycom-libraries/pulls/comments/172027495","pull_request_review_id":100985707,"id":172027495,"diff_hunk":"@@ -369,16 +369,14 @@ def _udp_thread(self):\n                     self.dwnb += 1\n                     ack_error = TX_ERR_NONE\n                     tx_pk = ujson.loads(data[4:])\n-                    tmst = tx_pk[\"txpk\"][\"tmst\"]\n-                    t_us = tmst - utime.ticks_us() - 15000\n-                    if t_us < 0:\n-                        t_us += 0xFFFFFFFF\n-                    if t_us < 20000000:\n+                    tmst = utime.ticks_add(tx_pk[\"txpk\"][\"tmst\"], - 8000) # pull 8 ms upfront\n+                    t_us = utime.ticks_diff(utime.ticks_us(), utime.ticks_add(tmst, - 15000))\n+                    if 1000 < t_us < 10000000:\n                         self.uplink_alarm = Timer.Alarm(\n                             handler=lambda x: self._send_down_link(\n                                 ubinascii.a2b_base64(tx_pk[\"txpk\"][\"data\"]),\n-                                tx_pk[\"txpk\"][\"tmst\"] - 50, tx_pk[\"txpk\"][\"datr\"],\n-                                int(tx_pk[\"txpk\"][\"freq\"] * 1000) * 1000\n+                                tmst, tx_pk[\"txpk\"][\"datr\"],\n+                                int(tx_pk[\"txpk\"][\"freq\"] * 1000 + 0.0005) * 1000","path":"examples/lorawan-nano-gateway/nanogateway.py","position":35,"original_position":35,"commit_id":"bdf7befb80e42038903930a6a8dbb2ca96f7e743","original_commit_id":"bdf7befb80e42038903930a6a8dbb2ca96f7e743","user":{"login":"danicampora","id":7749335,"avatar_url":"https://avatars1.githubusercontent.com/u/7749335?v=4","gravatar_id":"","url":"https://api.github.com/users/danicampora","html_url":"https://github.com/danicampora","followers_url":"https://api.github.com/users/danicampora/followers","following_url":"https://api.github.com/users/danicampora/following{/other_user}","gists_url":"https://api.github.com/users/danicampora/gists{/gist_id}","starred_url":"https://api.github.com/users/danicampora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danicampora/subscriptions","organizations_url":"https://api.github.com/users/danicampora/orgs","repos_url":"https://api.github.com/users/danicampora/repos","events_url":"https://api.github.com/users/danicampora/events{/privacy}","received_events_url":"https://api.github.com/users/danicampora/received_events","type":"User","site_admin":false},"body":"@robert-hh thanks for this contribution. One question:\r\n\r\nWhy the `` + 0.0005`` here?","created_at":"2018-03-03T20:23:16Z","updated_at":"2018-03-03T20:23:16Z","html_url":"https://github.com/pycom/pycom-libraries/pull/54#discussion_r172027495","pull_request_url":"https://api.github.com/repos/pycom/pycom-libraries/pulls/54","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/pycom/pycom-libraries/pulls/comments/172027495"},"html":{"href":"https://github.com/pycom/pycom-libraries/pull/54#discussion_r172027495"},"pull_request":{"href":"https://api.github.com/repos/pycom/pycom-libraries/pulls/54"}}},"pull_request":{"url":"https://api.github.com/repos/pycom/pycom-libraries/pulls/54","id":172678491,"html_url":"https://github.com/pycom/pycom-libraries/pull/54","diff_url":"https://github.com/pycom/pycom-libraries/pull/54.diff","patch_url":"https://github.com/pycom/pycom-libraries/pull/54.patch","issue_url":"https://api.github.com/repos/pycom/pycom-libraries/issues/54","number":54,"state":"open","locked":false,"title":"nanogateway.py: use ticks_add() and ticks_diff() instead + and -","user":{"login":"robert-hh","id":12476868,"avatar_url":"https://avatars1.githubusercontent.com/u/12476868?v=4","gravatar_id":"","url":"https://api.github.com/users/robert-hh","html_url":"https://github.com/robert-hh","followers_url":"https://api.github.com/users/robert-hh/followers","following_url":"https://api.github.com/users/robert-hh/following{/other_user}","gists_url":"https://api.github.com/users/robert-hh/gists{/gist_id}","starred_url":"https://api.github.com/users/robert-hh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robert-hh/subscriptions","organizations_url":"https://api.github.com/users/robert-hh/orgs","repos_url":"https://api.github.com/users/robert-hh/repos","events_url":"https://api.github.com/users/robert-hh/events{/privacy}","received_events_url":"https://api.github.com/users/robert-hh/received_events","type":"User","site_admin":false},"body":"The time stamps returned by ticks_ms() overflow after a while.\r\nTherefore they should not simply be added or subtracted.\r\nticks_add(9 and ticks_diff() are to be used instead.\r\n\r\nAlso: pull upfront the downlink send time by 8 ms to cope with internal\r\ndelays. Then there is a better match with the receive window1.","created_at":"2018-03-03T17:41:21Z","updated_at":"2018-03-03T20:23:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79add64a4ba9bac8b4f425de6f2c874cde08efb9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pycom/pycom-libraries/pulls/54/commits","review_comments_url":"https://api.github.com/repos/pycom/pycom-libraries/pulls/54/comments","review_comment_url":"https://api.github.com/repos/pycom/pycom-libraries/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pycom/pycom-libraries/issues/54/comments","statuses_url":"https://api.github.com/repos/pycom/pycom-libraries/statuses/bdf7befb80e42038903930a6a8dbb2ca96f7e743","head":{"label":"robert-hh:nanogateway","ref":"nanogateway","sha":"bdf7befb80e42038903930a6a8dbb2ca96f7e743","user":{"login":"robert-hh","id":12476868,"avatar_url":"https://avatars1.githubusercontent.com/u/12476868?v=4","gravatar_id":"","url":"https://api.github.com/users/robert-hh","html_url":"https://github.com/robert-hh","followers_url":"https://api.github.com/users/robert-hh/followers","following_url":"https://api.github.com/users/robert-hh/following{/other_user}","gists_url":"https://api.github.com/users/robert-hh/gists{/gist_id}","starred_url":"https://api.github.com/users/robert-hh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robert-hh/subscriptions","organizations_url":"https://api.github.com/users/robert-hh/orgs","repos_url":"https://api.github.com/users/robert-hh/repos","events_url":"https://api.github.com/users/robert-hh/events{/privacy}","received_events_url":"https://api.github.com/users/robert-hh/received_events","type":"User","site_admin":false},"repo":{"id":123714800,"name":"pycom-libraries","full_name":"robert-hh/pycom-libraries","owner":{"login":"robert-hh","id":12476868,"avatar_url":"https://avatars1.githubusercontent.com/u/12476868?v=4","gravatar_id":"","url":"https://api.github.com/users/robert-hh","html_url":"https://github.com/robert-hh","followers_url":"https://api.github.com/users/robert-hh/followers","following_url":"https://api.github.com/users/robert-hh/following{/other_user}","gists_url":"https://api.github.com/users/robert-hh/gists{/gist_id}","starred_url":"https://api.github.com/users/robert-hh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robert-hh/subscriptions","organizations_url":"https://api.github.com/users/robert-hh/orgs","repos_url":"https://api.github.com/users/robert-hh/repos","events_url":"https://api.github.com/users/robert-hh/events{/privacy}","received_events_url":"https://api.github.com/users/robert-hh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robert-hh/pycom-libraries","description":"MicroPython libraries and examples that work out of the box on Pycom's IoT modules","fork":true,"url":"https://api.github.com/repos/robert-hh/pycom-libraries","forks_url":"https://api.github.com/repos/robert-hh/pycom-libraries/forks","keys_url":"https://api.github.com/repos/robert-hh/pycom-libraries/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robert-hh/pycom-libraries/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robert-hh/pycom-libraries/teams","hooks_url":"https://api.github.com/repos/robert-hh/pycom-libraries/hooks","issue_events_url":"https://api.github.com/repos/robert-hh/pycom-libraries/issues/events{/number}","events_url":"https://api.github.com/repos/robert-hh/pycom-libraries/events","assignees_url":"https://api.github.com/repos/robert-hh/pycom-libraries/assignees{/user}","branches_url":"https://api.github.com/repos/robert-hh/pycom-libraries/branches{/branch}","tags_url":"https://api.github.com/repos/robert-hh/pycom-libraries/tags","blobs_url":"https://api.github.com/repos/robert-hh/pycom-libraries/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robert-hh/pycom-libraries/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robert-hh/pycom-libraries/git/refs{/sha}","trees_url":"https://api.github.com/repos/robert-hh/pycom-libraries/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robert-hh/pycom-libraries/statuses/{sha}","languages_url":"https://api.github.com/repos/robert-hh/pycom-libraries/languages","stargazers_url":"https://api.github.com/repos/robert-hh/pycom-libraries/stargazers","contributors_url":"https://api.github.com/repos/robert-hh/pycom-libraries/contributors","subscribers_url":"https://api.github.com/repos/robert-hh/pycom-libraries/subscribers","subscription_url":"https://api.github.com/repos/robert-hh/pycom-libraries/subscription","commits_url":"https://api.github.com/repos/robert-hh/pycom-libraries/commits{/sha}","git_commits_url":"https://api.github.com/repos/robert-hh/pycom-libraries/git/commits{/sha}","comments_url":"https://api.github.com/repos/robert-hh/pycom-libraries/comments{/number}","issue_comment_url":"https://api.github.com/repos/robert-hh/pycom-libraries/issues/comments{/number}","contents_url":"https://api.github.com/repos/robert-hh/pycom-libraries/contents/{+path}","compare_url":"https://api.github.com/repos/robert-hh/pycom-libraries/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robert-hh/pycom-libraries/merges","archive_url":"https://api.github.com/repos/robert-hh/pycom-libraries/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robert-hh/pycom-libraries/downloads","issues_url":"https://api.github.com/repos/robert-hh/pycom-libraries/issues{/number}","pulls_url":"https://api.github.com/repos/robert-hh/pycom-libraries/pulls{/number}","milestones_url":"https://api.github.com/repos/robert-hh/pycom-libraries/milestones{/number}","notifications_url":"https://api.github.com/repos/robert-hh/pycom-libraries/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robert-hh/pycom-libraries/labels{/name}","releases_url":"https://api.github.com/repos/robert-hh/pycom-libraries/releases{/id}","deployments_url":"https://api.github.com/repos/robert-hh/pycom-libraries/deployments","created_at":"2018-03-03T17:25:36Z","updated_at":"2018-03-03T17:25:37Z","pushed_at":"2018-03-03T17:38:28Z","git_url":"git://github.com/robert-hh/pycom-libraries.git","ssh_url":"git@github.com:robert-hh/pycom-libraries.git","clone_url":"https://github.com/robert-hh/pycom-libraries.git","svn_url":"https://github.com/robert-hh/pycom-libraries","homepage":null,"size":929,"stargazers_count":0,"watchers_count":0,"language":"Python","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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pycom:master","ref":"master","sha":"ce0cfa57b06b3ef58a08d98bf7a33c6a7cffa4e2","user":{"login":"pycom","id":16415153,"avatar_url":"https://avatars2.githubusercontent.com/u/16415153?v=4","gravatar_id":"","url":"https://api.github.com/users/pycom","html_url":"https://github.com/pycom","followers_url":"https://api.github.com/users/pycom/followers","following_url":"https://api.github.com/users/pycom/following{/other_user}","gists_url":"https://api.github.com/users/pycom/gists{/gist_id}","starred_url":"https://api.github.com/users/pycom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pycom/subscriptions","organizations_url":"https://api.github.com/users/pycom/orgs","repos_url":"https://api.github.com/users/pycom/repos","events_url":"https://api.github.com/users/pycom/events{/privacy}","received_events_url":"https://api.github.com/users/pycom/received_events","type":"Organization","site_admin":false},"repo":{"id":78630626,"name":"pycom-libraries","full_name":"pycom/pycom-libraries","owner":{"login":"pycom","id":16415153,"avatar_url":"https://avatars2.githubusercontent.com/u/16415153?v=4","gravatar_id":"","url":"https://api.github.com/users/pycom","html_url":"https://github.com/pycom","followers_url":"https://api.github.com/users/pycom/followers","following_url":"https://api.github.com/users/pycom/following{/other_user}","gists_url":"https://api.github.com/users/pycom/gists{/gist_id}","starred_url":"https://api.github.com/users/pycom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pycom/subscriptions","organizations_url":"https://api.github.com/users/pycom/orgs","repos_url":"https://api.github.com/users/pycom/repos","events_url":"https://api.github.com/users/pycom/events{/privacy}","received_events_url":"https://api.github.com/users/pycom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pycom/pycom-libraries","description":"MicroPython libraries and examples that work out of the box on Pycom's IoT modules","fork":false,"url":"https://api.github.com/repos/pycom/pycom-libraries","forks_url":"https://api.github.com/repos/pycom/pycom-libraries/forks","keys_url":"https://api.github.com/repos/pycom/pycom-libraries/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pycom/pycom-libraries/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pycom/pycom-libraries/teams","hooks_url":"https://api.github.com/repos/pycom/pycom-libraries/hooks","issue_events_url":"https://api.github.com/repos/pycom/pycom-libraries/issues/events{/number}","events_url":"https://api.github.com/repos/pycom/pycom-libraries/events","assignees_url":"https://api.github.com/repos/pycom/pycom-libraries/assignees{/user}","branches_url":"https://api.github.com/repos/pycom/pycom-libraries/branches{/branch}","tags_url":"https://api.github.com/repos/pycom/pycom-libraries/tags","blobs_url":"https://api.github.com/repos/pycom/pycom-libraries/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pycom/pycom-libraries/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pycom/pycom-libraries/git/refs{/sha}","trees_url":"https://api.github.com/repos/pycom/pycom-libraries/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pycom/pycom-libraries/statuses/{sha}","languages_url":"https://api.github.com/repos/pycom/pycom-libraries/languages","stargazers_url":"https://api.github.com/repos/pycom/pycom-libraries/stargazers","contributors_url":"https://api.github.com/repos/pycom/pycom-libraries/contributors","subscribers_url":"https://api.github.com/repos/pycom/pycom-libraries/subscribers","subscription_url":"https://api.github.com/repos/pycom/pycom-libraries/subscription","commits_url":"https://api.github.com/repos/pycom/pycom-libraries/commits{/sha}","git_commits_url":"https://api.github.com/repos/pycom/pycom-libraries/git/commits{/sha}","comments_url":"https://api.github.com/repos/pycom/pycom-libraries/comments{/number}","issue_comment_url":"https://api.github.com/repos/pycom/pycom-libraries/issues/comments{/number}","contents_url":"https://api.github.com/repos/pycom/pycom-libraries/contents/{+path}","compare_url":"https://api.github.com/repos/pycom/pycom-libraries/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pycom/pycom-libraries/merges","archive_url":"https://api.github.com/repos/pycom/pycom-libraries/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pycom/pycom-libraries/downloads","issues_url":"https://api.github.com/repos/pycom/pycom-libraries/issues{/number}","pulls_url":"https://api.github.com/repos/pycom/pycom-libraries/pulls{/number}","milestones_url":"https://api.github.com/repos/pycom/pycom-libraries/milestones{/number}","notifications_url":"https://api.github.com/repos/pycom/pycom-libraries/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pycom/pycom-libraries/labels{/name}","releases_url":"https://api.github.com/repos/pycom/pycom-libraries/releases{/id}","deployments_url":"https://api.github.com/repos/pycom/pycom-libraries/deployments","created_at":"2017-01-11T11:01:00Z","updated_at":"2018-03-03T18:28:10Z","pushed_at":"2018-03-03T17:41:22Z","git_url":"git://github.com/pycom/pycom-libraries.git","ssh_url":"git@github.com:pycom/pycom-libraries.git","clone_url":"https://github.com/pycom/pycom-libraries.git","svn_url":"https://github.com/pycom/pycom-libraries","homepage":null,"size":928,"stargazers_count":83,"watchers_count":83,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":24,"license":null,"forks":90,"open_issues":24,"watchers":83,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pycom/pycom-libraries/pulls/54"},"html":{"href":"https://github.com/pycom/pycom-libraries/pull/54"},"issue":{"href":"https://api.github.com/repos/pycom/pycom-libraries/issues/54"},"comments":{"href":"https://api.github.com/repos/pycom/pycom-libraries/issues/54/comments"},"review_comments":{"href":"https://api.github.com/repos/pycom/pycom-libraries/pulls/54/comments"},"review_comment":{"href":"https://api.github.com/repos/pycom/pycom-libraries/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pycom/pycom-libraries/pulls/54/commits"},"statuses":{"href":"https://api.github.com/repos/pycom/pycom-libraries/statuses/bdf7befb80e42038903930a6a8dbb2ca96f7e743"}},"author_association":"NONE"}}
{"actor":{"display_login":"danicampora"}}