{"action":"created","comment":{"url":"https://api.github.com/repos/diydrones/ardupilot/pulls/comments/38374091","id":38374091,"diff_hunk":"@@ -0,0 +1,243 @@\n+/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-\n+#include <AP_HAL/AP_HAL.h>\n+#include \"Compass.h\"\n+#include <AP_Notify/AP_Notify.h>\n+\n+extern AP_HAL::HAL& hal;\n+\n+void\n+Compass::compass_cal_update()\n+{\n+    AP_Notify::flags.compass_cal_running = 0;\n+\n+    for (uint8_t i=0; i<COMPASS_MAX_INSTANCES; i++) {\n+        bool failure;\n+        _calibrator[i].update(failure);\n+        if (failure) {\n+            AP_Notify::events.compass_cal_failed = 1;\n+        }\n+\n+        if (_calibrator[i].check_for_timeout()) {\n+            AP_Notify::events.compass_cal_failed = 1;\n+            cancel_calibration_all();\n+        }\n+\n+        if (_calibrator[i].running()) {\n+            AP_Notify::flags.compass_cal_running = 1;\n+        }\n+    }\n+}\n+\n+bool\n+Compass::start_calibration(uint8_t i, bool retry, bool autosave, float delay, bool autoreboot)\n+{\n+    if (healthy(i)) {","path":"libraries/AP_Compass/AP_Compass_Calibration.cpp","position":34,"original_position":34,"commit_id":"66d9b7a6423ee895464a9790f3d310b8dcd2aab2","original_commit_id":"66d9b7a6423ee895464a9790f3d310b8dcd2aab2","user":{"login":"bugobliterator","id":5697288,"avatar_url":"https://avatars.githubusercontent.com/u/5697288?v=3","gravatar_id":"","url":"https://api.github.com/users/bugobliterator","html_url":"https://github.com/bugobliterator","followers_url":"https://api.github.com/users/bugobliterator/followers","following_url":"https://api.github.com/users/bugobliterator/following{/other_user}","gists_url":"https://api.github.com/users/bugobliterator/gists{/gist_id}","starred_url":"https://api.github.com/users/bugobliterator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugobliterator/subscriptions","organizations_url":"https://api.github.com/users/bugobliterator/orgs","repos_url":"https://api.github.com/users/bugobliterator/repos","events_url":"https://api.github.com/users/bugobliterator/events{/privacy}","received_events_url":"https://api.github.com/users/bugobliterator/received_events","type":"User","site_admin":false},"body":"agreed","created_at":"2015-09-01T00:02:13Z","updated_at":"2015-09-01T00:02:13Z","html_url":"https://github.com/diydrones/ardupilot/pull/2779#discussion_r38374091","pull_request_url":"https://api.github.com/repos/diydrones/ardupilot/pulls/2779","_links":{"self":{"href":"https://api.github.com/repos/diydrones/ardupilot/pulls/comments/38374091"},"html":{"href":"https://github.com/diydrones/ardupilot/pull/2779#discussion_r38374091"},"pull_request":{"href":"https://api.github.com/repos/diydrones/ardupilot/pulls/2779"}}},"pull_request":{"url":"https://api.github.com/repos/diydrones/ardupilot/pulls/2779","id":43678388,"html_url":"https://github.com/diydrones/ardupilot/pull/2779","diff_url":"https://github.com/diydrones/ardupilot/pull/2779.diff","patch_url":"https://github.com/diydrones/ardupilot/pull/2779.patch","issue_url":"https://api.github.com/repos/diydrones/ardupilot/issues/2779","number":2779,"state":"open","locked":false,"title":"On-board Compass Calibration","user":{"login":"bugobliterator","id":5697288,"avatar_url":"https://avatars.githubusercontent.com/u/5697288?v=3","gravatar_id":"","url":"https://api.github.com/users/bugobliterator","html_url":"https://github.com/bugobliterator","followers_url":"https://api.github.com/users/bugobliterator/followers","following_url":"https://api.github.com/users/bugobliterator/following{/other_user}","gists_url":"https://api.github.com/users/bugobliterator/gists{/gist_id}","starred_url":"https://api.github.com/users/bugobliterator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugobliterator/subscriptions","organizations_url":"https://api.github.com/users/bugobliterator/orgs","repos_url":"https://api.github.com/users/bugobliterator/repos","events_url":"https://api.github.com/users/bugobliterator/events{/privacy}","received_events_url":"https://api.github.com/users/bugobliterator/received_events","type":"User","site_admin":false},"body":"Following are the series of patches to do onboard compass calibration as in 3DR Solo. The implementation details can be found in CompassCalibrator.cpp. Features and how to wire compass cal are as follows:\r\n* The compass calibrator does calculation of both hard and soft iron coefficients\r\n* proper spread of samples has been ensured (read comments in CompassCalibrator.cpp for explanation). The distribution progress is sent out as a part of MAG_CAL_PROGRESS mavlink message, checkout ardupilotmega.xml for other fields and their explanation.\r\n* after the completion of calibration subsequent MAG_CAL_REPORT is sent, please refer ardupilotmega.xml for details and explanation of each field in the message\r\n* For starting calibration MAV_CMD_DO_START_MAG_CAL is sent from GCS, the command consists of options: calibration mask, auto retry, autosave, delay, auto reboot. similarly to accept and cancel mag cal MAV_CMD_DO_ACCEPT_MAG_CAL and MAV_CMD_DO_CANCEL_MAG_CAL can be supplemented from GCS.\r\n\r\nNote: The compass calibrator has only been tested for pixhawk and pixhawk-v2 board especially on Solo and has been found to work seamlessly. Currently there is no GCS which supports this calibration process. GCS developers please contact @bugobliterator or @jschall if any assistance is required for the implementation.","created_at":"2015-08-28T22:29:17Z","updated_at":"2015-09-01T00:02:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb0032791b476beed33156603d774e3665d12005","assignee":{"login":"tridge","id":831867,"avatar_url":"https://avatars.githubusercontent.com/u/831867?v=3","gravatar_id":"","url":"https://api.github.com/users/tridge","html_url":"https://github.com/tridge","followers_url":"https://api.github.com/users/tridge/followers","following_url":"https://api.github.com/users/tridge/following{/other_user}","gists_url":"https://api.github.com/users/tridge/gists{/gist_id}","starred_url":"https://api.github.com/users/tridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tridge/subscriptions","organizations_url":"https://api.github.com/users/tridge/orgs","repos_url":"https://api.github.com/users/tridge/repos","events_url":"https://api.github.com/users/tridge/events{/privacy}","received_events_url":"https://api.github.com/users/tridge/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/diydrones/ardupilot/pulls/2779/commits","review_comments_url":"https://api.github.com/repos/diydrones/ardupilot/pulls/2779/comments","review_comment_url":"https://api.github.com/repos/diydrones/ardupilot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/diydrones/ardupilot/issues/2779/comments","statuses_url":"https://api.github.com/repos/diydrones/ardupilot/statuses/66d9b7a6423ee895464a9790f3d310b8dcd2aab2","head":{"label":"bugobliterator:pr-compass-cal","ref":"pr-compass-cal","sha":"66d9b7a6423ee895464a9790f3d310b8dcd2aab2","user":{"login":"bugobliterator","id":5697288,"avatar_url":"https://avatars.githubusercontent.com/u/5697288?v=3","gravatar_id":"","url":"https://api.github.com/users/bugobliterator","html_url":"https://github.com/bugobliterator","followers_url":"https://api.github.com/users/bugobliterator/followers","following_url":"https://api.github.com/users/bugobliterator/following{/other_user}","gists_url":"https://api.github.com/users/bugobliterator/gists{/gist_id}","starred_url":"https://api.github.com/users/bugobliterator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugobliterator/subscriptions","organizations_url":"https://api.github.com/users/bugobliterator/orgs","repos_url":"https://api.github.com/users/bugobliterator/repos","events_url":"https://api.github.com/users/bugobliterator/events{/privacy}","received_events_url":"https://api.github.com/users/bugobliterator/received_events","type":"User","site_admin":false},"repo":{"id":26210419,"name":"ardupilot","full_name":"bugobliterator/ardupilot","owner":{"login":"bugobliterator","id":5697288,"avatar_url":"https://avatars.githubusercontent.com/u/5697288?v=3","gravatar_id":"","url":"https://api.github.com/users/bugobliterator","html_url":"https://github.com/bugobliterator","followers_url":"https://api.github.com/users/bugobliterator/followers","following_url":"https://api.github.com/users/bugobliterator/following{/other_user}","gists_url":"https://api.github.com/users/bugobliterator/gists{/gist_id}","starred_url":"https://api.github.com/users/bugobliterator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugobliterator/subscriptions","organizations_url":"https://api.github.com/users/bugobliterator/orgs","repos_url":"https://api.github.com/users/bugobliterator/repos","events_url":"https://api.github.com/users/bugobliterator/events{/privacy}","received_events_url":"https://api.github.com/users/bugobliterator/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bugobliterator/ardupilot","description":"APM Plane, APM Copter, APM Rover source","fork":true,"url":"https://api.github.com/repos/bugobliterator/ardupilot","forks_url":"https://api.github.com/repos/bugobliterator/ardupilot/forks","keys_url":"https://api.github.com/repos/bugobliterator/ardupilot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bugobliterator/ardupilot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bugobliterator/ardupilot/teams","hooks_url":"https://api.github.com/repos/bugobliterator/ardupilot/hooks","issue_events_url":"https://api.github.com/repos/bugobliterator/ardupilot/issues/events{/number}","events_url":"https://api.github.com/repos/bugobliterator/ardupilot/events","assignees_url":"https://api.github.com/repos/bugobliterator/ardupilot/assignees{/user}","branches_url":"https://api.github.com/repos/bugobliterator/ardupilot/branches{/branch}","tags_url":"https://api.github.com/repos/bugobliterator/ardupilot/tags","blobs_url":"https://api.github.com/repos/bugobliterator/ardupilot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bugobliterator/ardupilot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bugobliterator/ardupilot/git/refs{/sha}","trees_url":"https://api.github.com/repos/bugobliterator/ardupilot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bugobliterator/ardupilot/statuses/{sha}","languages_url":"https://api.github.com/repos/bugobliterator/ardupilot/languages","stargazers_url":"https://api.github.com/repos/bugobliterator/ardupilot/stargazers","contributors_url":"https://api.github.com/repos/bugobliterator/ardupilot/contributors","subscribers_url":"https://api.github.com/repos/bugobliterator/ardupilot/subscribers","subscription_url":"https://api.github.com/repos/bugobliterator/ardupilot/subscription","commits_url":"https://api.github.com/repos/bugobliterator/ardupilot/commits{/sha}","git_commits_url":"https://api.github.com/repos/bugobliterator/ardupilot/git/commits{/sha}","comments_url":"https://api.github.com/repos/bugobliterator/ardupilot/comments{/number}","issue_comment_url":"https://api.github.com/repos/bugobliterator/ardupilot/issues/comments{/number}","contents_url":"https://api.github.com/repos/bugobliterator/ardupilot/contents/{+path}","compare_url":"https://api.github.com/repos/bugobliterator/ardupilot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bugobliterator/ardupilot/merges","archive_url":"https://api.github.com/repos/bugobliterator/ardupilot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bugobliterator/ardupilot/downloads","issues_url":"https://api.github.com/repos/bugobliterator/ardupilot/issues{/number}","pulls_url":"https://api.github.com/repos/bugobliterator/ardupilot/pulls{/number}","milestones_url":"https://api.github.com/repos/bugobliterator/ardupilot/milestones{/number}","notifications_url":"https://api.github.com/repos/bugobliterator/ardupilot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bugobliterator/ardupilot/labels{/name}","releases_url":"https://api.github.com/repos/bugobliterator/ardupilot/releases{/id}","created_at":"2014-11-05T08:32:12Z","updated_at":"2014-11-07T11:36:58Z","pushed_at":"2015-08-28T22:30:31Z","git_url":"git://github.com/bugobliterator/ardupilot.git","ssh_url":"git@github.com:bugobliterator/ardupilot.git","clone_url":"https://github.com/bugobliterator/ardupilot.git","svn_url":"https://github.com/bugobliterator/ardupilot","homepage":"http://ardupilot.com/","size":70651,"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":"diydrones:master","ref":"master","sha":"1b67e49df460b0d21648fe7986e6aa416352cd9e","user":{"login":"diydrones","id":3189387,"avatar_url":"https://avatars.githubusercontent.com/u/3189387?v=3","gravatar_id":"","url":"https://api.github.com/users/diydrones","html_url":"https://github.com/diydrones","followers_url":"https://api.github.com/users/diydrones/followers","following_url":"https://api.github.com/users/diydrones/following{/other_user}","gists_url":"https://api.github.com/users/diydrones/gists{/gist_id}","starred_url":"https://api.github.com/users/diydrones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diydrones/subscriptions","organizations_url":"https://api.github.com/users/diydrones/orgs","repos_url":"https://api.github.com/users/diydrones/repos","events_url":"https://api.github.com/users/diydrones/events{/privacy}","received_events_url":"https://api.github.com/users/diydrones/received_events","type":"Organization","site_admin":false},"repo":{"id":7512484,"name":"ardupilot","full_name":"diydrones/ardupilot","owner":{"login":"diydrones","id":3189387,"avatar_url":"https://avatars.githubusercontent.com/u/3189387?v=3","gravatar_id":"","url":"https://api.github.com/users/diydrones","html_url":"https://github.com/diydrones","followers_url":"https://api.github.com/users/diydrones/followers","following_url":"https://api.github.com/users/diydrones/following{/other_user}","gists_url":"https://api.github.com/users/diydrones/gists{/gist_id}","starred_url":"https://api.github.com/users/diydrones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diydrones/subscriptions","organizations_url":"https://api.github.com/users/diydrones/orgs","repos_url":"https://api.github.com/users/diydrones/repos","events_url":"https://api.github.com/users/diydrones/events{/privacy}","received_events_url":"https://api.github.com/users/diydrones/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/diydrones/ardupilot","description":"APM Plane, APM Copter, APM Rover source","fork":false,"url":"https://api.github.com/repos/diydrones/ardupilot","forks_url":"https://api.github.com/repos/diydrones/ardupilot/forks","keys_url":"https://api.github.com/repos/diydrones/ardupilot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diydrones/ardupilot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diydrones/ardupilot/teams","hooks_url":"https://api.github.com/repos/diydrones/ardupilot/hooks","issue_events_url":"https://api.github.com/repos/diydrones/ardupilot/issues/events{/number}","events_url":"https://api.github.com/repos/diydrones/ardupilot/events","assignees_url":"https://api.github.com/repos/diydrones/ardupilot/assignees{/user}","branches_url":"https://api.github.com/repos/diydrones/ardupilot/branches{/branch}","tags_url":"https://api.github.com/repos/diydrones/ardupilot/tags","blobs_url":"https://api.github.com/repos/diydrones/ardupilot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diydrones/ardupilot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diydrones/ardupilot/git/refs{/sha}","trees_url":"https://api.github.com/repos/diydrones/ardupilot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diydrones/ardupilot/statuses/{sha}","languages_url":"https://api.github.com/repos/diydrones/ardupilot/languages","stargazers_url":"https://api.github.com/repos/diydrones/ardupilot/stargazers","contributors_url":"https://api.github.com/repos/diydrones/ardupilot/contributors","subscribers_url":"https://api.github.com/repos/diydrones/ardupilot/subscribers","subscription_url":"https://api.github.com/repos/diydrones/ardupilot/subscription","commits_url":"https://api.github.com/repos/diydrones/ardupilot/commits{/sha}","git_commits_url":"https://api.github.com/repos/diydrones/ardupilot/git/commits{/sha}","comments_url":"https://api.github.com/repos/diydrones/ardupilot/comments{/number}","issue_comment_url":"https://api.github.com/repos/diydrones/ardupilot/issues/comments{/number}","contents_url":"https://api.github.com/repos/diydrones/ardupilot/contents/{+path}","compare_url":"https://api.github.com/repos/diydrones/ardupilot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diydrones/ardupilot/merges","archive_url":"https://api.github.com/repos/diydrones/ardupilot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diydrones/ardupilot/downloads","issues_url":"https://api.github.com/repos/diydrones/ardupilot/issues{/number}","pulls_url":"https://api.github.com/repos/diydrones/ardupilot/pulls{/number}","milestones_url":"https://api.github.com/repos/diydrones/ardupilot/milestones{/number}","notifications_url":"https://api.github.com/repos/diydrones/ardupilot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diydrones/ardupilot/labels{/name}","releases_url":"https://api.github.com/repos/diydrones/ardupilot/releases{/id}","created_at":"2013-01-09T00:58:52Z","updated_at":"2015-08-31T22:45:05Z","pushed_at":"2015-08-31T23:51:03Z","git_url":"git://github.com/diydrones/ardupilot.git","ssh_url":"git@github.com:diydrones/ardupilot.git","clone_url":"https://github.com/diydrones/ardupilot.git","svn_url":"https://github.com/diydrones/ardupilot","homepage":"http://ardupilot.com/","size":122748,"stargazers_count":1392,"watchers_count":1392,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2643,"mirror_url":null,"open_issues_count":611,"forks":2643,"open_issues":611,"watchers":1392,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/diydrones/ardupilot/pulls/2779"},"html":{"href":"https://github.com/diydrones/ardupilot/pull/2779"},"issue":{"href":"https://api.github.com/repos/diydrones/ardupilot/issues/2779"},"comments":{"href":"https://api.github.com/repos/diydrones/ardupilot/issues/2779/comments"},"review_comments":{"href":"https://api.github.com/repos/diydrones/ardupilot/pulls/2779/comments"},"review_comment":{"href":"https://api.github.com/repos/diydrones/ardupilot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/diydrones/ardupilot/pulls/2779/commits"},"statuses":{"href":"https://api.github.com/repos/diydrones/ardupilot/statuses/66d9b7a6423ee895464a9790f3d310b8dcd2aab2"}}}}