Explorar el Código

Allow libServo::attach to work on Teensy 3.5/3.6

Scott Lahteine hace 6 años
padre
commit
cbcb284f4a

+ 1
- 0
Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h Ver fichero

@@ -24,6 +24,7 @@
24 24
 #ifndef HAL_SERVO_STM32F1_H
25 25
 #define HAL_SERVO_STM32F1_H
26 26
 
27
+// Path needed, otherwise HAL version is used
27 28
 #include <../../libraries/Servo/src/Servo.h>
28 29
 
29 30
 // Inherit and expand on the official library

+ 6
- 2
Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.cpp Ver fichero

@@ -6,13 +6,17 @@
6 6
 
7 7
 #include "HAL_Servo_Teensy.h"
8 8
 
9
+uint8_t servoPin[MAX_SERVOS] = { 0 };
10
+
9 11
 int8_t libServo::attach(const int pin) {
10 12
   if (this->servoIndex >= MAX_SERVOS) return -1;
11
-  return Servo::attach(pin);
13
+  if (pin > 0) servoPin[this->servoIndex] = pin;
14
+  return Servo::attach(servoPin[this->servoIndex]);
12 15
 }
13 16
 
14 17
 int8_t libServo::attach(const int pin, const int min, const int max) {
15
-  return Servo::attach(pin, min, max);
18
+  if (pin > 0) servoPin[this->servoIndex] = pin;
19
+  return Servo::attach(servoPin[this->servoIndex], min, max);
16 20
 }
17 21
 
18 22
 void libServo::move(const int value) {

+ 0
- 1
Marlin/src/HAL/servo.cpp Ver fichero

@@ -51,7 +51,6 @@
51 51
  *
52 52
  */
53 53
 
54
-
55 54
 #include "../inc/MarlinConfig.h"
56 55
 
57 56
 #if HAS_SERVOS && !(IS_32BIT_TEENSY || defined(TARGET_LPC1768) || defined(STM32F4))

Loading…
Cancelar
Guardar