From 731907b880e57d209d26646ef7efb55d3ec04643 Mon Sep 17 00:00:00 2001 From: condac Date: Sat, 3 Sep 2011 19:41:16 +0300 Subject: Fix so the FAN works, added fan pin as output and fixed fan off case statement --- Sprinter/Sprinter.pde | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Sprinter/Sprinter.pde') diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index dde302c..364393e 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); @@ -807,9 +812,12 @@ inline void process_commands() WRITE(FAN_PIN, HIGH); break; case 107: //M107 Fan Off - analogWrite(FAN_PIN, 0); - + if (code_seen('S')){ + analogWrite(FAN_PIN, 0); + } + else { WRITE(FAN_PIN, LOW); + } break; #endif #if (PS_ON_PIN > -1) -- cgit v1.2.1