{"action":"created","comment":{"url":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/comments/55198314","id":55198314,"diff_hunk":"@@ -610,4 +635,145 @@ u8 tracking_channels_ready()\n   return n_ready;\n }\n \n+/** Queue a request to start up tracking and decoding for the specified sid.\n+ *\n+ * \\note This function is thread-safe and non-blocking.\n+ *\n+ * \\param startup_params    Struct containing startup parameters.\n+ *\n+ * \\return true if the request was successfully submitted, false otherwise.\n+ */\n+bool tracking_startup_request(const tracking_startup_params_t *startup_params)\n+{\n+  bool result = false;\n+  if(chMtxTryLock(&tracking_startup_mutex))\n+  {\n+    result = tracking_startup_fifo_write(&tracking_startup_fifo,\n+                                         startup_params);\n+\n+    Mutex *m = chMtxUnlock();\n+    assert(m == &tracking_startup_mutex);\n+  }\n+\n+  return result;\n+}\n+\n+/** Read tracking startup requests from the FIFO and attempt to start\n+ * tracking and decoding.\n+ */\n+static void manage_tracking_startup(void)\n+{\n+  tracking_startup_params_t startup_params;\n+  while(tracking_startup_fifo_read(&tracking_startup_fifo, &startup_params)) {\n+\n+    acq_status_t *acq = &acq_status[sid_to_global_index(startup_params.sid)];\n+\n+    /* Make sure a tracking channel and a decoder channel are available */\n+    u8 chan = manage_track_new_acq(startup_params.sid);\n+    if (chan == MANAGE_NO_CHANNELS_FREE) {\n+\n+      /* No channels are free to accept our new satellite :( */\n+      /* TODO: Perhaps we can try to warm start this one\n+       * later using another fine acq.\n+       */\n+      if (startup_params.cn0_init > ACQ_RETRY_THRESHOLD) {\n+        acq->score[ACQ_HINT_PREV_ACQ] =\n+            SCORE_ACQ + (startup_params.cn0_init - ACQ_THRESHOLD);\n+        acq->dopp_hint_low = startup_params.carrier_freq - ACQ_FULL_CF_STEP;\n+        acq->dopp_hint_high = startup_params.carrier_freq + ACQ_FULL_CF_STEP;\n+      }\n+\n+      continue;\n+    }\n+\n+    /* Transition to tracking. */\n+    u32 track_count = nap_timing_count() + 20000;","path":"src/manage.c","position":419,"original_position":419,"commit_id":"588e3a23423ca476164802d6c5cd7f2a4b275139","original_commit_id":"588e3a23423ca476164802d6c5cd7f2a4b275139","user":{"login":"dt-exafore","id":16582553,"avatar_url":"https://avatars.githubusercontent.com/u/16582553?v=3","gravatar_id":"","url":"https://api.github.com/users/dt-exafore","html_url":"https://github.com/dt-exafore","followers_url":"https://api.github.com/users/dt-exafore/followers","following_url":"https://api.github.com/users/dt-exafore/following{/other_user}","gists_url":"https://api.github.com/users/dt-exafore/gists{/gist_id}","starred_url":"https://api.github.com/users/dt-exafore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dt-exafore/subscriptions","organizations_url":"https://api.github.com/users/dt-exafore/orgs","repos_url":"https://api.github.com/users/dt-exafore/repos","events_url":"https://api.github.com/users/dt-exafore/events{/privacy}","received_events_url":"https://api.github.com/users/dt-exafore/received_events","type":"User","site_admin":false},"body":"nap_timing_count() returns u64, could you please clarify do we need to store 32 LSB here only?","created_at":"2016-03-07T12:48:05Z","updated_at":"2016-03-07T12:48:05Z","html_url":"https://github.com/swift-nav/piksi_firmware/pull/624#discussion_r55198314","pull_request_url":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/624","_links":{"self":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/comments/55198314"},"html":{"href":"https://github.com/swift-nav/piksi_firmware/pull/624#discussion_r55198314"},"pull_request":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/624"}}},"pull_request":{"url":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/624","id":61661183,"html_url":"https://github.com/swift-nav/piksi_firmware/pull/624","diff_url":"https://github.com/swift-nav/piksi_firmware/pull/624.diff","patch_url":"https://github.com/swift-nav/piksi_firmware/pull/624.patch","issue_url":"https://api.github.com/repos/swift-nav/piksi_firmware/issues/624","number":624,"state":"open","locked":false,"title":"Tracking channel refactor, specialize by code type","user":{"login":"jacobmcnamee","id":4461703,"avatar_url":"https://avatars.githubusercontent.com/u/4461703?v=3","gravatar_id":"","url":"https://api.github.com/users/jacobmcnamee","html_url":"https://github.com/jacobmcnamee","followers_url":"https://api.github.com/users/jacobmcnamee/followers","following_url":"https://api.github.com/users/jacobmcnamee/following{/other_user}","gists_url":"https://api.github.com/users/jacobmcnamee/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobmcnamee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobmcnamee/subscriptions","organizations_url":"https://api.github.com/users/jacobmcnamee/orgs","repos_url":"https://api.github.com/users/jacobmcnamee/repos","events_url":"https://api.github.com/users/jacobmcnamee/events{/privacy}","received_events_url":"https://api.github.com/users/jacobmcnamee/received_events","type":"User","site_admin":false},"body":"Major overhaul of tracking module:\r\n- No more global `tracking_channel[]`\r\n- Code-specific tracking init and update implementations\r\n- API for code-specific implementations to reuse common data / functions\r\n- Thread safety improvements (copying out measurements, handling race condition w/NAP interrupts)\r\n- Tracking startup queue to enable hot starting new channels from within the tracking loops","created_at":"2016-03-04T03:05:11Z","updated_at":"2016-03-07T12:48:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dedb28b527d09778aaf0723ea94e2ef27e906c95","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/624/commits","review_comments_url":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/624/comments","review_comment_url":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/comments{/number}","comments_url":"https://api.github.com/repos/swift-nav/piksi_firmware/issues/624/comments","statuses_url":"https://api.github.com/repos/swift-nav/piksi_firmware/statuses/588e3a23423ca476164802d6c5cd7f2a4b275139","head":{"label":"jacobmcnamee:track","ref":"track","sha":"588e3a23423ca476164802d6c5cd7f2a4b275139","user":{"login":"jacobmcnamee","id":4461703,"avatar_url":"https://avatars.githubusercontent.com/u/4461703?v=3","gravatar_id":"","url":"https://api.github.com/users/jacobmcnamee","html_url":"https://github.com/jacobmcnamee","followers_url":"https://api.github.com/users/jacobmcnamee/followers","following_url":"https://api.github.com/users/jacobmcnamee/following{/other_user}","gists_url":"https://api.github.com/users/jacobmcnamee/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobmcnamee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobmcnamee/subscriptions","organizations_url":"https://api.github.com/users/jacobmcnamee/orgs","repos_url":"https://api.github.com/users/jacobmcnamee/repos","events_url":"https://api.github.com/users/jacobmcnamee/events{/privacy}","received_events_url":"https://api.github.com/users/jacobmcnamee/received_events","type":"User","site_admin":false},"repo":{"id":44843578,"name":"piksi_firmware","full_name":"jacobmcnamee/piksi_firmware","owner":{"login":"jacobmcnamee","id":4461703,"avatar_url":"https://avatars.githubusercontent.com/u/4461703?v=3","gravatar_id":"","url":"https://api.github.com/users/jacobmcnamee","html_url":"https://github.com/jacobmcnamee","followers_url":"https://api.github.com/users/jacobmcnamee/followers","following_url":"https://api.github.com/users/jacobmcnamee/following{/other_user}","gists_url":"https://api.github.com/users/jacobmcnamee/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobmcnamee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobmcnamee/subscriptions","organizations_url":"https://api.github.com/users/jacobmcnamee/orgs","repos_url":"https://api.github.com/users/jacobmcnamee/repos","events_url":"https://api.github.com/users/jacobmcnamee/events{/privacy}","received_events_url":"https://api.github.com/users/jacobmcnamee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jacobmcnamee/piksi_firmware","description":"Firmware for the Piksi GNSS receiver.","fork":true,"url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware","forks_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/forks","keys_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/teams","hooks_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/hooks","issue_events_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/issues/events{/number}","events_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/events","assignees_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/assignees{/user}","branches_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/branches{/branch}","tags_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/tags","blobs_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/languages","stargazers_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/stargazers","contributors_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/contributors","subscribers_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/subscribers","subscription_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/subscription","commits_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/contents/{+path}","compare_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/merges","archive_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/downloads","issues_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/issues{/number}","pulls_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/labels{/name}","releases_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/releases{/id}","deployments_url":"https://api.github.com/repos/jacobmcnamee/piksi_firmware/deployments","created_at":"2015-10-23T23:21:30Z","updated_at":"2015-10-23T23:21:32Z","pushed_at":"2016-03-05T00:45:15Z","git_url":"git://github.com/jacobmcnamee/piksi_firmware.git","ssh_url":"git@github.com:jacobmcnamee/piksi_firmware.git","clone_url":"https://github.com/jacobmcnamee/piksi_firmware.git","svn_url":"https://github.com/jacobmcnamee/piksi_firmware","homepage":"swift-nav.com","size":4251,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"swift-nav:master","ref":"master","sha":"252da5b20287b6a221f07adf7268281ec5de8e74","user":{"login":"swift-nav","id":1069835,"avatar_url":"https://avatars.githubusercontent.com/u/1069835?v=3","gravatar_id":"","url":"https://api.github.com/users/swift-nav","html_url":"https://github.com/swift-nav","followers_url":"https://api.github.com/users/swift-nav/followers","following_url":"https://api.github.com/users/swift-nav/following{/other_user}","gists_url":"https://api.github.com/users/swift-nav/gists{/gist_id}","starred_url":"https://api.github.com/users/swift-nav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swift-nav/subscriptions","organizations_url":"https://api.github.com/users/swift-nav/orgs","repos_url":"https://api.github.com/users/swift-nav/repos","events_url":"https://api.github.com/users/swift-nav/events{/privacy}","received_events_url":"https://api.github.com/users/swift-nav/received_events","type":"Organization","site_admin":false},"repo":{"id":2464156,"name":"piksi_firmware","full_name":"swift-nav/piksi_firmware","owner":{"login":"swift-nav","id":1069835,"avatar_url":"https://avatars.githubusercontent.com/u/1069835?v=3","gravatar_id":"","url":"https://api.github.com/users/swift-nav","html_url":"https://github.com/swift-nav","followers_url":"https://api.github.com/users/swift-nav/followers","following_url":"https://api.github.com/users/swift-nav/following{/other_user}","gists_url":"https://api.github.com/users/swift-nav/gists{/gist_id}","starred_url":"https://api.github.com/users/swift-nav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swift-nav/subscriptions","organizations_url":"https://api.github.com/users/swift-nav/orgs","repos_url":"https://api.github.com/users/swift-nav/repos","events_url":"https://api.github.com/users/swift-nav/events{/privacy}","received_events_url":"https://api.github.com/users/swift-nav/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/swift-nav/piksi_firmware","description":"Firmware for the Piksi GNSS receiver.","fork":false,"url":"https://api.github.com/repos/swift-nav/piksi_firmware","forks_url":"https://api.github.com/repos/swift-nav/piksi_firmware/forks","keys_url":"https://api.github.com/repos/swift-nav/piksi_firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swift-nav/piksi_firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swift-nav/piksi_firmware/teams","hooks_url":"https://api.github.com/repos/swift-nav/piksi_firmware/hooks","issue_events_url":"https://api.github.com/repos/swift-nav/piksi_firmware/issues/events{/number}","events_url":"https://api.github.com/repos/swift-nav/piksi_firmware/events","assignees_url":"https://api.github.com/repos/swift-nav/piksi_firmware/assignees{/user}","branches_url":"https://api.github.com/repos/swift-nav/piksi_firmware/branches{/branch}","tags_url":"https://api.github.com/repos/swift-nav/piksi_firmware/tags","blobs_url":"https://api.github.com/repos/swift-nav/piksi_firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swift-nav/piksi_firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swift-nav/piksi_firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/swift-nav/piksi_firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swift-nav/piksi_firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/swift-nav/piksi_firmware/languages","stargazers_url":"https://api.github.com/repos/swift-nav/piksi_firmware/stargazers","contributors_url":"https://api.github.com/repos/swift-nav/piksi_firmware/contributors","subscribers_url":"https://api.github.com/repos/swift-nav/piksi_firmware/subscribers","subscription_url":"https://api.github.com/repos/swift-nav/piksi_firmware/subscription","commits_url":"https://api.github.com/repos/swift-nav/piksi_firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/swift-nav/piksi_firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/swift-nav/piksi_firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/swift-nav/piksi_firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/swift-nav/piksi_firmware/contents/{+path}","compare_url":"https://api.github.com/repos/swift-nav/piksi_firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swift-nav/piksi_firmware/merges","archive_url":"https://api.github.com/repos/swift-nav/piksi_firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swift-nav/piksi_firmware/downloads","issues_url":"https://api.github.com/repos/swift-nav/piksi_firmware/issues{/number}","pulls_url":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/swift-nav/piksi_firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/swift-nav/piksi_firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swift-nav/piksi_firmware/labels{/name}","releases_url":"https://api.github.com/repos/swift-nav/piksi_firmware/releases{/id}","deployments_url":"https://api.github.com/repos/swift-nav/piksi_firmware/deployments","created_at":"2011-09-26T23:35:50Z","updated_at":"2016-02-26T22:46:44Z","pushed_at":"2016-03-05T00:45:16Z","git_url":"git://github.com/swift-nav/piksi_firmware.git","ssh_url":"git@github.com:swift-nav/piksi_firmware.git","clone_url":"https://github.com/swift-nav/piksi_firmware.git","svn_url":"https://github.com/swift-nav/piksi_firmware","homepage":"swift-nav.com","size":5434,"stargazers_count":65,"watchers_count":65,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":79,"mirror_url":null,"open_issues_count":118,"forks":79,"open_issues":118,"watchers":65,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/624"},"html":{"href":"https://github.com/swift-nav/piksi_firmware/pull/624"},"issue":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/issues/624"},"comments":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/issues/624/comments"},"review_comments":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/624/comments"},"review_comment":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/pulls/624/commits"},"statuses":{"href":"https://api.github.com/repos/swift-nav/piksi_firmware/statuses/588e3a23423ca476164802d6c5cd7f2a4b275139"}}}}