summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkliment <kliment.yanev@gmail.com>2011-09-04 02:03:51 -0700
committerkliment <kliment.yanev@gmail.com>2011-09-04 02:03:51 -0700
commit29ed8a3eb0815a161a1a2de0d4416b7d123967a0 (patch)
tree4d02fc4d119a490e0c81e266f68829226b7d5460
parent6318cd2496f9f0e5ff8925d8f26ea3866b1d9a81 (diff)
parent66288464faf1dea592cdea360bcbb830ef017058 (diff)
Merge pull request #83 from condac/patch-1
Fix so the FAN pin is set as output and fixed fan off case for PWM pins
-rw-r--r--Sprinter/Sprinter.pde14
1 files changed, 10 insertions, 4 deletions
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index 44bdbb8..a941531 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -293,6 +293,11 @@ void setup()
SET_OUTPUT(HEATER_1_PIN);
#endif
+ //Initialize Fan Pin
+ #if (FAN_PIN > -1)
+ SET_OUTPUT(FAN_PIN);
+ #endif
+
//Initialize Step Pins
#if (X_STEP_PIN > -1)
SET_OUTPUT(X_STEP_PIN);
@@ -803,13 +808,14 @@ inline void process_commands()
WRITE(FAN_PIN, HIGH);
analogWrite(FAN_PIN, constrain(code_value(),0,255) );
}
- else
+ else {
WRITE(FAN_PIN, HIGH);
+ analogWrite(FAN_PIN, 255 );
+ }
break;
case 107: //M107 Fan Off
- analogWrite(FAN_PIN, 0);
-
- WRITE(FAN_PIN, LOW);
+ analogWrite(FAN_PIN, 0);
+ WRITE(FAN_PIN, LOW);
break;
#endif
#if (PS_ON_PIN > -1)