소스 검색

servo update

Christopher Pepper 6 년 전
부모
커밋
254b68fe2c

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp 파일 보기

315
   );
315
   );
316
 }
316
 }
317
 }
317
 }
318
-#endif // ARDUINO_ARCH_SAM
318
+#endif // TARGET_LPC1768

+ 2
- 0
Marlin/src/HAL/HAL_LPC1768/HAL.h 파일 보기

151
 
151
 
152
 // Parse a G-code word into a pin index
152
 // Parse a G-code word into a pin index
153
 int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
153
 int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
154
+// P0.6 thru P0.9 are for the onboard SD card
155
+#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09
154
 
156
 
155
 #define HAL_IDLETASK 1
157
 #define HAL_IDLETASK 1
156
 void HAL_idletask(void);
158
 void HAL_idletask(void);

Marlin/src/HAL/HAL_LPC1768/servo_private.h → Marlin/src/HAL/HAL_LPC1768/MarlinServo.h 파일 보기

50
 #ifndef SERVO_PRIVATE_H
50
 #ifndef SERVO_PRIVATE_H
51
 #define SERVO_PRIVATE_H
51
 #define SERVO_PRIVATE_H
52
 
52
 
53
-#include <LPC1768_Servo.h>
53
+#include <Servo.h>
54
 
54
 
55
 class MarlinServo: public Servo  {
55
 class MarlinServo: public Servo  {
56
+  public:
56
   void move(const int value) {
57
   void move(const int value) {
57
     constexpr uint16_t servo_delay[] = SERVO_DELAY;
58
     constexpr uint16_t servo_delay[] = SERVO_DELAY;
58
     static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
59
     static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
59
-    if (this->attach(0) >= 0) {    // notice the pin number is zero here
60
-      this->write(value);
61
-
62
-      safe_delay(servo_delay[this->servoIndex]);
63
 
60
 
61
+    if (this->attach(servo_info[this->servoIndex].Pin.nbr) >= 0) {    // try to reattach
62
+      this->write(value);
63
+      safe_delay(servo_delay[this->servoIndex]); // delay to allow servo to reach position
64
       #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
64
       #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
65
         this->detach();
65
         this->detach();
66
-        LPC1768_PWM_detach_pin(servo_info[this->servoIndex].Pin.nbr);  // shut down the PWM signal
67
-        LPC1768_PWM_attach_pin(servo_info[this->servoIndex].Pin.nbr, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH, this->servoIndex);  // make sure no one else steals the slot
68
       #endif
66
       #endif
69
     }
67
     }
68
+
70
   }
69
   }
71
-}
70
+};
72
 
71
 
73
 #define HAL_SERVO_LIB MarlinServo
72
 #define HAL_SERVO_LIB MarlinServo
74
 
73
 

+ 0
- 2
Marlin/src/HAL/HAL_LPC1768/main.cpp 파일 보기

1
 #ifdef TARGET_LPC1768
1
 #ifdef TARGET_LPC1768
2
 
2
 
3
-#include <LPC1768_PWM.h>
4
 #include <usb/usb.h>
3
 #include <usb/usb.h>
5
 #include <usb/usbcfg.h>
4
 #include <usb/usbcfg.h>
6
 #include <usb/usbhw.h>
5
 #include <usb/usbhw.h>
84
   #endif
83
   #endif
85
 
84
 
86
   HAL_timer_init();
85
   HAL_timer_init();
87
-  LPC1768_PWM_init();
88
 }
86
 }
89
 
87
 
90
 // HAL idle task
88
 // HAL idle task

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/spi_pins.h 파일 보기

50
 #ifndef SS_PIN
50
 #ifndef SS_PIN
51
   #define SS_PIN            P1_23
51
   #define SS_PIN            P1_23
52
 #endif
52
 #endif
53
-#if !defined(SDSS) || SDSS == P_NC // get defaulted in pins.h
53
+#if !defined(SDSS) || SDSS == P_NC // gets defaulted in pins.h
54
   #undef SDSS
54
   #undef SDSS
55
   #define SDSS              SS_PIN
55
   #define SDSS              SS_PIN
56
 #endif
56
 #endif

+ 1
- 1
Marlin/src/HAL/shared/servo.h 파일 보기

73
 #elif IS_TEENSY35 || IS_TEENSY36
73
 #elif IS_TEENSY35 || IS_TEENSY36
74
   #include "../HAL_TEENSY35_36/HAL_Servo_Teensy.h"
74
   #include "../HAL_TEENSY35_36/HAL_Servo_Teensy.h"
75
 #elif defined(TARGET_LPC1768)
75
 #elif defined(TARGET_LPC1768)
76
-  #include "../HAL_LPC1768/servo_private.h"
76
+  #include "../HAL_LPC1768/MarlinServo.h"
77
 #elif defined(__STM32F1__) || defined(TARGET_STM32F1)
77
 #elif defined(__STM32F1__) || defined(TARGET_STM32F1)
78
   #include "../HAL_STM32F1/HAL_Servo_STM32F1.h"
78
   #include "../HAL_STM32F1/HAL_Servo_STM32F1.h"
79
 #elif defined(STM32GENERIC) && defined(STM32F4)
79
 #elif defined(STM32GENERIC) && defined(STM32F4)

+ 1
- 2
Marlin/src/module/servo.h 파일 보기

27
 #ifndef _SERVO_H_
27
 #ifndef _SERVO_H_
28
 #define _SERVO_H_
28
 #define _SERVO_H_
29
 
29
 
30
+#include "../inc/MarlinConfig.h"
30
 #include "../HAL/shared/servo.h"
31
 #include "../HAL/shared/servo.h"
31
 
32
 
32
 extern HAL_SERVO_LIB servo[NUM_SERVOS];
33
 extern HAL_SERVO_LIB servo[NUM_SERVOS];
35
 
36
 
36
 #define MOVE_SERVO(I, P) servo[I].move(P)
37
 #define MOVE_SERVO(I, P) servo[I].move(P)
37
 
38
 
38
-#include "../inc/MarlinConfig.h"
39
-
40
 #if HAS_Z_SERVO_PROBE
39
 #if HAS_Z_SERVO_PROBE
41
   #define DEPLOY_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][0])
40
   #define DEPLOY_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][0])
42
   #define STOW_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][1])
41
   #define STOW_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][1])

Loading…
취소
저장