diff --git a/config.gen3.h b/config.gen3.h index 4162155..ce6e48a 100644 --- a/config.gen3.h +++ b/config.gen3.h @@ -158,6 +158,12 @@ undefine if you don't want to use them #include "arduino.h" +/* + internal pullup resistors + the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this. +*/ +//#define USE_INTERNAL_PULLUPS + /* this is the official gen3 reprap motherboard pinout */ diff --git a/config.gen6.h b/config.gen6.h index d0e4f28..a2c1a9b 100644 --- a/config.gen6.h +++ b/config.gen6.h @@ -161,6 +161,12 @@ undefine if you don't want to use them #include "arduino.h" +/* + internal pullup resistors + the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this. +*/ +//#define USE_INTERNAL_PULLUPS + /* this is the official GEN6 reprap motherboard pinout */ diff --git a/config.h.dist b/config.h.dist index 290b3a4..ed184af 100644 --- a/config.h.dist +++ b/config.h.dist @@ -152,6 +152,12 @@ undefine if you don't want to use them #include "arduino.h" +/* + internal pullup resistors + the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this. +*/ +//#define USE_INTERNAL_PULLUPS + /* user defined pins adjust to suit your electronics, diff --git a/config.ramps.h b/config.ramps.h index 884458a..cafff16 100644 --- a/config.ramps.h +++ b/config.ramps.h @@ -161,6 +161,12 @@ undefine if you don't want to use them #include "arduino.h" +/* + internal pullup resistors + the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this. +*/ +//#define USE_INTERNAL_PULLUPS + /* this is the ramps motherboard pinout */ diff --git a/mendel.c b/mendel.c index 61118fe..f51129a 100644 --- a/mendel.c +++ b/mendel.c @@ -39,10 +39,18 @@ void io_init(void) { WRITE(X_STEP_PIN, 0); SET_OUTPUT(X_STEP_PIN); WRITE(X_DIR_PIN, 0); SET_OUTPUT(X_DIR_PIN); #ifdef X_MIN_PIN - WRITE(X_MIN_PIN, 1); SET_INPUT(X_MIN_PIN); + #ifdef USE_INTERNAL_PULLUPS + WRITE(X_MIN_PIN, 1); SET_INPUT(X_MIN_PIN); + #else + WRITE(X_MIN_PIN, 0); SET_INPUT(X_MIN_PIN); + #endif #endif #ifdef X_MAX_PIN - WRITE(X_MAX_PIN, 1); SET_INPUT(X_MAX_PIN); + #ifdef USE_INTERNAL_PULLUPS + WRITE(X_MAX_PIN, 1); SET_INPUT(X_MAX_PIN); + #else + WRITE(X_MAX_PIN, 0); SET_INPUT(X_MAX_PIN); + #endif #endif #ifdef X_ENABLE_PIN WRITE(X_ENABLE_PIN, 1); SET_OUTPUT(X_ENABLE_PIN); @@ -51,10 +59,18 @@ void io_init(void) { WRITE(Y_STEP_PIN, 0); SET_OUTPUT(Y_STEP_PIN); WRITE(Y_DIR_PIN, 0); SET_OUTPUT(Y_DIR_PIN); #ifdef Y_MIN_PIN - WRITE(Y_MIN_PIN, 1); SET_INPUT(Y_MIN_PIN); + #ifdef USE_INTERNAL_PULLUPS + WRITE(Y_MIN_PIN, 1); SET_INPUT(Y_MIN_PIN); + #else + WRITE(Y_MIN_PIN, 0); SET_INPUT(Y_MIN_PIN); + #endif #endif #ifdef Y_MAX_PIN - WRITE(Y_MAX_PIN, 1); SET_INPUT(Y_MAX_PIN); + #ifdef USE_INTERNAL_PULLUPS + WRITE(Y_MAX_PIN, 1); SET_INPUT(Y_MAX_PIN); + #else + WRITE(Y_MAX_PIN, 0); SET_INPUT(Y_MAX_PIN); + #endif #endif #ifdef Y_ENABLE_PIN WRITE(Y_ENABLE_PIN, 1); SET_OUTPUT(Y_ENABLE_PIN); @@ -63,10 +79,18 @@ void io_init(void) { WRITE(Z_STEP_PIN, 0); SET_OUTPUT(Z_STEP_PIN); WRITE(Z_DIR_PIN, 0); SET_OUTPUT(Z_DIR_PIN); #ifdef Z_MIN_PIN - WRITE(Z_MIN_PIN, 1); SET_INPUT(Z_MIN_PIN); + #ifdef USE_INTERNAL_PULLUPS + WRITE(Z_MIN_PIN, 1); SET_INPUT(Z_MIN_PIN); + #else + WRITE(Z_MIN_PIN, 0); SET_INPUT(Z_MIN_PIN); + #endif #endif #ifdef Z_MAX_PIN - WRITE(Z_MAX_PIN, 1); SET_INPUT(Z_MAX_PIN); + #ifdef USE_INTERNAL_PULLUPS + WRITE(Z_MAX_PIN, 1); SET_INPUT(Z_MAX_PIN); + #else + WRITE(Z_MAX_PIN, 0); SET_INPUT(Z_MAX_PIN); + #endif #endif #ifdef Z_ENABLE_PIN WRITE(Z_ENABLE_PIN, 1); SET_OUTPUT(Z_ENABLE_PIN);