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 From 66288464faf1dea592cdea360bcbb830ef017058 Mon Sep 17 00:00:00 2001 From: condac Date: Sun, 4 Sep 2011 11:49:14 +0300 Subject: New and improved On and Off for FAN_PIN --- Sprinter/Sprinter.pde | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Sprinter/Sprinter.pde') diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index 364393e..857d652 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -808,16 +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 - if (code_seen('S')){ analogWrite(FAN_PIN, 0); - } - else { - WRITE(FAN_PIN, LOW); - } + WRITE(FAN_PIN, LOW); break; #endif #if (PS_ON_PIN > -1) -- cgit v1.2.1