{"action":"closed","issue":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/2788","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/2788/labels{/name}","comments_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/2788/comments","events_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/2788/events","html_url":"https://github.com/MarlinFirmware/Marlin/issues/2788","id":118210735,"number":2788,"title":"Controller fan inversion","user":{"login":"skytalez","id":15958522,"avatar_url":"https://avatars.githubusercontent.com/u/15958522?v=3","gravatar_id":"","url":"https://api.github.com/users/skytalez","html_url":"https://github.com/skytalez","followers_url":"https://api.github.com/users/skytalez/followers","following_url":"https://api.github.com/users/skytalez/following{/other_user}","gists_url":"https://api.github.com/users/skytalez/gists{/gist_id}","starred_url":"https://api.github.com/users/skytalez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skytalez/subscriptions","organizations_url":"https://api.github.com/users/skytalez/orgs","repos_url":"https://api.github.com/users/skytalez/repos","events_url":"https://api.github.com/users/skytalez/events{/privacy}","received_events_url":"https://api.github.com/users/skytalez/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/Potential%20bug?","name":"Potential bug?","color":"eb6420"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-21T17:52:55Z","updated_at":"2015-12-02T21:50:18Z","closed_at":"2015-12-02T21:50:18Z","body":"I have a custom made printer running on Marlin and Ramps. Lately I added controller fans and I noticed that they would permanently spin up, even though all motors were turned off. After some research I found out, that I had used the X/Y/Z/E_ENABLE_ON option (Configuration.h) for inverting the stepper motors enable pins, and that this configuration was not handled by the controller fan code.\r\nI had to change some lines in Marlin_main.cpp to make it work as expected:\r\n\r\n``` C++\r\n    if((X_ENABLE_ON ^ !READ(X_ENABLE_PIN)) || (Y_ENABLE_ON ^ !READ(Y_ENABLE_PIN)) || (Z_ENABLE_ON ^ !READ(Z_ENABLE_PIN)) || (soft_pwm_bed > 0)\r\n    #if EXTRUDERS > 2\r\n       || (E_ENABLE_ON ^ !READ(E2_ENABLE_PIN))\r\n    #endif\r\n    #if EXTRUDERS > 1\r\n      #if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1\r\n       || (E_ENABLE_ON ^ !READ(X2_ENABLE_PIN))\r\n      #endif\r\n       || (E_ENABLE_ON ^ >!READ(E1_ENABLE_PIN))\r\n    #endif\r\n       || (E_ENABLE_ON ^ !READ(E0_ENABLE_PIN))) //If any of the drivers are enabled...\r\n    {\r\n      lastMotor = millis(); //... set time to NOW so the fan will turn on\r\n    }\r\n```\r\n\r\nThe xor now takes into account the corresponding X/Y/Z/E_ENABLE_ON configuration.\r\n\r\n "}}