{"action":"closed","issue":{"url":"https://api.github.com/repos/alexanderkjones/GM_V1/issues/5","repository_url":"https://api.github.com/repos/alexanderkjones/GM_V1","labels_url":"https://api.github.com/repos/alexanderkjones/GM_V1/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/alexanderkjones/GM_V1/issues/5/comments","events_url":"https://api.github.com/repos/alexanderkjones/GM_V1/issues/5/events","html_url":"https://github.com/alexanderkjones/GM_V1/issues/5","id":151259649,"number":5,"title":"Log Weight Changes to EEPROM","user":{"login":"alexanderkjones","id":2124029,"avatar_url":"https://avatars.githubusercontent.com/u/2124029?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderkjones","html_url":"https://github.com/alexanderkjones","followers_url":"https://api.github.com/users/alexanderkjones/followers","following_url":"https://api.github.com/users/alexanderkjones/following{/other_user}","gists_url":"https://api.github.com/users/alexanderkjones/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderkjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderkjones/subscriptions","organizations_url":"https://api.github.com/users/alexanderkjones/orgs","repos_url":"https://api.github.com/users/alexanderkjones/repos","events_url":"https://api.github.com/users/alexanderkjones/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderkjones/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"JLJTGR","id":5780236,"avatar_url":"https://avatars.githubusercontent.com/u/5780236?v=3","gravatar_id":"","url":"https://api.github.com/users/JLJTGR","html_url":"https://github.com/JLJTGR","followers_url":"https://api.github.com/users/JLJTGR/followers","following_url":"https://api.github.com/users/JLJTGR/following{/other_user}","gists_url":"https://api.github.com/users/JLJTGR/gists{/gist_id}","starred_url":"https://api.github.com/users/JLJTGR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JLJTGR/subscriptions","organizations_url":"https://api.github.com/users/JLJTGR/orgs","repos_url":"https://api.github.com/users/JLJTGR/repos","events_url":"https://api.github.com/users/JLJTGR/events{/privacy}","received_events_url":"https://api.github.com/users/JLJTGR/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/alexanderkjones/GM_V1/milestones/6","html_url":"https://github.com/alexanderkjones/GM_V1/milestones/Device%20Logs%20Keg%20Pours","labels_url":"https://api.github.com/repos/alexanderkjones/GM_V1/milestones/6/labels","id":1658806,"number":6,"title":"Device Logs Keg Pours","description":"","creator":{"login":"alexanderkjones","id":2124029,"avatar_url":"https://avatars.githubusercontent.com/u/2124029?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderkjones","html_url":"https://github.com/alexanderkjones","followers_url":"https://api.github.com/users/alexanderkjones/followers","following_url":"https://api.github.com/users/alexanderkjones/following{/other_user}","gists_url":"https://api.github.com/users/alexanderkjones/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderkjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderkjones/subscriptions","organizations_url":"https://api.github.com/users/alexanderkjones/orgs","repos_url":"https://api.github.com/users/alexanderkjones/repos","events_url":"https://api.github.com/users/alexanderkjones/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderkjones/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":1,"state":"open","created_at":"2016-03-22T01:07:41Z","updated_at":"2016-05-05T21:38:01Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-04-26T23:03:41Z","updated_at":"2016-05-05T21:38:01Z","closed_at":"2016-05-05T21:38:01Z","body":"**Story**\r\nAs a User, I want to measure pour data from a keg and store locally on the device, in order to capture data for batch analysis.\r\n\r\n**Desc**\r\nThe device when monitoring a Keg is looking for changes in weight to signify a pour start and stop to calculate the pour size and timestamp. We've implemented a method for monitoring the keg for pours below. We want to store all readings locally ATC EEPROM not ESP EEPROM for batch export. Export will be a separate Story/Issue\r\n\r\n**Method**\r\nTo measure keg pours we watch for stable weight readings in 5 second intervals. Every 5 seconds the weight is checked, if the weight is the same as the last reading the reading is considered stable. If the reading is different we know there is a pour occurring which may take more than one 5 second interval to complete so we begin a new comparison for a second stable reading. I've organized this using two setpoints in an array setpoint[0,1]. Once we have a second stable reading, we mesure the delta between the two points, reset setpointp[0] with the latest stable weight, and store the delta with timestamp as a pour to be transmitted to the system.\r\n\r\n**Acceptance Criteria**\r\n\r\n- The device follows the method to store a pour data point ie delta/timestamp\r\n- The developer can execute a Serial.println() of the stored datapoints in EEPROM.\r\n\r\n**Code Example**\r\n```\r\nint scaleSampleWeight(){\r\n  scale.power_up();\r\n  int sample = scale.get_units(25);\r\n  //Throw away last bit\r\n  sample = (sample/10)*10;\r\n  scale.power_down();\r\n  return sample;\r\n}\r\n\r\nvoid watch_keg(){\r\n  int thisRead = scaleSampleWeight();\r\n  \r\n  Serial.println(thisRead);\r\n  \r\n  if(thisRead != setpoint[0]){\r\n    \r\n    if(thisRead == setpoint[1]){\r\n      int delta = setpoint[1] - setpoint[0];\r\n      \r\n      if(abs(delta) > 10){\r\n        trackpour(delta);\r\n      }\r\n      \r\n      setpoint[0] = setpoint[1];\r\n    \r\n    }else{\r\n      setpoint[1] = thisRead;\r\n    }\r\n  }\r\n  \r\n} \r\n```"}}