diff --git a/Marlin/servo.cpp b/Marlin/servo.cpp index 21f5e04872..a7e9b867f7 100644 --- a/Marlin/servo.cpp +++ b/Marlin/servo.cpp @@ -244,9 +244,8 @@ uint8_t Servo::attach(int pin) { uint8_t Servo::attach(int pin, int min, int max) { if (this->servoIndex < MAX_SERVOS ) { - #if defined(ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0) - if (pin > 0) this->pin = pin; else pin = this->pin; - #endif + if(pin == 0) + pin = servos[this->servoIndex].Pin.nbr; pinMode(pin, OUTPUT); // set servo pin to output servos[this->servoIndex].Pin.nbr = pin; // todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128 diff --git a/Marlin/servo.h b/Marlin/servo.h index 9a78643774..b370003933 100644 --- a/Marlin/servo.h +++ b/Marlin/servo.h @@ -128,9 +128,7 @@ class Servo { int read(); // returns current pulse width as an angle between 0 and 180 degrees int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release) bool attached(); // return true if this servo is attached, otherwise false - #if defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0 - int pin; // store the hardware pin of the servo - #endif + private: uint8_t servoIndex; // index into the channel data for this servo int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH