diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 055dd06..e0a9c75 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -127,9 +127,28 @@ //=============================Mechanical Settings=========================== //=========================================================================== -// Endstop Settings +// corse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors +#ifndef ENDSTOPPULLUPS + // fine Enstop settings: Individual Pullups. will be ignord if ENDSTOPPULLUPS is defined + #define ENDSTOPPULLUP_XMAX + #define ENDSTOPPULLUP_YMAX + #define ENDSTOPPULLUP_ZMAX + #define ENDSTOPPULLUP_XMIN + #define ENDSTOPPULLUP_YMIN + //#define ENDSTOPPULLUP_ZMIN +#endif + +#ifdef ENDSTOPPULLUPS + #define ENDSTOPPULLUP_XMAX + #define ENDSTOPPULLUP_YMAX + #define ENDSTOPPULLUP_ZMAX + #define ENDSTOPPULLUP_XMIN + #define ENDSTOPPULLUP_YMIN + #define ENDSTOPPULLUP_ZMIN +#endif + // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 13f18bc..bb53e06 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -659,51 +659,48 @@ void st_init() #endif //endstops and pullups - #ifdef ENDSTOPPULLUPS - #if X_MIN_PIN > -1 - SET_INPUT(X_MIN_PIN); + + #if X_MIN_PIN > -1 + SET_INPUT(X_MIN_PIN); + #ifdef ENDSTOPPULLUP_XMIN WRITE(X_MIN_PIN,HIGH); #endif - #if X_MAX_PIN > -1 - SET_INPUT(X_MAX_PIN); - WRITE(X_MAX_PIN,HIGH); - #endif - #if Y_MIN_PIN > -1 - SET_INPUT(Y_MIN_PIN); + #endif + + #if Y_MIN_PIN > -1 + SET_INPUT(Y_MIN_PIN); + #ifdef ENDSTOPPULLUP_YMIN WRITE(Y_MIN_PIN,HIGH); #endif - #if Y_MAX_PIN > -1 - SET_INPUT(Y_MAX_PIN); - WRITE(Y_MAX_PIN,HIGH); - #endif - #if Z_MIN_PIN > -1 - SET_INPUT(Z_MIN_PIN); + #endif + + #if Z_MIN_PIN > -1 + SET_INPUT(Z_MIN_PIN); + #ifdef ENDSTOPPULLUP_ZMIN WRITE(Z_MIN_PIN,HIGH); #endif - #if Z_MAX_PIN > -1 - SET_INPUT(Z_MAX_PIN); + #endif + + #if X_MAX_PIN > -1 + SET_INPUT(X_MAX_PIN); + #ifdef ENDSTOPPULLUP_XMAX + WRITE(X_MAX_PIN,HIGH); + #endif + #endif + + #if Y_MAX_PIN > -1 + SET_INPUT(Y_MAX_PIN); + #ifdef ENDSTOPPULLUP_YMAX + WRITE(Y_MAX_PIN,HIGH); + #endif + #endif + + #if Z_MAX_PIN > -1 + SET_INPUT(Z_MAX_PIN); + #ifdef ENDSTOPPULLUP_ZMAX WRITE(Z_MAX_PIN,HIGH); #endif - #else //ENDSTOPPULLUPS - #if X_MIN_PIN > -1 - SET_INPUT(X_MIN_PIN); - #endif - #if X_MAX_PIN > -1 - SET_INPUT(X_MAX_PIN); - #endif - #if Y_MIN_PIN > -1 - SET_INPUT(Y_MIN_PIN); - #endif - #if Y_MAX_PIN > -1 - SET_INPUT(Y_MAX_PIN); - #endif - #if Z_MIN_PIN > -1 - SET_INPUT(Z_MIN_PIN); - #endif - #if Z_MAX_PIN > -1 - SET_INPUT(Z_MAX_PIN); - #endif - #endif //ENDSTOPPULLUPS + #endif //Initialize Step Pins