diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h index c035ba755e755cae3bff2470611e93353f6aa6c4..c27f7bd076591910a89e18bd682302de79f7f21c 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h @@ -24,6 +24,7 @@ #ifndef HAL_SERVO_STM32F1_H #define HAL_SERVO_STM32F1_H +// Path needed, otherwise HAL version is used #include <../../libraries/Servo/src/Servo.h> // Inherit and expand on the official library diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.cpp index 6a5e40127cb57f8faccabd480d94e6fed0d3a054..ff56036ccd7a632ebd3dd1e49290e79c026e173b 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.cpp @@ -6,13 +6,17 @@ #include "HAL_Servo_Teensy.h" +uint8_t servoPin[MAX_SERVOS] = { 0 }; + int8_t libServo::attach(const int pin) { if (this->servoIndex >= MAX_SERVOS) return -1; - return Servo::attach(pin); + if (pin > 0) servoPin[this->servoIndex] = pin; + return Servo::attach(servoPin[this->servoIndex]); } int8_t libServo::attach(const int pin, const int min, const int max) { - return Servo::attach(pin, min, max); + if (pin > 0) servoPin[this->servoIndex] = pin; + return Servo::attach(servoPin[this->servoIndex], min, max); } void libServo::move(const int value) { diff --git a/Marlin/src/HAL/servo.cpp b/Marlin/src/HAL/servo.cpp index 1c3c003d8293050124e018c9af365f3cabd0ae69..6bafb26dc4d318ae1ff9a7382893defc46249474 100644 --- a/Marlin/src/HAL/servo.cpp +++ b/Marlin/src/HAL/servo.cpp @@ -51,7 +51,6 @@ * */ - #include "../inc/MarlinConfig.h" #if HAS_SERVOS && !(IS_32BIT_TEENSY || defined(TARGET_LPC1768) || defined(STM32F4))