From a638077ea8399f77e7314ddcb93eb985e01d5d1f Mon Sep 17 00:00:00 2001 From: lemio Date: Sat, 27 Aug 2011 03:35:42 +0300 Subject: Added support for using different endstops () --- Sprinter/Sprinter.pde | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Sprinter') diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index 3bb3358..7081865 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -944,27 +944,27 @@ inline void process_commands() case 119: // M119 #if (X_MIN_PIN > -1) Serial.print("x_min:"); - Serial.print((READ(X_MIN_PIN)^ENDSTOPS_INVERTING)?"H ":"L "); + Serial.print((READ(X_MIN_PIN)^X_ENDSTOP_INVERT)?"H ":"L "); #endif #if (X_MAX_PIN > -1) Serial.print("x_max:"); - Serial.print((READ(X_MAX_PIN)^ENDSTOPS_INVERTING)?"H ":"L "); + Serial.print((READ(X_MAX_PIN)^X_ENDSTOP_INVERT)?"H ":"L "); #endif #if (Y_MIN_PIN > -1) Serial.print("y_min:"); - Serial.print((READ(Y_MIN_PIN)^ENDSTOPS_INVERTING)?"H ":"L "); + Serial.print((READ(Y_MIN_PIN)^Y_ENDSTOP_INVERT)?"H ":"L "); #endif #if (Y_MAX_PIN > -1) Serial.print("y_max:"); - Serial.print((READ(Y_MAX_PIN)^ENDSTOPS_INVERTING)?"H ":"L "); + Serial.print((READ(Y_MAX_PIN)^Y_ENDSTOP_INVERT)?"H ":"L "); #endif #if (Z_MIN_PIN > -1) Serial.print("z_min:"); - Serial.print((READ(Z_MIN_PIN)^ENDSTOPS_INVERTING)?"H ":"L "); + Serial.print((READ(Z_MIN_PIN)^Z_ENDSTOP_INVERT?"H ":"L "); #endif #if (Z_MAX_PIN > -1) Serial.print("z_max:"); - Serial.print((READ(Z_MAX_PIN)^ENDSTOPS_INVERTING)?"H ":"L "); + Serial.print((READ(Z_MAX_PIN)^Z_ENDSTOP_INVERT)?"H ":"L "); #endif Serial.println(""); break; @@ -1119,22 +1119,22 @@ inline void linear_move(unsigned long axis_steps_remaining[]) // make linear mov else WRITE(E_DIR_PIN,INVERT_E_DIR); movereset: #if (X_MIN_PIN > -1) - if(!move_direction[0]) if(READ(X_MIN_PIN) != ENDSTOPS_INVERTING) axis_steps_remaining[0]=0; + if(!move_direction[0]) if(READ(X_MIN_PIN) != X_ENDSTOP_INVERT) axis_steps_remaining[0]=0; #endif #if (Y_MIN_PIN > -1) - if(!move_direction[1]) if(READ(Y_MIN_PIN) != ENDSTOPS_INVERTING) axis_steps_remaining[1]=0; + if(!move_direction[1]) if(READ(Y_MIN_PIN) != Y_ENDSTOP_INVERT) axis_steps_remaining[1]=0; #endif #if (Z_MIN_PIN > -1) - if(!move_direction[2]) if(READ(Z_MIN_PIN) != ENDSTOPS_INVERTING) axis_steps_remaining[2]=0; + if(!move_direction[2]) if(READ(Z_MIN_PIN) != Z_ENDSTOP_INVERT) axis_steps_remaining[2]=0; #endif #if (X_MAX_PIN > -1) - if(move_direction[0]) if(READ(X_MAX_PIN) != ENDSTOPS_INVERTING) axis_steps_remaining[0]=0; + if(move_direction[0]) if(READ(X_MAX_PIN) != X_ENDSTOP_INVERT) axis_steps_remaining[0]=0; #endif #if (Y_MAX_PIN > -1) - if(move_direction[1]) if(READ(Y_MAX_PIN) != ENDSTOPS_INVERTING) axis_steps_remaining[1]=0; + if(move_direction[1]) if(READ(Y_MAX_PIN) != Y_ENDSTOP_INVERT) axis_steps_remaining[1]=0; #endif # if(Z_MAX_PIN > -1) - if(move_direction[2]) if(READ(Z_MAX_PIN) != ENDSTOPS_INVERTING) axis_steps_remaining[2]=0; + if(move_direction[2]) if(READ(Z_MAX_PIN) != Z_ENDSTOP_INVERT) axis_steps_remaining[2]=0; #endif @@ -1310,22 +1310,22 @@ inline void linear_move(unsigned long axis_steps_remaining[]) // make linear mov //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(READ(X_MIN_PIN) != ENDSTOPS_INVERTING) if(primary_axis==0) break; else if(axis_steps_remaining[0]) axis_steps_remaining[0]=0; + if(!move_direction[0]) if(READ(X_MIN_PIN) != X_ENDSTOP_INVERT) if(primary_axis==0) break; else if(axis_steps_remaining[0]) axis_steps_remaining[0]=0; #endif #if (Y_MIN_PIN > -1) - if(!move_direction[1]) if(READ(Y_MIN_PIN) != ENDSTOPS_INVERTING) if(primary_axis==1) break; else if(axis_steps_remaining[1]) axis_steps_remaining[1]=0; + if(!move_direction[1]) if(READ(Y_MIN_PIN) != Y_ENDSTOP_INVERT) if(primary_axis==1) break; else if(axis_steps_remaining[1]) axis_steps_remaining[1]=0; #endif #if (X_MAX_PIN > -1) - if(move_direction[0]) if(READ(X_MAX_PIN) != ENDSTOPS_INVERTING) if(primary_axis==0) break; else if(axis_steps_remaining[0]) axis_steps_remaining[0]=0; + if(move_direction[0]) if(READ(X_MAX_PIN) != X_ENDSTOP_INVERT) if(primary_axis==0) break; else if(axis_steps_remaining[0]) axis_steps_remaining[0]=0; #endif #if (Y_MAX_PIN > -1) - if(move_direction[1]) if(READ(Y_MAX_PIN) != ENDSTOPS_INVERTING) if(primary_axis==1) break; else if(axis_steps_remaining[1]) axis_steps_remaining[1]=0; + if(move_direction[1]) if(READ(Y_MAX_PIN) != Y_ENDSTOP_INVERT) if(primary_axis==1) break; else if(axis_steps_remaining[1]) axis_steps_remaining[1]=0; #endif #if (Z_MIN_PIN > -1) - if(!move_direction[2]) if(READ(Z_MIN_PIN) != ENDSTOPS_INVERTING) if(primary_axis==2) break; else if(axis_steps_remaining[2]) axis_steps_remaining[2]=0; + if(!move_direction[2]) if(READ(Z_MIN_PIN) != Z_ENDSTOP_INVERT) if(primary_axis==2) break; else if(axis_steps_remaining[2]) axis_steps_remaining[2]=0; #endif #if (Z_MAX_PIN > -1) - if(move_direction[2]) if(READ(Z_MAX_PIN) != ENDSTOPS_INVERTING) if(primary_axis==2) break; else if(axis_steps_remaining[2]) axis_steps_remaining[2]=0; + if(move_direction[2]) if(READ(Z_MAX_PIN) != Z_ENDSTOP_INVERT) if(primary_axis==2) break; else if(axis_steps_remaining[2]) axis_steps_remaining[2]=0; #endif timediff = micros() * 100 - axis_previous_micros[primary_axis]; if(timediff<0){//check for overflow -- cgit v1.2.1 From 34b9fd054b7c45e9e3d7b6696c426d006380fd14 Mon Sep 17 00:00:00 2001 From: lemio Date: Sat, 27 Aug 2011 03:28:16 +0300 Subject: Edited Sprinter/Configuration.h via GitHub --- Sprinter/Configuration.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Sprinter') diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index 354e59d..f0001da 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -31,10 +31,11 @@ float axis_steps_per_unit[] = {80, 80, 3200/1.25,700}; //// Endstop Settings #define ENDSTOPPULLUPS 1 // Comment this out (using // at the start of the line) to disable the endstop pullup resistors // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. -const bool ENDSTOPS_INVERTING = false; //set to true to invert the logic of the endstops //If your axes are only moving in one direction, make sure the endstops are connected properly. //If your axes move in one direction ONLY when the endstops are triggered, set ENDSTOPS_INVERTING to true here - +cost bool X_ENDSTOP_INVERT = false;//set to true to invert the logic of the endstops +cost bool Y_ENDSTOP_INVERT = false;//set to true to invert the logic of the endstops +cost bool Z_ENDSTOP_INVERT = false;//set to true to invert the logic of the endstops // This determines the communication speed of the printer #define BAUDRATE 115200 -- cgit v1.2.1 From 492682f06a7821f8e1bcd2153676e371d0186ad8 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 26 Aug 2011 19:40:37 +0200 Subject: Fixed configuration for new [XYZ]_ENDSTOP_INVERT options --- Sprinter/Configuration.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Sprinter') diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index f0001da..2594593 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -32,10 +32,11 @@ float axis_steps_per_unit[] = {80, 80, 3200/1.25,700}; #define ENDSTOPPULLUPS 1 // Comment this out (using // at the start of the line) to disable the endstop pullup resistors // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. //If your axes are only moving in one direction, make sure the endstops are connected properly. -//If your axes move in one direction ONLY when the endstops are triggered, set ENDSTOPS_INVERTING to true here -cost bool X_ENDSTOP_INVERT = false;//set to true to invert the logic of the endstops -cost bool Y_ENDSTOP_INVERT = false;//set to true to invert the logic of the endstops -cost bool Z_ENDSTOP_INVERT = false;//set to true to invert the logic of the endstops +//If your axes move in one direction ONLY when the endstops are triggered, set [XYZ]_ENDSTOP_INVERT to true here: +const bool X_ENDSTOP_INVERT = false; +const bool Y_ENDSTOP_INVERT = false; +const bool Z_ENDSTOP_INVERT = false; + // This determines the communication speed of the printer #define BAUDRATE 115200 -- cgit v1.2.1 From b74d1b90e3d74176b1b97b481d91e73bbc0f3557 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 26 Aug 2011 19:43:38 +0200 Subject: Fixed typo in Z_ENDSTOP_INVERT patch by lemio --- Sprinter/Sprinter.pde | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sprinter') diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index 7081865..3243d78 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -960,7 +960,7 @@ inline void process_commands() #endif #if (Z_MIN_PIN > -1) Serial.print("z_min:"); - Serial.print((READ(Z_MIN_PIN)^Z_ENDSTOP_INVERT?"H ":"L "); + Serial.print((READ(Z_MIN_PIN)^Z_ENDSTOP_INVERT)?"H ":"L "); #endif #if (Z_MAX_PIN > -1) Serial.print("z_max:"); -- cgit v1.2.1