{"action":"opened","issue":{"url":"https://api.github.com/repos/iNavFlight/inav/issues/122","repository_url":"https://api.github.com/repos/iNavFlight/inav","labels_url":"https://api.github.com/repos/iNavFlight/inav/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/iNavFlight/inav/issues/122/comments","events_url":"https://api.github.com/repos/iNavFlight/inav/issues/122/events","html_url":"https://github.com/iNavFlight/inav/issues/122","id":142133403,"number":122,"title":"HW - user-configurable mag calibration timeout","user":{"login":"csurf","id":627526,"avatar_url":"https://avatars.githubusercontent.com/u/627526?v=3","gravatar_id":"","url":"https://api.github.com/users/csurf","html_url":"https://github.com/csurf","followers_url":"https://api.github.com/users/csurf/followers","following_url":"https://api.github.com/users/csurf/following{/other_user}","gists_url":"https://api.github.com/users/csurf/gists{/gist_id}","starred_url":"https://api.github.com/users/csurf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csurf/subscriptions","organizations_url":"https://api.github.com/users/csurf/orgs","repos_url":"https://api.github.com/users/csurf/repos","events_url":"https://api.github.com/users/csurf/events{/privacy}","received_events_url":"https://api.github.com/users/csurf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-20T06:12:00Z","updated_at":"2016-03-20T06:12:00Z","closed_at":null,"body":"hard-coded 30sec timeout period for mag calibration is too slow in some cases. So, here is a proposal to add a new CLI var for setting the mag calibration timeout period, mag_calib_timeout, uint8_t, which would be the desired  timeout period (in seconds), range 30-255, defaults to 30. \r\n\r\n- would require change to compass.c & a new definition within CLI.c, etc. \r\n\r\ncompass.c\r\n`\r\n if ((currentTime - tCal) < 30000000) {    // 30s: you have 30s to turn the multi in all directions\r\n//convert to...\r\n if ((currentTime - tCal) < (cfg.mag_calib_timeout * 1000000)) {\r\n`\r\n\r\n...and perhaps it might be more efficient to do a bit-shift in the above case...\r\n`\r\nif ((currentTime - tCal) < ((uint32_t)cfg.mag_calib_timeout << 20 )) {\r\n`\r\n\r\n...as absolute precision isn't required and it might help speed up math op's.\r\n\r\nIdeally, it would be cooler if we could just have the mag calibration routine detect when the user has stopped moving the model for ~5 seconds, based on gyro readings, but this seems like it would be somewhat complicated & messy to implement. For now, it would seem that it would be easier to just allow the user to configure a longer timeout for mag calibration."}}