diff options
author | Kliment Yanev <kliment.yanev@gmail.com> | 2011-09-08 23:03:57 +0200 |
---|---|---|
committer | Kliment Yanev <kliment.yanev@gmail.com> | 2011-09-08 23:03:57 +0200 |
commit | 78be8881ce2eb537724a47bf9cfd6e27316306b1 (patch) | |
tree | b02fb45498d36224cdcb3c4c9d72bcfb6d6ee30e /Sprinter/Sprinter.pde | |
parent | 7dd34fc5e8d00dbe57a9e820c508f3671e25298b (diff) | |
parent | 0e91bea8f1b223703248f801733738b39f3d5fd8 (diff) |
Merge branch 'master' of github.com:kliment/Sprinter into experimental
Diffstat (limited to 'Sprinter/Sprinter.pde')
-rw-r--r-- | Sprinter/Sprinter.pde | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index 95fcd47..5daee2f 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -297,6 +297,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); @@ -851,13 +856,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) @@ -1260,8 +1266,8 @@ inline void linear_move(unsigned long axis_steps_remaining[]) // make linear mov accelerating = true; decelerating = true; } - long current_speed = (long) ((long) max_speed_steps_per_second - ((((long) steps_per_sqr_second) / 10000) - * ((micros() - start_move_micros) / 100))); + long current_speed = (long) ((long) max_speed_steps_per_second - ((((long) steps_per_sqr_second) / 100) + * ((micros() - start_move_micros) / 100)/100)); interval = 100000000 / current_speed; if (interval > max_interval) interval = max_interval; |