{"action":"created","comment":{"url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/comments/73081339","id":73081339,"diff_hunk":"@@ -153,4 +162,66 @@ bool receive_rc(uint32_t now)\n   return true;\n }\n \n+void calibrate_rc()\n+{\n+  if(_armed_state == ARMED)\n+  {\n+    mavlink_log_error(\"Cannot calibrate RC when FCU is armed\");\n+  }\n+  else\n+  {\n+    // Calibrate Extents of RC Transmitter\n+    mavlink_log_warning(\"Calibrating RC, move sticks to full extents\");\n+    mavlink_log_warning(\"in the next 10s\");\n+    uint32_t now = micros();\n+    static int32_t max[4] = {0, 0, 0, 0};\n+    static int32_t min[4] = {10000, 10000, 10000, 10000};\n+    while(micros() - now < 1e7)\n+    {\n+      for(int16_t i = 0; i < 4; i++)\n+      {\n+        int32_t read_value = (int32_t)pwmRead(i);\n+        if(read_value > max[i])\n+        {\n+          max[i] = read_value;\n+        }\n+        if(read_value < min[i])\n+        {\n+          min[i] = read_value;\n+        }\n+      }\n+      delay(10);\n+    }\n+    _params.values[PARAM_RC_X_RANGE] = max[_params.values[PARAM_RC_X_CHANNEL]] - min[_params.values[PARAM_RC_X_CHANNEL]];","path":"src/rc.c","position":146,"original_position":63,"commit_id":"dcd8b0853033f8137a8de8927aefad6e9d11be78","original_commit_id":"e86b55228369abc8470175123b198a990a3c0e0e","user":{"login":"superjax","id":7344014,"avatar_url":"https://avatars.githubusercontent.com/u/7344014?v=3","gravatar_id":"","url":"https://api.github.com/users/superjax","html_url":"https://github.com/superjax","followers_url":"https://api.github.com/users/superjax/followers","following_url":"https://api.github.com/users/superjax/following{/other_user}","gists_url":"https://api.github.com/users/superjax/gists{/gist_id}","starred_url":"https://api.github.com/users/superjax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superjax/subscriptions","organizations_url":"https://api.github.com/users/superjax/orgs","repos_url":"https://api.github.com/users/superjax/repos","events_url":"https://api.github.com/users/superjax/events{/privacy}","received_events_url":"https://api.github.com/users/superjax/received_events","type":"User","site_admin":false},"body":"I think that we can require that the range is equally spaced about the center.  (It would be pretty weird to have something else).\r\n\r\nI have a pull request pending (rc_switch branch) that builds a switch_t with a direction.  As for the actual channels, the transmitter is a more convenient place to have the direction switch.  (I used to have a direction switch for each, but then I messed it up so many times that I just decided to leave it on the transmitter, rather than dealing with it in code.)","created_at":"2016-08-02T01:24:56Z","updated_at":"2016-08-02T01:24:56Z","html_url":"https://github.com/BYU-MAGICC/ROSflight2/pull/62#discussion_r73081339","pull_request_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/comments/73081339"},"html":{"href":"https://github.com/BYU-MAGICC/ROSflight2/pull/62#discussion_r73081339"},"pull_request":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/62","id":79095662,"html_url":"https://github.com/BYU-MAGICC/ROSflight2/pull/62","diff_url":"https://github.com/BYU-MAGICC/ROSflight2/pull/62.diff","patch_url":"https://github.com/BYU-MAGICC/ROSflight2/pull/62.patch","issue_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues/62","number":62,"state":"open","locked":false,"title":"Offboard","user":{"login":"superjax","id":7344014,"avatar_url":"https://avatars.githubusercontent.com/u/7344014?v=3","gravatar_id":"","url":"https://api.github.com/users/superjax","html_url":"https://github.com/superjax","followers_url":"https://api.github.com/users/superjax/followers","following_url":"https://api.github.com/users/superjax/following{/other_user}","gists_url":"https://api.github.com/users/superjax/gists{/gist_id}","starred_url":"https://api.github.com/users/superjax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superjax/subscriptions","organizations_url":"https://api.github.com/users/superjax/orgs","repos_url":"https://api.github.com/users/superjax/repos","events_url":"https://api.github.com/users/superjax/events{/privacy}","received_events_url":"https://api.github.com/users/superjax/received_events","type":"User","site_admin":false},"body":"Few changes after #60, which incorporate RC trim setting and tested offboard control.","created_at":"2016-07-27T20:52:02Z","updated_at":"2016-08-02T01:24:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"43618d7b1ec4952be1774ca57ebb3f3bb3641915","assignee":{"login":"dpkoch","id":2702490,"avatar_url":"https://avatars.githubusercontent.com/u/2702490?v=3","gravatar_id":"","url":"https://api.github.com/users/dpkoch","html_url":"https://github.com/dpkoch","followers_url":"https://api.github.com/users/dpkoch/followers","following_url":"https://api.github.com/users/dpkoch/following{/other_user}","gists_url":"https://api.github.com/users/dpkoch/gists{/gist_id}","starred_url":"https://api.github.com/users/dpkoch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpkoch/subscriptions","organizations_url":"https://api.github.com/users/dpkoch/orgs","repos_url":"https://api.github.com/users/dpkoch/repos","events_url":"https://api.github.com/users/dpkoch/events{/privacy}","received_events_url":"https://api.github.com/users/dpkoch/received_events","type":"User","site_admin":false},"assignees":[{"login":"dpkoch","id":2702490,"avatar_url":"https://avatars.githubusercontent.com/u/2702490?v=3","gravatar_id":"","url":"https://api.github.com/users/dpkoch","html_url":"https://github.com/dpkoch","followers_url":"https://api.github.com/users/dpkoch/followers","following_url":"https://api.github.com/users/dpkoch/following{/other_user}","gists_url":"https://api.github.com/users/dpkoch/gists{/gist_id}","starred_url":"https://api.github.com/users/dpkoch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpkoch/subscriptions","organizations_url":"https://api.github.com/users/dpkoch/orgs","repos_url":"https://api.github.com/users/dpkoch/repos","events_url":"https://api.github.com/users/dpkoch/events{/privacy}","received_events_url":"https://api.github.com/users/dpkoch/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/62/commits","review_comments_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/62/comments","review_comment_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues/62/comments","statuses_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/statuses/dcd8b0853033f8137a8de8927aefad6e9d11be78","head":{"label":"BYU-MAGICC:offboard","ref":"offboard","sha":"dcd8b0853033f8137a8de8927aefad6e9d11be78","user":{"login":"BYU-MAGICC","id":17009201,"avatar_url":"https://avatars.githubusercontent.com/u/17009201?v=3","gravatar_id":"","url":"https://api.github.com/users/BYU-MAGICC","html_url":"https://github.com/BYU-MAGICC","followers_url":"https://api.github.com/users/BYU-MAGICC/followers","following_url":"https://api.github.com/users/BYU-MAGICC/following{/other_user}","gists_url":"https://api.github.com/users/BYU-MAGICC/gists{/gist_id}","starred_url":"https://api.github.com/users/BYU-MAGICC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BYU-MAGICC/subscriptions","organizations_url":"https://api.github.com/users/BYU-MAGICC/orgs","repos_url":"https://api.github.com/users/BYU-MAGICC/repos","events_url":"https://api.github.com/users/BYU-MAGICC/events{/privacy}","received_events_url":"https://api.github.com/users/BYU-MAGICC/received_events","type":"Organization","site_admin":false},"repo":{"id":58241730,"name":"ROSflight2","full_name":"BYU-MAGICC/ROSflight2","owner":{"login":"BYU-MAGICC","id":17009201,"avatar_url":"https://avatars.githubusercontent.com/u/17009201?v=3","gravatar_id":"","url":"https://api.github.com/users/BYU-MAGICC","html_url":"https://github.com/BYU-MAGICC","followers_url":"https://api.github.com/users/BYU-MAGICC/followers","following_url":"https://api.github.com/users/BYU-MAGICC/following{/other_user}","gists_url":"https://api.github.com/users/BYU-MAGICC/gists{/gist_id}","starred_url":"https://api.github.com/users/BYU-MAGICC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BYU-MAGICC/subscriptions","organizations_url":"https://api.github.com/users/BYU-MAGICC/orgs","repos_url":"https://api.github.com/users/BYU-MAGICC/repos","events_url":"https://api.github.com/users/BYU-MAGICC/events{/privacy}","received_events_url":"https://api.github.com/users/BYU-MAGICC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BYU-MAGICC/ROSflight2","description":"Flight stack for the Naze32 autopilot, designed from the ground up for offboard control with ROS","fork":false,"url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2","forks_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/forks","keys_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/teams","hooks_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/hooks","issue_events_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues/events{/number}","events_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/events","assignees_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/assignees{/user}","branches_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/branches{/branch}","tags_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/tags","blobs_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/refs{/sha}","trees_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/statuses/{sha}","languages_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/languages","stargazers_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/stargazers","contributors_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/contributors","subscribers_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/subscribers","subscription_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/subscription","commits_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/commits{/sha}","git_commits_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/commits{/sha}","comments_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/comments{/number}","issue_comment_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues/comments{/number}","contents_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/contents/{+path}","compare_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/merges","archive_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/downloads","issues_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues{/number}","pulls_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls{/number}","milestones_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/milestones{/number}","notifications_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/labels{/name}","releases_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/releases{/id}","deployments_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/deployments","created_at":"2016-05-07T00:20:13Z","updated_at":"2016-07-01T16:52:08Z","pushed_at":"2016-07-27T20:52:02Z","git_url":"git://github.com/BYU-MAGICC/ROSflight2.git","ssh_url":"git@github.com:BYU-MAGICC/ROSflight2.git","clone_url":"https://github.com/BYU-MAGICC/ROSflight2.git","svn_url":"https://github.com/BYU-MAGICC/ROSflight2","homepage":null,"size":608,"stargazers_count":4,"watchers_count":4,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":12,"forks":1,"open_issues":12,"watchers":4,"default_branch":"master"}},"base":{"label":"BYU-MAGICC:master","ref":"master","sha":"a197cfcb207e78a6df6aba49e7ff764f01d04290","user":{"login":"BYU-MAGICC","id":17009201,"avatar_url":"https://avatars.githubusercontent.com/u/17009201?v=3","gravatar_id":"","url":"https://api.github.com/users/BYU-MAGICC","html_url":"https://github.com/BYU-MAGICC","followers_url":"https://api.github.com/users/BYU-MAGICC/followers","following_url":"https://api.github.com/users/BYU-MAGICC/following{/other_user}","gists_url":"https://api.github.com/users/BYU-MAGICC/gists{/gist_id}","starred_url":"https://api.github.com/users/BYU-MAGICC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BYU-MAGICC/subscriptions","organizations_url":"https://api.github.com/users/BYU-MAGICC/orgs","repos_url":"https://api.github.com/users/BYU-MAGICC/repos","events_url":"https://api.github.com/users/BYU-MAGICC/events{/privacy}","received_events_url":"https://api.github.com/users/BYU-MAGICC/received_events","type":"Organization","site_admin":false},"repo":{"id":58241730,"name":"ROSflight2","full_name":"BYU-MAGICC/ROSflight2","owner":{"login":"BYU-MAGICC","id":17009201,"avatar_url":"https://avatars.githubusercontent.com/u/17009201?v=3","gravatar_id":"","url":"https://api.github.com/users/BYU-MAGICC","html_url":"https://github.com/BYU-MAGICC","followers_url":"https://api.github.com/users/BYU-MAGICC/followers","following_url":"https://api.github.com/users/BYU-MAGICC/following{/other_user}","gists_url":"https://api.github.com/users/BYU-MAGICC/gists{/gist_id}","starred_url":"https://api.github.com/users/BYU-MAGICC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BYU-MAGICC/subscriptions","organizations_url":"https://api.github.com/users/BYU-MAGICC/orgs","repos_url":"https://api.github.com/users/BYU-MAGICC/repos","events_url":"https://api.github.com/users/BYU-MAGICC/events{/privacy}","received_events_url":"https://api.github.com/users/BYU-MAGICC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BYU-MAGICC/ROSflight2","description":"Flight stack for the Naze32 autopilot, designed from the ground up for offboard control with ROS","fork":false,"url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2","forks_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/forks","keys_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/teams","hooks_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/hooks","issue_events_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues/events{/number}","events_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/events","assignees_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/assignees{/user}","branches_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/branches{/branch}","tags_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/tags","blobs_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/refs{/sha}","trees_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/statuses/{sha}","languages_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/languages","stargazers_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/stargazers","contributors_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/contributors","subscribers_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/subscribers","subscription_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/subscription","commits_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/commits{/sha}","git_commits_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/git/commits{/sha}","comments_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/comments{/number}","issue_comment_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues/comments{/number}","contents_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/contents/{+path}","compare_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/merges","archive_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/downloads","issues_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues{/number}","pulls_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls{/number}","milestones_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/milestones{/number}","notifications_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/labels{/name}","releases_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/releases{/id}","deployments_url":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/deployments","created_at":"2016-05-07T00:20:13Z","updated_at":"2016-07-01T16:52:08Z","pushed_at":"2016-07-27T20:52:02Z","git_url":"git://github.com/BYU-MAGICC/ROSflight2.git","ssh_url":"git@github.com:BYU-MAGICC/ROSflight2.git","clone_url":"https://github.com/BYU-MAGICC/ROSflight2.git","svn_url":"https://github.com/BYU-MAGICC/ROSflight2","homepage":null,"size":608,"stargazers_count":4,"watchers_count":4,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":12,"forks":1,"open_issues":12,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/62"},"html":{"href":"https://github.com/BYU-MAGICC/ROSflight2/pull/62"},"issue":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues/62"},"comments":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/BYU-MAGICC/ROSflight2/statuses/dcd8b0853033f8137a8de8927aefad6e9d11be78"}}}}
{"actor":{"display_login":"superjax"}}