{"action":"created","comment":{"url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/comments/26719335","id":26719335,"diff_hunk":"@@ -1732,13 +1729,24 @@ port_INLINE void asnStoreFromAdv(uint8_t* asn) {\n    ieee154e_vars.asn.bytes2and3   =     asn[2]+\r\n                                     256*asn[3];\r\n    ieee154e_vars.asn.byte4        =     asn[4];\r\n-   \r\n    // determine the current slotOffset\r\n-   /*\r\n-   Note: this is a bit of a hack. Normally, slotOffset=ASN%slotlength. But since\r\n-   the ADV is exchanged in slot 0, we know that we're currently at slotOffset==0\r\n-   */\r\n-   ieee154e_vars.slotOffset       = 0;\r\n+}\r\n+\r\n+port_INLINE void ieee154e_syncSlotOffset() {\r\n+   frameLength_t frameLength;\r\n+   uint32_t slotOffset;\r\n+   \r\n+   frameLength = schedule_getFrameLength();\r\n+   slotOffset = ieee154e_vars.asn.byte4;\r\n+   slotOffset = slotOffset % frameLength;\r\n+   slotOffset = slotOffset << 16;\r\n+   slotOffset = slotOffset + ieee154e_vars.asn.bytes2and3;\r\n+   slotOffset = slotOffset % frameLength;\r\n+   slotOffset = slotOffset << 16;\r\n+   slotOffset = slotOffset + ieee154e_vars.asn.bytes0and1;\r\n+   slotOffset = slotOffset % frameLength;\r","path":"openstack/02a-MAClow/IEEE802154E.c","position":182,"original_position":182,"commit_id":"dbdf48daf43b0cc629fe298b91dd09056048fd32","original_commit_id":"dbdf48daf43b0cc629fe298b91dd09056048fd32","user":{"login":"NicolaAccettura","id":7969343,"avatar_url":"https://avatars.githubusercontent.com/u/7969343?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolaAccettura","html_url":"https://github.com/NicolaAccettura","followers_url":"https://api.github.com/users/NicolaAccettura/followers","following_url":"https://api.github.com/users/NicolaAccettura/following{/other_user}","gists_url":"https://api.github.com/users/NicolaAccettura/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolaAccettura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolaAccettura/subscriptions","organizations_url":"https://api.github.com/users/NicolaAccettura/orgs","repos_url":"https://api.github.com/users/NicolaAccettura/repos","events_url":"https://api.github.com/users/NicolaAccettura/events{/privacy}","received_events_url":"https://api.github.com/users/NicolaAccettura/received_events","type":"User","site_admin":false},"body":"I found this trick, but I was almost sure it was nothing new:\r\nhttp://www.devx.com/tips/Tip/39012","created_at":"2015-03-18T23:51:14Z","updated_at":"2015-03-18T23:51:14Z","html_url":"https://github.com/openwsn-berkeley/openwsn-fw/pull/157#discussion_r26719335","pull_request_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/comments/26719335"},"html":{"href":"https://github.com/openwsn-berkeley/openwsn-fw/pull/157#discussion_r26719335"},"pull_request":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/157","id":31396843,"html_url":"https://github.com/openwsn-berkeley/openwsn-fw/pull/157","diff_url":"https://github.com/openwsn-berkeley/openwsn-fw/pull/157.diff","patch_url":"https://github.com/openwsn-berkeley/openwsn-fw/pull/157.patch","issue_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/issues/157","number":157,"state":"open","locked":false,"title":"FW-228. Fix.","user":{"login":"NicolaAccettura","id":7969343,"avatar_url":"https://avatars.githubusercontent.com/u/7969343?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolaAccettura","html_url":"https://github.com/NicolaAccettura","followers_url":"https://api.github.com/users/NicolaAccettura/followers","following_url":"https://api.github.com/users/NicolaAccettura/following{/other_user}","gists_url":"https://api.github.com/users/NicolaAccettura/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolaAccettura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolaAccettura/subscriptions","organizations_url":"https://api.github.com/users/NicolaAccettura/orgs","repos_url":"https://api.github.com/users/NicolaAccettura/repos","events_url":"https://api.github.com/users/NicolaAccettura/events{/privacy}","received_events_url":"https://api.github.com/users/NicolaAccettura/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-18T02:55:11Z","updated_at":"2015-03-18T23:51:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0357dbf49ce073bdde131b0aeaad379d6923721a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/157/commits","review_comments_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/157/comments","review_comment_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/issues/157/comments","statuses_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/statuses/dbdf48daf43b0cc629fe298b91dd09056048fd32","head":{"label":"NicolaAccettura:develop_FW-228","ref":"develop_FW-228","sha":"dbdf48daf43b0cc629fe298b91dd09056048fd32","user":{"login":"NicolaAccettura","id":7969343,"avatar_url":"https://avatars.githubusercontent.com/u/7969343?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolaAccettura","html_url":"https://github.com/NicolaAccettura","followers_url":"https://api.github.com/users/NicolaAccettura/followers","following_url":"https://api.github.com/users/NicolaAccettura/following{/other_user}","gists_url":"https://api.github.com/users/NicolaAccettura/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolaAccettura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolaAccettura/subscriptions","organizations_url":"https://api.github.com/users/NicolaAccettura/orgs","repos_url":"https://api.github.com/users/NicolaAccettura/repos","events_url":"https://api.github.com/users/NicolaAccettura/events{/privacy}","received_events_url":"https://api.github.com/users/NicolaAccettura/received_events","type":"User","site_admin":false},"repo":{"id":24998141,"name":"openwsn-fw","full_name":"NicolaAccettura/openwsn-fw","owner":{"login":"NicolaAccettura","id":7969343,"avatar_url":"https://avatars.githubusercontent.com/u/7969343?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolaAccettura","html_url":"https://github.com/NicolaAccettura","followers_url":"https://api.github.com/users/NicolaAccettura/followers","following_url":"https://api.github.com/users/NicolaAccettura/following{/other_user}","gists_url":"https://api.github.com/users/NicolaAccettura/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolaAccettura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolaAccettura/subscriptions","organizations_url":"https://api.github.com/users/NicolaAccettura/orgs","repos_url":"https://api.github.com/users/NicolaAccettura/repos","events_url":"https://api.github.com/users/NicolaAccettura/events{/privacy}","received_events_url":"https://api.github.com/users/NicolaAccettura/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NicolaAccettura/openwsn-fw","description":"OpenWSN firmware: stuff that runs on a mote","fork":true,"url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw","forks_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/forks","keys_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/teams","hooks_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/hooks","issue_events_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/issues/events{/number}","events_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/events","assignees_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/assignees{/user}","branches_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/branches{/branch}","tags_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/tags","blobs_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/git/refs{/sha}","trees_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/statuses/{sha}","languages_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/languages","stargazers_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/stargazers","contributors_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/contributors","subscribers_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/subscribers","subscription_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/subscription","commits_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/commits{/sha}","git_commits_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/git/commits{/sha}","comments_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/comments{/number}","issue_comment_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/issues/comments{/number}","contents_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/contents/{+path}","compare_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/merges","archive_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/downloads","issues_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/issues{/number}","pulls_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/pulls{/number}","milestones_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/milestones{/number}","notifications_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/labels{/name}","releases_url":"https://api.github.com/repos/NicolaAccettura/openwsn-fw/releases{/id}","created_at":"2014-10-09T16:27:03Z","updated_at":"2015-03-06T03:02:36Z","pushed_at":"2015-03-18T03:00:19Z","git_url":"git://github.com/NicolaAccettura/openwsn-fw.git","ssh_url":"git@github.com:NicolaAccettura/openwsn-fw.git","clone_url":"https://github.com/NicolaAccettura/openwsn-fw.git","svn_url":"https://github.com/NicolaAccettura/openwsn-fw","homepage":"http://www.openwsn.org/","size":8716,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"openwsn-berkeley:develop","ref":"develop","sha":"1f1964b6b4de2149089336696effd2e8bf35370e","user":{"login":"openwsn-berkeley","id":2546411,"avatar_url":"https://avatars.githubusercontent.com/u/2546411?v=3","gravatar_id":"","url":"https://api.github.com/users/openwsn-berkeley","html_url":"https://github.com/openwsn-berkeley","followers_url":"https://api.github.com/users/openwsn-berkeley/followers","following_url":"https://api.github.com/users/openwsn-berkeley/following{/other_user}","gists_url":"https://api.github.com/users/openwsn-berkeley/gists{/gist_id}","starred_url":"https://api.github.com/users/openwsn-berkeley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openwsn-berkeley/subscriptions","organizations_url":"https://api.github.com/users/openwsn-berkeley/orgs","repos_url":"https://api.github.com/users/openwsn-berkeley/repos","events_url":"https://api.github.com/users/openwsn-berkeley/events{/privacy}","received_events_url":"https://api.github.com/users/openwsn-berkeley/received_events","type":"Organization","site_admin":false},"repo":{"id":6193747,"name":"openwsn-fw","full_name":"openwsn-berkeley/openwsn-fw","owner":{"login":"openwsn-berkeley","id":2546411,"avatar_url":"https://avatars.githubusercontent.com/u/2546411?v=3","gravatar_id":"","url":"https://api.github.com/users/openwsn-berkeley","html_url":"https://github.com/openwsn-berkeley","followers_url":"https://api.github.com/users/openwsn-berkeley/followers","following_url":"https://api.github.com/users/openwsn-berkeley/following{/other_user}","gists_url":"https://api.github.com/users/openwsn-berkeley/gists{/gist_id}","starred_url":"https://api.github.com/users/openwsn-berkeley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openwsn-berkeley/subscriptions","organizations_url":"https://api.github.com/users/openwsn-berkeley/orgs","repos_url":"https://api.github.com/users/openwsn-berkeley/repos","events_url":"https://api.github.com/users/openwsn-berkeley/events{/privacy}","received_events_url":"https://api.github.com/users/openwsn-berkeley/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openwsn-berkeley/openwsn-fw","description":"OpenWSN firmware: stuff that runs on a mote","fork":false,"url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw","forks_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/forks","keys_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/teams","hooks_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/hooks","issue_events_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/issues/events{/number}","events_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/events","assignees_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/assignees{/user}","branches_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/branches{/branch}","tags_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/tags","blobs_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/git/refs{/sha}","trees_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/statuses/{sha}","languages_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/languages","stargazers_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/stargazers","contributors_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/contributors","subscribers_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/subscribers","subscription_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/subscription","commits_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/commits{/sha}","git_commits_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/git/commits{/sha}","comments_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/comments{/number}","issue_comment_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/issues/comments{/number}","contents_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/contents/{+path}","compare_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/merges","archive_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/downloads","issues_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/issues{/number}","pulls_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls{/number}","milestones_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/milestones{/number}","notifications_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/labels{/name}","releases_url":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/releases{/id}","created_at":"2012-10-12T17:23:32Z","updated_at":"2015-03-18T21:57:36Z","pushed_at":"2015-03-18T21:57:36Z","git_url":"git://github.com/openwsn-berkeley/openwsn-fw.git","ssh_url":"git@github.com:openwsn-berkeley/openwsn-fw.git","clone_url":"https://github.com/openwsn-berkeley/openwsn-fw.git","svn_url":"https://github.com/openwsn-berkeley/openwsn-fw","homepage":"http://www.openwsn.org/","size":22156,"stargazers_count":38,"watchers_count":38,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":3,"forks":69,"open_issues":3,"watchers":38,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/157"},"html":{"href":"https://github.com/openwsn-berkeley/openwsn-fw/pull/157"},"issue":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/issues/157"},"comments":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/openwsn-berkeley/openwsn-fw/statuses/dbdf48daf43b0cc629fe298b91dd09056048fd32"}}}}