From 469e53475a04cab77d5ab4ce787f70ea580b67b9 Mon Sep 17 00:00:00 2001 From: kliment Date: Sat, 9 Jul 2011 15:12:33 +0200 Subject: Use fastio for endstop checks during moves --- Sprinter/Sprinter.pde | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'Sprinter') diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index b79a329..ae07730 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -1197,12 +1197,24 @@ void linear_move(unsigned long axis_steps_remaining[]) // make linear move with //If there are x or y steps remaining, perform Bresenham algorithm if(axis_steps_remaining[primary_axis]) { - if(X_MIN_PIN > -1) if(!move_direction[0]) if(digitalRead(X_MIN_PIN) != ENDSTOPS_INVERTING) break; - if(Y_MIN_PIN > -1) if(!move_direction[1]) if(digitalRead(Y_MIN_PIN) != ENDSTOPS_INVERTING) break; - if(X_MAX_PIN > -1) if(move_direction[0]) if(digitalRead(X_MAX_PIN) != ENDSTOPS_INVERTING) break; - if(Y_MAX_PIN > -1) if(move_direction[1]) if(digitalRead(Y_MAX_PIN) != ENDSTOPS_INVERTING) break; - if(Z_MIN_PIN > -1) if(!move_direction[2]) if(digitalRead(Z_MIN_PIN) != ENDSTOPS_INVERTING) break; - if(Z_MAX_PIN > -1) if(move_direction[2]) if(digitalRead(Z_MAX_PIN) != ENDSTOPS_INVERTING) break; + #if (X_MIN_PIN > -1) + if(!move_direction[0]) if(READ(X_MIN_PIN) != ENDSTOPS_INVERTING) break; + #endif + #if (Y_MIN_PIN > -1) + if(!move_direction[1]) if(READ(Y_MIN_PIN) != ENDSTOPS_INVERTING) break; + #endif + #if (X_MAX_PIN > -1) + if(move_direction[0]) if(READ(X_MAX_PIN) != ENDSTOPS_INVERTING) break; + #endif + #if (Y_MAX_PIN > -1) + if(move_direction[1]) if(READ(Y_MAX_PIN) != ENDSTOPS_INVERTING) break; + #endif + #if (Z_MIN_PIN > -1) + if(!move_direction[2]) if(READ(Z_MIN_PIN) != ENDSTOPS_INVERTING) break; + #endif + #if (Z_MAX_PIN > -1) + if(move_direction[2]) if(READ(Z_MAX_PIN) != ENDSTOPS_INVERTING) break; + #endif timediff = micros() * 100 - axis_previous_micros[primary_axis]; if(timediff<0){//check for overflow axis_previous_micros[primary_axis]=micros()*100; -- cgit v1.2.1