{"action":"created","comment":{"url":"https://api.github.com/repos/Voxel8/Marlin/pulls/comments/48094114","id":48094114,"diff_hunk":"@@ -596,6 +596,43 @@ void setup_powerhold() {\n   #endif\n }\n \n+/*\n+  Enable 24V to fans, E-reg, Cartridge Holder, Cartridges\n+  if no short circuit is detected on line\n+  ~200us, blocking time\n+  Requires serial to be enabled to generate error condition\n+*/\n+void enable_power_supply() {\n+  // Turn on FAN first so that 24V does not have a path to 24V_SW through the Rambo. TODO: Disconnect these two circuits.\n+  pinMode(FAN_CHASSIS_TOP_PIN, OUTPUT);\n+  digitalWrite(FAN_CHASSIS_TOP_PIN, HIGH);\n+  delay(6);  // Delay for line to settle. \n+  \n+  analogRead(PS_MONITOR_PIN);  // Throw out first reading\n+  int V_Monitor_Result = analogRead(PS_MONITOR_PIN);\n+  if (V_Monitor_Result > PS_ENABLE_LOWER_LIMIT)   // Test for 24V short to gnd\n+  {\n+    if (V_Monitor_Result <= PS_ENABLE_UPPER_LIMIT) // Test for 24V short to 5V\n+    {\n+      digitalWrite(PS_FORCE_ON_LL,LOW); // Pull Power Supply enable low to force on\n+      pinMode(PS_FORCE_ON_LL, OUTPUT);  //\n+      delayMicroseconds(100);           // 100us minimum delay to register on\n+      pinMode(PS_FORCE_ON_LL, INPUT);   // Release Power Supply enable to allow current limiting","path":"Marlin/Marlin_main.cpp","position":null,"original_position":25,"commit_id":"a97a6c58b704284bc32a226c41a3d5e4b97e6f19","original_commit_id":"887865a75aeedcdb73ed603e909dc9403481881b","user":{"login":"kdumontnu","id":12700993,"avatar_url":"https://avatars.githubusercontent.com/u/12700993?v=3","gravatar_id":"","url":"https://api.github.com/users/kdumontnu","html_url":"https://github.com/kdumontnu","followers_url":"https://api.github.com/users/kdumontnu/followers","following_url":"https://api.github.com/users/kdumontnu/following{/other_user}","gists_url":"https://api.github.com/users/kdumontnu/gists{/gist_id}","starred_url":"https://api.github.com/users/kdumontnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdumontnu/subscriptions","organizations_url":"https://api.github.com/users/kdumontnu/orgs","repos_url":"https://api.github.com/users/kdumontnu/repos","events_url":"https://api.github.com/users/kdumontnu/events{/privacy}","received_events_url":"https://api.github.com/users/kdumontnu/received_events","type":"User","site_admin":false},"body":"There is an external pull-up that sets the default \"high\" state. All we have to do is pull it down and let go.\r\n\r\nThere is a delay between pin-modes to ensure the 24V_SW FET has time to turn on. If we go too fast, the switch will never fully enhance (because of the gate capacitance), and the circuit will just collapse back to off. Time constant is roughly 10000pF*10k = 100us. I'll increase the delay to 200us and add this to the comments. It is also a balance, because while we have this line low, there is no current protection. Holding low for a significant portion of time will increase our chances of smoking something if the detection circuit failes. Lets probe this on Monday.\r\n","created_at":"2015-12-19T16:32:14Z","updated_at":"2015-12-19T16:32:14Z","html_url":"https://github.com/Voxel8/Marlin/pull/72#discussion_r48094114","pull_request_url":"https://api.github.com/repos/Voxel8/Marlin/pulls/72","_links":{"self":{"href":"https://api.github.com/repos/Voxel8/Marlin/pulls/comments/48094114"},"html":{"href":"https://github.com/Voxel8/Marlin/pull/72#discussion_r48094114"},"pull_request":{"href":"https://api.github.com/repos/Voxel8/Marlin/pulls/72"}}},"pull_request":{"url":"https://api.github.com/repos/Voxel8/Marlin/pulls/72","id":52203032,"html_url":"https://github.com/Voxel8/Marlin/pull/72","diff_url":"https://github.com/Voxel8/Marlin/pull/72.diff","patch_url":"https://github.com/Voxel8/Marlin/pull/72.patch","issue_url":"https://api.github.com/repos/Voxel8/Marlin/issues/72","number":72,"state":"open","locked":false,"title":"Kd/feature voltage enable","user":{"login":"kdumontnu","id":12700993,"avatar_url":"https://avatars.githubusercontent.com/u/12700993?v=3","gravatar_id":"","url":"https://api.github.com/users/kdumontnu","html_url":"https://github.com/kdumontnu","followers_url":"https://api.github.com/users/kdumontnu/followers","following_url":"https://api.github.com/users/kdumontnu/following{/other_user}","gists_url":"https://api.github.com/users/kdumontnu/gists{/gist_id}","starred_url":"https://api.github.com/users/kdumontnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdumontnu/subscriptions","organizations_url":"https://api.github.com/users/kdumontnu/orgs","repos_url":"https://api.github.com/users/kdumontnu/repos","events_url":"https://api.github.com/users/kdumontnu/events{/privacy}","received_events_url":"https://api.github.com/users/kdumontnu/received_events","type":"User","site_admin":false},"body":"This PR checks the status of the 24V_SW line at init, and enables the current limiting circuit if no short circuit is detected. If a short circuit is detected, the 24V is not enabled to fans + Cartridges with an error message. \r\n\r\nThere are some improvements that might be able to made in the future, such as:\r\n\r\n - Polling the line periodically to test no over-currect condition has occured.\r\n - Detecting if the processor has come up from power-up or from reset condition.\r\n\r\nIf this FW is loaded on Gen3C ( no current limit circuitry ), it should write `echo:ERROR TURNING ON 24V POWER. Detected 24V/gnd short... PLEASE CHECK HARDWARE...`, but continue working fine.\r\n\r\nI also fixed a compiler warning that has been around for a while where someone was trying to implicitely convert NULL to long.","created_at":"2015-12-01T01:06:57Z","updated_at":"2015-12-19T16:32:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd859c006dec2a8c37b2d07c0ddf6ad73ed49b50","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Voxel8/Marlin/pulls/72/commits","review_comments_url":"https://api.github.com/repos/Voxel8/Marlin/pulls/72/comments","review_comment_url":"https://api.github.com/repos/Voxel8/Marlin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Voxel8/Marlin/issues/72/comments","statuses_url":"https://api.github.com/repos/Voxel8/Marlin/statuses/a97a6c58b704284bc32a226c41a3d5e4b97e6f19","head":{"label":"Voxel8:kd/feature-Voltage-enable","ref":"kd/feature-Voltage-enable","sha":"a97a6c58b704284bc32a226c41a3d5e4b97e6f19","user":{"login":"Voxel8","id":8389280,"avatar_url":"https://avatars.githubusercontent.com/u/8389280?v=3","gravatar_id":"","url":"https://api.github.com/users/Voxel8","html_url":"https://github.com/Voxel8","followers_url":"https://api.github.com/users/Voxel8/followers","following_url":"https://api.github.com/users/Voxel8/following{/other_user}","gists_url":"https://api.github.com/users/Voxel8/gists{/gist_id}","starred_url":"https://api.github.com/users/Voxel8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voxel8/subscriptions","organizations_url":"https://api.github.com/users/Voxel8/orgs","repos_url":"https://api.github.com/users/Voxel8/repos","events_url":"https://api.github.com/users/Voxel8/events{/privacy}","received_events_url":"https://api.github.com/users/Voxel8/received_events","type":"Organization","site_admin":false},"repo":{"id":21843291,"name":"Marlin","full_name":"Voxel8/Marlin","owner":{"login":"Voxel8","id":8389280,"avatar_url":"https://avatars.githubusercontent.com/u/8389280?v=3","gravatar_id":"","url":"https://api.github.com/users/Voxel8","html_url":"https://github.com/Voxel8","followers_url":"https://api.github.com/users/Voxel8/followers","following_url":"https://api.github.com/users/Voxel8/following{/other_user}","gists_url":"https://api.github.com/users/Voxel8/gists{/gist_id}","starred_url":"https://api.github.com/users/Voxel8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voxel8/subscriptions","organizations_url":"https://api.github.com/users/Voxel8/orgs","repos_url":"https://api.github.com/users/Voxel8/repos","events_url":"https://api.github.com/users/Voxel8/events{/privacy}","received_events_url":"https://api.github.com/users/Voxel8/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Voxel8/Marlin","description":"Voxel8 Development Kit Firmware","fork":false,"url":"https://api.github.com/repos/Voxel8/Marlin","forks_url":"https://api.github.com/repos/Voxel8/Marlin/forks","keys_url":"https://api.github.com/repos/Voxel8/Marlin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Voxel8/Marlin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Voxel8/Marlin/teams","hooks_url":"https://api.github.com/repos/Voxel8/Marlin/hooks","issue_events_url":"https://api.github.com/repos/Voxel8/Marlin/issues/events{/number}","events_url":"https://api.github.com/repos/Voxel8/Marlin/events","assignees_url":"https://api.github.com/repos/Voxel8/Marlin/assignees{/user}","branches_url":"https://api.github.com/repos/Voxel8/Marlin/branches{/branch}","tags_url":"https://api.github.com/repos/Voxel8/Marlin/tags","blobs_url":"https://api.github.com/repos/Voxel8/Marlin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Voxel8/Marlin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Voxel8/Marlin/git/refs{/sha}","trees_url":"https://api.github.com/repos/Voxel8/Marlin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Voxel8/Marlin/statuses/{sha}","languages_url":"https://api.github.com/repos/Voxel8/Marlin/languages","stargazers_url":"https://api.github.com/repos/Voxel8/Marlin/stargazers","contributors_url":"https://api.github.com/repos/Voxel8/Marlin/contributors","subscribers_url":"https://api.github.com/repos/Voxel8/Marlin/subscribers","subscription_url":"https://api.github.com/repos/Voxel8/Marlin/subscription","commits_url":"https://api.github.com/repos/Voxel8/Marlin/commits{/sha}","git_commits_url":"https://api.github.com/repos/Voxel8/Marlin/git/commits{/sha}","comments_url":"https://api.github.com/repos/Voxel8/Marlin/comments{/number}","issue_comment_url":"https://api.github.com/repos/Voxel8/Marlin/issues/comments{/number}","contents_url":"https://api.github.com/repos/Voxel8/Marlin/contents/{+path}","compare_url":"https://api.github.com/repos/Voxel8/Marlin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Voxel8/Marlin/merges","archive_url":"https://api.github.com/repos/Voxel8/Marlin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Voxel8/Marlin/downloads","issues_url":"https://api.github.com/repos/Voxel8/Marlin/issues{/number}","pulls_url":"https://api.github.com/repos/Voxel8/Marlin/pulls{/number}","milestones_url":"https://api.github.com/repos/Voxel8/Marlin/milestones{/number}","notifications_url":"https://api.github.com/repos/Voxel8/Marlin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Voxel8/Marlin/labels{/name}","releases_url":"https://api.github.com/repos/Voxel8/Marlin/releases{/id}","created_at":"2014-07-15T02:22:50Z","updated_at":"2015-10-08T23:48:44Z","pushed_at":"2015-12-19T16:15:47Z","git_url":"git://github.com/Voxel8/Marlin.git","ssh_url":"git@github.com:Voxel8/Marlin.git","clone_url":"https://github.com/Voxel8/Marlin.git","svn_url":"https://github.com/Voxel8/Marlin","homepage":"","size":27069,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":16,"forks":1,"open_issues":16,"watchers":1,"default_branch":"master"}},"base":{"label":"Voxel8:master","ref":"master","sha":"49b2473032265efba3b4b4ef0346963e44c680fa","user":{"login":"Voxel8","id":8389280,"avatar_url":"https://avatars.githubusercontent.com/u/8389280?v=3","gravatar_id":"","url":"https://api.github.com/users/Voxel8","html_url":"https://github.com/Voxel8","followers_url":"https://api.github.com/users/Voxel8/followers","following_url":"https://api.github.com/users/Voxel8/following{/other_user}","gists_url":"https://api.github.com/users/Voxel8/gists{/gist_id}","starred_url":"https://api.github.com/users/Voxel8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voxel8/subscriptions","organizations_url":"https://api.github.com/users/Voxel8/orgs","repos_url":"https://api.github.com/users/Voxel8/repos","events_url":"https://api.github.com/users/Voxel8/events{/privacy}","received_events_url":"https://api.github.com/users/Voxel8/received_events","type":"Organization","site_admin":false},"repo":{"id":21843291,"name":"Marlin","full_name":"Voxel8/Marlin","owner":{"login":"Voxel8","id":8389280,"avatar_url":"https://avatars.githubusercontent.com/u/8389280?v=3","gravatar_id":"","url":"https://api.github.com/users/Voxel8","html_url":"https://github.com/Voxel8","followers_url":"https://api.github.com/users/Voxel8/followers","following_url":"https://api.github.com/users/Voxel8/following{/other_user}","gists_url":"https://api.github.com/users/Voxel8/gists{/gist_id}","starred_url":"https://api.github.com/users/Voxel8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voxel8/subscriptions","organizations_url":"https://api.github.com/users/Voxel8/orgs","repos_url":"https://api.github.com/users/Voxel8/repos","events_url":"https://api.github.com/users/Voxel8/events{/privacy}","received_events_url":"https://api.github.com/users/Voxel8/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Voxel8/Marlin","description":"Voxel8 Development Kit Firmware","fork":false,"url":"https://api.github.com/repos/Voxel8/Marlin","forks_url":"https://api.github.com/repos/Voxel8/Marlin/forks","keys_url":"https://api.github.com/repos/Voxel8/Marlin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Voxel8/Marlin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Voxel8/Marlin/teams","hooks_url":"https://api.github.com/repos/Voxel8/Marlin/hooks","issue_events_url":"https://api.github.com/repos/Voxel8/Marlin/issues/events{/number}","events_url":"https://api.github.com/repos/Voxel8/Marlin/events","assignees_url":"https://api.github.com/repos/Voxel8/Marlin/assignees{/user}","branches_url":"https://api.github.com/repos/Voxel8/Marlin/branches{/branch}","tags_url":"https://api.github.com/repos/Voxel8/Marlin/tags","blobs_url":"https://api.github.com/repos/Voxel8/Marlin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Voxel8/Marlin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Voxel8/Marlin/git/refs{/sha}","trees_url":"https://api.github.com/repos/Voxel8/Marlin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Voxel8/Marlin/statuses/{sha}","languages_url":"https://api.github.com/repos/Voxel8/Marlin/languages","stargazers_url":"https://api.github.com/repos/Voxel8/Marlin/stargazers","contributors_url":"https://api.github.com/repos/Voxel8/Marlin/contributors","subscribers_url":"https://api.github.com/repos/Voxel8/Marlin/subscribers","subscription_url":"https://api.github.com/repos/Voxel8/Marlin/subscription","commits_url":"https://api.github.com/repos/Voxel8/Marlin/commits{/sha}","git_commits_url":"https://api.github.com/repos/Voxel8/Marlin/git/commits{/sha}","comments_url":"https://api.github.com/repos/Voxel8/Marlin/comments{/number}","issue_comment_url":"https://api.github.com/repos/Voxel8/Marlin/issues/comments{/number}","contents_url":"https://api.github.com/repos/Voxel8/Marlin/contents/{+path}","compare_url":"https://api.github.com/repos/Voxel8/Marlin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Voxel8/Marlin/merges","archive_url":"https://api.github.com/repos/Voxel8/Marlin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Voxel8/Marlin/downloads","issues_url":"https://api.github.com/repos/Voxel8/Marlin/issues{/number}","pulls_url":"https://api.github.com/repos/Voxel8/Marlin/pulls{/number}","milestones_url":"https://api.github.com/repos/Voxel8/Marlin/milestones{/number}","notifications_url":"https://api.github.com/repos/Voxel8/Marlin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Voxel8/Marlin/labels{/name}","releases_url":"https://api.github.com/repos/Voxel8/Marlin/releases{/id}","created_at":"2014-07-15T02:22:50Z","updated_at":"2015-10-08T23:48:44Z","pushed_at":"2015-12-19T16:15:47Z","git_url":"git://github.com/Voxel8/Marlin.git","ssh_url":"git@github.com:Voxel8/Marlin.git","clone_url":"https://github.com/Voxel8/Marlin.git","svn_url":"https://github.com/Voxel8/Marlin","homepage":"","size":27069,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":16,"forks":1,"open_issues":16,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Voxel8/Marlin/pulls/72"},"html":{"href":"https://github.com/Voxel8/Marlin/pull/72"},"issue":{"href":"https://api.github.com/repos/Voxel8/Marlin/issues/72"},"comments":{"href":"https://api.github.com/repos/Voxel8/Marlin/issues/72/comments"},"review_comments":{"href":"https://api.github.com/repos/Voxel8/Marlin/pulls/72/comments"},"review_comment":{"href":"https://api.github.com/repos/Voxel8/Marlin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Voxel8/Marlin/pulls/72/commits"},"statuses":{"href":"https://api.github.com/repos/Voxel8/Marlin/statuses/a97a6c58b704284bc32a226c41a3d5e4b97e6f19"}}}}