{"action":"created","issue":{"url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1976","repository_url":"https://api.github.com/repos/cleanflight/cleanflight","labels_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1976/labels{/name}","comments_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1976/comments","events_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1976/events","html_url":"https://github.com/cleanflight/cleanflight/pull/1976","id":143370372,"number":1976,"title":"Refactor configuration storage","user":{"login":"hydra","id":57075,"avatar_url":"https://avatars.githubusercontent.com/u/57075?v=3","gravatar_id":"","url":"https://api.github.com/users/hydra","html_url":"https://github.com/hydra","followers_url":"https://api.github.com/users/hydra/followers","following_url":"https://api.github.com/users/hydra/following{/other_user}","gists_url":"https://api.github.com/users/hydra/gists{/gist_id}","starred_url":"https://api.github.com/users/hydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydra/subscriptions","organizations_url":"https://api.github.com/users/hydra/orgs","repos_url":"https://api.github.com/users/hydra/repos","events_url":"https://api.github.com/users/hydra/events{/privacy}","received_events_url":"https://api.github.com/users/hydra/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cleanflight/cleanflight/labels/cleanup","name":"cleanup","color":"bfd4f2"},{"url":"https://api.github.com/repos/cleanflight/cleanflight/labels/critical","name":"critical","color":"e11d21"},{"url":"https://api.github.com/repos/cleanflight/cleanflight/labels/enhancement","name":"enhancement","color":"c7def8"},{"url":"https://api.github.com/repos/cleanflight/cleanflight/labels/in-progress","name":"in-progress","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"hydra","id":57075,"avatar_url":"https://avatars.githubusercontent.com/u/57075?v=3","gravatar_id":"","url":"https://api.github.com/users/hydra","html_url":"https://github.com/hydra","followers_url":"https://api.github.com/users/hydra/followers","following_url":"https://api.github.com/users/hydra/following{/other_user}","gists_url":"https://api.github.com/users/hydra/gists{/gist_id}","starred_url":"https://api.github.com/users/hydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydra/subscriptions","organizations_url":"https://api.github.com/users/hydra/orgs","repos_url":"https://api.github.com/users/hydra/repos","events_url":"https://api.github.com/users/hydra/events{/privacy}","received_events_url":"https://api.github.com/users/hydra/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/cleanflight/cleanflight/milestones/12","html_url":"https://github.com/cleanflight/cleanflight/milestones/1.13.0","labels_url":"https://api.github.com/repos/cleanflight/cleanflight/milestones/12/labels","id":1458885,"number":12,"title":"1.13.0","description":null,"creator":{"login":"hydra","id":57075,"avatar_url":"https://avatars.githubusercontent.com/u/57075?v=3","gravatar_id":"","url":"https://api.github.com/users/hydra","html_url":"https://github.com/hydra","followers_url":"https://api.github.com/users/hydra/followers","following_url":"https://api.github.com/users/hydra/following{/other_user}","gists_url":"https://api.github.com/users/hydra/gists{/gist_id}","starred_url":"https://api.github.com/users/hydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydra/subscriptions","organizations_url":"https://api.github.com/users/hydra/orgs","repos_url":"https://api.github.com/users/hydra/repos","events_url":"https://api.github.com/users/hydra/events{/privacy}","received_events_url":"https://api.github.com/users/hydra/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":12,"state":"open","created_at":"2015-12-14T10:45:04Z","updated_at":"2016-03-24T22:55:37Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2016-03-24T21:52:36Z","updated_at":"2016-03-25T19:59:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cleanflight/cleanflight/pulls/1976","html_url":"https://github.com/cleanflight/cleanflight/pull/1976","diff_url":"https://github.com/cleanflight/cleanflight/pull/1976.diff","patch_url":"https://github.com/cleanflight/cleanflight/pull/1976.patch"},"body":"This continues where PR #1049 left off.\r\n\r\nI consider this a critical PR for the 1.13.0 release.\r\n\r\nAt the moment only the boardAlignment and failsafeConfig were switched over to the new mechanism.  In time I will add commits that continue to remove structures from `master_t` and migrate the corresponding code to use the new storage mechanism.\r\n\r\nThere is great benefit in this PR:\r\n1) Decoupled code.\r\n2) Better tested code.\r\n3) Users can migrate between different firmware revisions without a complete reconfiguration.\r\n4) Less MSP code.\r\n5) Easy backup/restore this is still migratable (as opposed to a full eeprom config backup)\r\n\r\nPoint 4 is a little contentious to me, i'm not 100% convinced that the configuration storage and MSP commands should be coupled.\r\n\r\nIMHO there should be a new MSP command to retrieve parameter groups by an ID which also returns the parameter group format reference.   We shall see how this pans out in due course.\r\n\r\nUnanswered questions:\r\n\r\na) how to reset a group to default values?\r\nb) how to upgrade from an old format to a new one?\r\nc) how to we know we've got or loaded all the required configuration (e.g. missing parameter group \r\nfrom config)\r\nd) how do we know if a parameter group is system wide or profile based?\r\ne) how do we handle profiles?\r\n\r\npotential answers:\r\na.1) declare the parameter group with an initialiser callback if anything in the group needs a non-zero value?\r\n\r\nb.1) declare the parameter group with an upgrade callback function.  when one is specified it could return true if successful, otherwise reset it to defaults?\r\n\r\nc.1) do we care?  maybe as long as all parameter groups are reset to defaults before loading the first one it's ok?\r\nc.2) make a list, report to the user somehow?\r\n\r\nd.1) add a unit8_t flags property to the parameter group definition and use 1 bit to indicate profile group or system group.\r\nd.2) use the top 4 bits of the id field as flags and use 1 bit to indicate profile group or system group (same as d.1 but space efficient, 4096 id's is fine but 256 isn't).\r\n\r\ne.1) add a uint8_t flags property to the parameter group record.  use 2 bits to indicate master/profile1/profile2/profile3?\r\n"},"comment":{"url":"https://api.github.com/repos/cleanflight/cleanflight/issues/comments/201462784","html_url":"https://github.com/cleanflight/cleanflight/pull/1976#issuecomment-201462784","issue_url":"https://api.github.com/repos/cleanflight/cleanflight/issues/1976","id":201462784,"user":{"login":"hydra","id":57075,"avatar_url":"https://avatars.githubusercontent.com/u/57075?v=3","gravatar_id":"","url":"https://api.github.com/users/hydra","html_url":"https://github.com/hydra","followers_url":"https://api.github.com/users/hydra/followers","following_url":"https://api.github.com/users/hydra/following{/other_user}","gists_url":"https://api.github.com/users/hydra/gists{/gist_id}","starred_url":"https://api.github.com/users/hydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydra/subscriptions","organizations_url":"https://api.github.com/users/hydra/orgs","repos_url":"https://api.github.com/users/hydra/repos","events_url":"https://api.github.com/users/hydra/events{/privacy}","received_events_url":"https://api.github.com/users/hydra/received_events","type":"User","site_admin":false},"created_at":"2016-03-25T19:59:53Z","updated_at":"2016-03-25T19:59:53Z","body":"I just updated the PR description with some questions and possible answers to them.\r\n"}}