{"action":"created","comment":{"url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/comments/47958786","id":47958786,"diff_hunk":"@@ -0,0 +1,285 @@\n+/*\n+Copyright (C) 2015 David Seidman\n+\n+This file is part of BrewTroller.\n+\n+BrewTroller is free software: you can redistribute it and/or modify\n+it under the terms of the GNU General Public License as published by\n+the Free Software Foundation, either version 3 of the License, or\n+(at your option) any later version.\n+\n+BrewTroller is distributed in the hope that it will be useful,\n+but WITHOUT ANY WARRANTY; without even the implied warranty of\n+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+GNU General Public License for more details.\n+\n+You should have received a copy of the GNU General Public License\n+along with BrewTroller.  If not, see <http://www.gnu.org/licenses/>.\n+\n+\n+BrewTroller - Open Source Brewing Computer\n+\n+Documentation, Forums and more information available at http://www.brewtroller.com\n+*/\n+\n+\n+/*\n+The vessel class stores and manages data and actions pertaining to vessels, such as the HLT, MLT and kettle. It is a concrete class\n+and should not be subclassed, for performance reasons and because it's important for other parts of the code to be able to interact\n+with vessels without regard to the role they are playing (HLT vs. MLT vs. kettle) so that we can easily support different vessel configurations.\n+*/\n+\n+#include <avr/eeprom.h>\n+\n+#include \"Vessel.h\"\n+#include \"EEPROM.h\"\t\n+#include \"Temp.h\"\n+#include \"HardwareProfile.h\"\n+#include \"Volume.h\"\n+#include \"Outputs.h\" //Needed only for minTriggerPin\n+\n+extern unsigned int cycleStart[4];\n+extern bool estop;\n+extern int temp[9];\n+\n+\n+// set what the PID cycle time should be based on how fast the temp sensors will respond\n+#if TS_ONEWIRE_RES == 12\n+#define PID_CYCLE_TIME 750\n+#elif TS_ONEWIRE_RES == 11\n+#define PID_CYCLE_TIME 375\n+#elif TS_ONEWIRE_RES == 10\n+#define PID_CYCLE_TIME 188\n+#elif TS_ONEWIRE_RES == 9\n+#define PID_CYCLE_TIME 94\n+#else\n+// should not be this value, fail the compile\n+#ERROR\n+#endif\n+//Note that the includeAux numbers should be addresses e.g. TS_AUX1, not just a number (that's why they're bytes instead of booleans).\n+\tVessel::Vessel(byte initEepromIndex, byte initIncludeAux[], byte FFBias, float initMinVolume = 0, byte initMinTriggerPin = 0, byte initMaxPower = 100)\n+\t{\n+\n+\t\tfor (int i = 0; i < 10; i++)\n+\t\t\tvolumeReadings[i] = 0;\n+\n+\t\teepromIndex = initEepromIndex;\n+\t\tminVolume = initMinVolume;\n+\t\tmaxPower = initMaxPower;\n+\t\tminTriggerPin = initMinTriggerPin;\n+\t\tincludeAux[0] = initIncludeAux[0];\n+\t\tincludeAux[1] = initIncludeAux[1];\n+\t\tincludeAux[2] = initIncludeAux[2];\n+\n+\t\tusesAuxInputs = includeAux[0] + includeAux[1] + includeAux[2];\n+\n+\t\t//Load settings from eeprom\n+\n+\t\t//Load temperature sensor information - needs to be before PID setup so we have the temp probe addresses in place\n+\t\t//**********************************************************************************\n+\t\t//Temperature Sensors: HLT (0-7), MASH (8-15), KETTLE (16-23), H2OIN (24-31), H2OOUT (32-39),\n+\t\t//          BEEROUT (40-47), AUX1 (48-55), AUX2 (56-63), AUX3 (64-71)\n+\t\t//**********************************************************************************\n+\t\tEEPROMreadBytes(8 * eepromIndex, sensorAddress, 8);","path":"src/Vessel.cpp","position":83,"original_position":83,"commit_id":"bbac9249eed51e8ac05946232750852b8ecd5f99","original_commit_id":"bbac9249eed51e8ac05946232750852b8ecd5f99","user":{"login":"ericyanush","id":1020116,"avatar_url":"https://avatars.githubusercontent.com/u/1020116?v=3","gravatar_id":"","url":"https://api.github.com/users/ericyanush","html_url":"https://github.com/ericyanush","followers_url":"https://api.github.com/users/ericyanush/followers","following_url":"https://api.github.com/users/ericyanush/following{/other_user}","gists_url":"https://api.github.com/users/ericyanush/gists{/gist_id}","starred_url":"https://api.github.com/users/ericyanush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericyanush/subscriptions","organizations_url":"https://api.github.com/users/ericyanush/orgs","repos_url":"https://api.github.com/users/ericyanush/repos","events_url":"https://api.github.com/users/ericyanush/events{/privacy}","received_events_url":"https://api.github.com/users/ericyanush/received_events","type":"User","site_admin":false},"body":"By moving the eeprom reading and writing directly into the vessel class we limit the ability to maintain an obvious and cohesive data storage schema in the eeprom. Any changes to the layout of the storage schema in the eeprom.h/cpp files have the potential to break the reads and writes here. \r\n\r\nAlthough I am not a fan of the current eeprom storage implementation we use, I think that maintaining the storage schema in the eeprom implementation and have each client use its interface makes changes to the data schema or implementation transparent to the client, and is the right way to prevent fragility in persistent data storage.","created_at":"2015-12-17T20:46:59Z","updated_at":"2015-12-17T20:46:59Z","html_url":"https://github.com/BrewTroller/BrewTroller-Official/pull/5#discussion_r47958786","pull_request_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/comments/47958786"},"html":{"href":"https://github.com/BrewTroller/BrewTroller-Official/pull/5#discussion_r47958786"},"pull_request":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/5","id":53788915,"html_url":"https://github.com/BrewTroller/BrewTroller-Official/pull/5","diff_url":"https://github.com/BrewTroller/BrewTroller-Official/pull/5.diff","patch_url":"https://github.com/BrewTroller/BrewTroller-Official/pull/5.patch","issue_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/issues/5","number":5,"state":"open","locked":false,"title":"Vessel refactor","user":{"login":"dseidman","id":10192037,"avatar_url":"https://avatars.githubusercontent.com/u/10192037?v=3","gravatar_id":"","url":"https://api.github.com/users/dseidman","html_url":"https://github.com/dseidman","followers_url":"https://api.github.com/users/dseidman/followers","following_url":"https://api.github.com/users/dseidman/following{/other_user}","gists_url":"https://api.github.com/users/dseidman/gists{/gist_id}","starred_url":"https://api.github.com/users/dseidman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dseidman/subscriptions","organizations_url":"https://api.github.com/users/dseidman/orgs","repos_url":"https://api.github.com/users/dseidman/repos","events_url":"https://api.github.com/users/dseidman/events{/privacy}","received_events_url":"https://api.github.com/users/dseidman/received_events","type":"User","site_admin":false},"body":"Created Vessel class to centralize and simplify all vessel-centric operations (temperature and volume). This commit only creates the class but doesn't use it anywhere, to allow review before ripping out the old code. It also inherits a few existing hacks that would have expanded scope too much to rip out (global temp[] array for aux temperatures and cycleTime[] timer array, OneWire bitrate #defines). It currently lacks PWM, steam, and temperature max from the existing code - those will be added back later. It does add a small amount of memory bloat, but only a few bytes, and should have a minimal runtime performance change. The class is designed to be deleted and recreated when config (eeprom) information changes, rather than dynamically updating the existing instance of the object.\r\n\r\nPlease provide feedback!","created_at":"2015-12-16T01:45:07Z","updated_at":"2015-12-17T20:46:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78f8447e49ad5c50d1b6ed0c94f7a4f55e41ac5e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/5/commits","review_comments_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/5/comments","review_comment_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/issues/5/comments","statuses_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/statuses/bbac9249eed51e8ac05946232750852b8ecd5f99","head":{"label":"dseidman:feature/vessel-refactor","ref":"feature/vessel-refactor","sha":"bbac9249eed51e8ac05946232750852b8ecd5f99","user":{"login":"dseidman","id":10192037,"avatar_url":"https://avatars.githubusercontent.com/u/10192037?v=3","gravatar_id":"","url":"https://api.github.com/users/dseidman","html_url":"https://github.com/dseidman","followers_url":"https://api.github.com/users/dseidman/followers","following_url":"https://api.github.com/users/dseidman/following{/other_user}","gists_url":"https://api.github.com/users/dseidman/gists{/gist_id}","starred_url":"https://api.github.com/users/dseidman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dseidman/subscriptions","organizations_url":"https://api.github.com/users/dseidman/orgs","repos_url":"https://api.github.com/users/dseidman/repos","events_url":"https://api.github.com/users/dseidman/events{/privacy}","received_events_url":"https://api.github.com/users/dseidman/received_events","type":"User","site_admin":false},"repo":{"id":47898791,"name":"BrewTroller-Official","full_name":"dseidman/BrewTroller-Official","owner":{"login":"dseidman","id":10192037,"avatar_url":"https://avatars.githubusercontent.com/u/10192037?v=3","gravatar_id":"","url":"https://api.github.com/users/dseidman","html_url":"https://github.com/dseidman","followers_url":"https://api.github.com/users/dseidman/followers","following_url":"https://api.github.com/users/dseidman/following{/other_user}","gists_url":"https://api.github.com/users/dseidman/gists{/gist_id}","starred_url":"https://api.github.com/users/dseidman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dseidman/subscriptions","organizations_url":"https://api.github.com/users/dseidman/orgs","repos_url":"https://api.github.com/users/dseidman/repos","events_url":"https://api.github.com/users/dseidman/events{/privacy}","received_events_url":"https://api.github.com/users/dseidman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dseidman/BrewTroller-Official","description":"BrewTroller Brewing Controller Firmware","fork":true,"url":"https://api.github.com/repos/dseidman/BrewTroller-Official","forks_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/forks","keys_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/teams","hooks_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/hooks","issue_events_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/issues/events{/number}","events_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/events","assignees_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/assignees{/user}","branches_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/branches{/branch}","tags_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/tags","blobs_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/git/refs{/sha}","trees_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/statuses/{sha}","languages_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/languages","stargazers_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/stargazers","contributors_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/contributors","subscribers_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/subscribers","subscription_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/subscription","commits_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/commits{/sha}","git_commits_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/git/commits{/sha}","comments_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/comments{/number}","issue_comment_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/issues/comments{/number}","contents_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/contents/{+path}","compare_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/merges","archive_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/downloads","issues_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/issues{/number}","pulls_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/pulls{/number}","milestones_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/milestones{/number}","notifications_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/labels{/name}","releases_url":"https://api.github.com/repos/dseidman/BrewTroller-Official/releases{/id}","created_at":"2015-12-12T23:30:33Z","updated_at":"2015-12-12T23:30:36Z","pushed_at":"2015-12-16T01:17:20Z","git_url":"git://github.com/dseidman/BrewTroller-Official.git","ssh_url":"git@github.com:dseidman/BrewTroller-Official.git","clone_url":"https://github.com/dseidman/BrewTroller-Official.git","svn_url":"https://github.com/dseidman/BrewTroller-Official","homepage":null,"size":1170,"stargazers_count":0,"watchers_count":0,"language":"Processing","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"BrewTroller:develop","ref":"develop","sha":"09f3cf46fd7b96b30fdc3fb19cb6fd6bc755fb61","user":{"login":"BrewTroller","id":1020055,"avatar_url":"https://avatars.githubusercontent.com/u/1020055?v=3","gravatar_id":"","url":"https://api.github.com/users/BrewTroller","html_url":"https://github.com/BrewTroller","followers_url":"https://api.github.com/users/BrewTroller/followers","following_url":"https://api.github.com/users/BrewTroller/following{/other_user}","gists_url":"https://api.github.com/users/BrewTroller/gists{/gist_id}","starred_url":"https://api.github.com/users/BrewTroller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrewTroller/subscriptions","organizations_url":"https://api.github.com/users/BrewTroller/orgs","repos_url":"https://api.github.com/users/BrewTroller/repos","events_url":"https://api.github.com/users/BrewTroller/events{/privacy}","received_events_url":"https://api.github.com/users/BrewTroller/received_events","type":"Organization","site_admin":false},"repo":{"id":40026892,"name":"BrewTroller-Official","full_name":"BrewTroller/BrewTroller-Official","owner":{"login":"BrewTroller","id":1020055,"avatar_url":"https://avatars.githubusercontent.com/u/1020055?v=3","gravatar_id":"","url":"https://api.github.com/users/BrewTroller","html_url":"https://github.com/BrewTroller","followers_url":"https://api.github.com/users/BrewTroller/followers","following_url":"https://api.github.com/users/BrewTroller/following{/other_user}","gists_url":"https://api.github.com/users/BrewTroller/gists{/gist_id}","starred_url":"https://api.github.com/users/BrewTroller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrewTroller/subscriptions","organizations_url":"https://api.github.com/users/BrewTroller/orgs","repos_url":"https://api.github.com/users/BrewTroller/repos","events_url":"https://api.github.com/users/BrewTroller/events{/privacy}","received_events_url":"https://api.github.com/users/BrewTroller/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BrewTroller/BrewTroller-Official","description":"BrewTroller Brewing Controller Firmware","fork":false,"url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official","forks_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/forks","keys_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/teams","hooks_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/hooks","issue_events_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/issues/events{/number}","events_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/events","assignees_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/assignees{/user}","branches_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/branches{/branch}","tags_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/tags","blobs_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/git/refs{/sha}","trees_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/statuses/{sha}","languages_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/languages","stargazers_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/stargazers","contributors_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/contributors","subscribers_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/subscribers","subscription_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/subscription","commits_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/commits{/sha}","git_commits_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/git/commits{/sha}","comments_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/comments{/number}","issue_comment_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/issues/comments{/number}","contents_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/contents/{+path}","compare_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/merges","archive_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/downloads","issues_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/issues{/number}","pulls_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls{/number}","milestones_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/milestones{/number}","notifications_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/labels{/name}","releases_url":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/releases{/id}","created_at":"2015-07-31T22:13:34Z","updated_at":"2015-11-06T00:39:03Z","pushed_at":"2015-12-16T01:45:08Z","git_url":"git://github.com/BrewTroller/BrewTroller-Official.git","ssh_url":"git@github.com:BrewTroller/BrewTroller-Official.git","clone_url":"https://github.com/BrewTroller/BrewTroller-Official.git","svn_url":"https://github.com/BrewTroller/BrewTroller-Official","homepage":null,"size":1067,"stargazers_count":1,"watchers_count":1,"language":"Processing","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/5"},"html":{"href":"https://github.com/BrewTroller/BrewTroller-Official/pull/5"},"issue":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/issues/5"},"comments":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/BrewTroller/BrewTroller-Official/statuses/bbac9249eed51e8ac05946232750852b8ecd5f99"}}}}