{"action":"created","comment":{"url":"https://api.github.com/repos/PX4/Firmware/pulls/comments/53279539","id":53279539,"diff_hunk":"@@ -257,12 +293,18 @@ CameraTrigger::start()\n \t}\n \n \t// enable immediate if configured that way\n-\tif (_mode > 1) {\n+\tif (_mode == 2) {\n \t\tcontrol(true);\n \t}\n \n-\t// start to monitor at high rate for trigger enable command\n-\twork_queue(LPWORK, &_work, (worker_t)&CameraTrigger::cycle_trampoline, this, USEC2TICK(1));\n+\t// if in distance mode, start monitoring the position\n+\tif (_mode == 3) {\n+\t\twork_queue(LPWORK, &_work, (worker_t)&CameraTrigger::distance_trampoline, this, USEC2TICK(1));","path":"src/drivers/camera_trigger/camera_trigger.cpp","position":126,"original_position":126,"commit_id":"59baebb2ea405dc726224214f6f5a81955a6da68","original_commit_id":"59baebb2ea405dc726224214f6f5a81955a6da68","user":{"login":"LorenzMeier","id":1208119,"avatar_url":"https://avatars.githubusercontent.com/u/1208119?v=3","gravatar_id":"","url":"https://api.github.com/users/LorenzMeier","html_url":"https://github.com/LorenzMeier","followers_url":"https://api.github.com/users/LorenzMeier/followers","following_url":"https://api.github.com/users/LorenzMeier/following{/other_user}","gists_url":"https://api.github.com/users/LorenzMeier/gists{/gist_id}","starred_url":"https://api.github.com/users/LorenzMeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LorenzMeier/subscriptions","organizations_url":"https://api.github.com/users/LorenzMeier/orgs","repos_url":"https://api.github.com/users/LorenzMeier/repos","events_url":"https://api.github.com/users/LorenzMeier/events{/privacy}","received_events_url":"https://api.github.com/users/LorenzMeier/received_events","type":"User","site_admin":false},"body":"The issue having different trampolines and triggering them off an action is that you can have active callbacks to both functions at the same time. Do you need a separate function for the triggering? Its generally not a good design pattern.","created_at":"2016-02-18T07:32:05Z","updated_at":"2016-02-18T07:32:05Z","html_url":"https://github.com/PX4/Firmware/pull/3774#discussion_r53279539","pull_request_url":"https://api.github.com/repos/PX4/Firmware/pulls/3774","_links":{"self":{"href":"https://api.github.com/repos/PX4/Firmware/pulls/comments/53279539"},"html":{"href":"https://github.com/PX4/Firmware/pull/3774#discussion_r53279539"},"pull_request":{"href":"https://api.github.com/repos/PX4/Firmware/pulls/3774"}}},"pull_request":{"url":"https://api.github.com/repos/PX4/Firmware/pulls/3774","id":59489157,"html_url":"https://github.com/PX4/Firmware/pull/3774","diff_url":"https://github.com/PX4/Firmware/pull/3774.diff","patch_url":"https://github.com/PX4/Firmware/pull/3774.patch","issue_url":"https://api.github.com/repos/PX4/Firmware/issues/3774","number":3774,"state":"open","locked":false,"title":"Distance based camera triggering","user":{"login":"birchera","id":2298059,"avatar_url":"https://avatars.githubusercontent.com/u/2298059?v=3","gravatar_id":"","url":"https://api.github.com/users/birchera","html_url":"https://github.com/birchera","followers_url":"https://api.github.com/users/birchera/followers","following_url":"https://api.github.com/users/birchera/following{/other_user}","gists_url":"https://api.github.com/users/birchera/gists{/gist_id}","starred_url":"https://api.github.com/users/birchera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birchera/subscriptions","organizations_url":"https://api.github.com/users/birchera/orgs","repos_url":"https://api.github.com/users/birchera/repos","events_url":"https://api.github.com/users/birchera/events{/privacy}","received_events_url":"https://api.github.com/users/birchera/received_events","type":"User","site_admin":false},"body":"Adding a third operation mode to the camera_trigger driver, triggering after covering a certain distance.\r\n\r\nThe function reads out local position and, if valid, checks if the travelled horizontal distance exceeds the given threshold parameter.\r\n\r\nThe patch has been bench-tested and will be flight-tested in the next days.","created_at":"2016-02-16T13:19:09Z","updated_at":"2016-02-18T07:32:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b10235e82090848637de2524c1439634d7ef758","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PX4/Firmware/pulls/3774/commits","review_comments_url":"https://api.github.com/repos/PX4/Firmware/pulls/3774/comments","review_comment_url":"https://api.github.com/repos/PX4/Firmware/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PX4/Firmware/issues/3774/comments","statuses_url":"https://api.github.com/repos/PX4/Firmware/statuses/59baebb2ea405dc726224214f6f5a81955a6da68","head":{"label":"wingtra:feature/dist_cam_trig","ref":"feature/dist_cam_trig","sha":"59baebb2ea405dc726224214f6f5a81955a6da68","user":{"login":"wingtra","id":11488909,"avatar_url":"https://avatars.githubusercontent.com/u/11488909?v=3","gravatar_id":"","url":"https://api.github.com/users/wingtra","html_url":"https://github.com/wingtra","followers_url":"https://api.github.com/users/wingtra/followers","following_url":"https://api.github.com/users/wingtra/following{/other_user}","gists_url":"https://api.github.com/users/wingtra/gists{/gist_id}","starred_url":"https://api.github.com/users/wingtra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wingtra/subscriptions","organizations_url":"https://api.github.com/users/wingtra/orgs","repos_url":"https://api.github.com/users/wingtra/repos","events_url":"https://api.github.com/users/wingtra/events{/privacy}","received_events_url":"https://api.github.com/users/wingtra/received_events","type":"Organization","site_admin":false},"repo":{"id":34317988,"name":"Firmware","full_name":"wingtra/Firmware","owner":{"login":"wingtra","id":11488909,"avatar_url":"https://avatars.githubusercontent.com/u/11488909?v=3","gravatar_id":"","url":"https://api.github.com/users/wingtra","html_url":"https://github.com/wingtra","followers_url":"https://api.github.com/users/wingtra/followers","following_url":"https://api.github.com/users/wingtra/following{/other_user}","gists_url":"https://api.github.com/users/wingtra/gists{/gist_id}","starred_url":"https://api.github.com/users/wingtra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wingtra/subscriptions","organizations_url":"https://api.github.com/users/wingtra/orgs","repos_url":"https://api.github.com/users/wingtra/repos","events_url":"https://api.github.com/users/wingtra/events{/privacy}","received_events_url":"https://api.github.com/users/wingtra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wingtra/Firmware","description":"PX4 Firmware for PX4FMU autopilot and PX4IO servo / failsafe board","fork":true,"url":"https://api.github.com/repos/wingtra/Firmware","forks_url":"https://api.github.com/repos/wingtra/Firmware/forks","keys_url":"https://api.github.com/repos/wingtra/Firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wingtra/Firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wingtra/Firmware/teams","hooks_url":"https://api.github.com/repos/wingtra/Firmware/hooks","issue_events_url":"https://api.github.com/repos/wingtra/Firmware/issues/events{/number}","events_url":"https://api.github.com/repos/wingtra/Firmware/events","assignees_url":"https://api.github.com/repos/wingtra/Firmware/assignees{/user}","branches_url":"https://api.github.com/repos/wingtra/Firmware/branches{/branch}","tags_url":"https://api.github.com/repos/wingtra/Firmware/tags","blobs_url":"https://api.github.com/repos/wingtra/Firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wingtra/Firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wingtra/Firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/wingtra/Firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wingtra/Firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/wingtra/Firmware/languages","stargazers_url":"https://api.github.com/repos/wingtra/Firmware/stargazers","contributors_url":"https://api.github.com/repos/wingtra/Firmware/contributors","subscribers_url":"https://api.github.com/repos/wingtra/Firmware/subscribers","subscription_url":"https://api.github.com/repos/wingtra/Firmware/subscription","commits_url":"https://api.github.com/repos/wingtra/Firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/wingtra/Firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/wingtra/Firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/wingtra/Firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/wingtra/Firmware/contents/{+path}","compare_url":"https://api.github.com/repos/wingtra/Firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wingtra/Firmware/merges","archive_url":"https://api.github.com/repos/wingtra/Firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wingtra/Firmware/downloads","issues_url":"https://api.github.com/repos/wingtra/Firmware/issues{/number}","pulls_url":"https://api.github.com/repos/wingtra/Firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/wingtra/Firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/wingtra/Firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wingtra/Firmware/labels{/name}","releases_url":"https://api.github.com/repos/wingtra/Firmware/releases{/id}","deployments_url":"https://api.github.com/repos/wingtra/Firmware/deployments","created_at":"2015-04-21T09:39:07Z","updated_at":"2016-01-13T08:58:48Z","pushed_at":"2016-02-16T10:21:52Z","git_url":"git://github.com/wingtra/Firmware.git","ssh_url":"git@github.com:wingtra/Firmware.git","clone_url":"https://github.com/wingtra/Firmware.git","svn_url":"https://github.com/wingtra/Firmware","homepage":"https://pixhawk.ethz.ch/px4/","size":80008,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"PX4:master","ref":"master","sha":"48e2053f98552dcdc351e7f6241877e09f10ace1","user":{"login":"PX4","id":2096014,"avatar_url":"https://avatars.githubusercontent.com/u/2096014?v=3","gravatar_id":"","url":"https://api.github.com/users/PX4","html_url":"https://github.com/PX4","followers_url":"https://api.github.com/users/PX4/followers","following_url":"https://api.github.com/users/PX4/following{/other_user}","gists_url":"https://api.github.com/users/PX4/gists{/gist_id}","starred_url":"https://api.github.com/users/PX4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PX4/subscriptions","organizations_url":"https://api.github.com/users/PX4/orgs","repos_url":"https://api.github.com/users/PX4/repos","events_url":"https://api.github.com/users/PX4/events{/privacy}","received_events_url":"https://api.github.com/users/PX4/received_events","type":"Organization","site_admin":false},"repo":{"id":5298790,"name":"Firmware","full_name":"PX4/Firmware","owner":{"login":"PX4","id":2096014,"avatar_url":"https://avatars.githubusercontent.com/u/2096014?v=3","gravatar_id":"","url":"https://api.github.com/users/PX4","html_url":"https://github.com/PX4","followers_url":"https://api.github.com/users/PX4/followers","following_url":"https://api.github.com/users/PX4/following{/other_user}","gists_url":"https://api.github.com/users/PX4/gists{/gist_id}","starred_url":"https://api.github.com/users/PX4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PX4/subscriptions","organizations_url":"https://api.github.com/users/PX4/orgs","repos_url":"https://api.github.com/users/PX4/repos","events_url":"https://api.github.com/users/PX4/events{/privacy}","received_events_url":"https://api.github.com/users/PX4/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PX4/Firmware","description":"PX4 Firmware for Pixhawk Hardware","fork":false,"url":"https://api.github.com/repos/PX4/Firmware","forks_url":"https://api.github.com/repos/PX4/Firmware/forks","keys_url":"https://api.github.com/repos/PX4/Firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PX4/Firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PX4/Firmware/teams","hooks_url":"https://api.github.com/repos/PX4/Firmware/hooks","issue_events_url":"https://api.github.com/repos/PX4/Firmware/issues/events{/number}","events_url":"https://api.github.com/repos/PX4/Firmware/events","assignees_url":"https://api.github.com/repos/PX4/Firmware/assignees{/user}","branches_url":"https://api.github.com/repos/PX4/Firmware/branches{/branch}","tags_url":"https://api.github.com/repos/PX4/Firmware/tags","blobs_url":"https://api.github.com/repos/PX4/Firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PX4/Firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PX4/Firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/PX4/Firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PX4/Firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/PX4/Firmware/languages","stargazers_url":"https://api.github.com/repos/PX4/Firmware/stargazers","contributors_url":"https://api.github.com/repos/PX4/Firmware/contributors","subscribers_url":"https://api.github.com/repos/PX4/Firmware/subscribers","subscription_url":"https://api.github.com/repos/PX4/Firmware/subscription","commits_url":"https://api.github.com/repos/PX4/Firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/PX4/Firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/PX4/Firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/PX4/Firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/PX4/Firmware/contents/{+path}","compare_url":"https://api.github.com/repos/PX4/Firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PX4/Firmware/merges","archive_url":"https://api.github.com/repos/PX4/Firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PX4/Firmware/downloads","issues_url":"https://api.github.com/repos/PX4/Firmware/issues{/number}","pulls_url":"https://api.github.com/repos/PX4/Firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/PX4/Firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/PX4/Firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PX4/Firmware/labels{/name}","releases_url":"https://api.github.com/repos/PX4/Firmware/releases{/id}","deployments_url":"https://api.github.com/repos/PX4/Firmware/deployments","created_at":"2012-08-04T21:19:36Z","updated_at":"2016-02-17T14:14:37Z","pushed_at":"2016-02-18T07:26:32Z","git_url":"git://github.com/PX4/Firmware.git","ssh_url":"git@github.com:PX4/Firmware.git","clone_url":"https://github.com/PX4/Firmware.git","svn_url":"https://github.com/PX4/Firmware","homepage":"http://px4.io","size":103035,"stargazers_count":516,"watchers_count":516,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1913,"mirror_url":null,"open_issues_count":312,"forks":1913,"open_issues":312,"watchers":516,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PX4/Firmware/pulls/3774"},"html":{"href":"https://github.com/PX4/Firmware/pull/3774"},"issue":{"href":"https://api.github.com/repos/PX4/Firmware/issues/3774"},"comments":{"href":"https://api.github.com/repos/PX4/Firmware/issues/3774/comments"},"review_comments":{"href":"https://api.github.com/repos/PX4/Firmware/pulls/3774/comments"},"review_comment":{"href":"https://api.github.com/repos/PX4/Firmware/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PX4/Firmware/pulls/3774/commits"},"statuses":{"href":"https://api.github.com/repos/PX4/Firmware/statuses/59baebb2ea405dc726224214f6f5a81955a6da68"}}}}