Bladeren bron

servo update

Christopher Pepper 6 jaren geleden
bovenliggende
commit
254b68fe2c

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp Bestand weergeven

@@ -315,4 +315,4 @@ __attribute__((naked)) void RSTC_Handler(void) {
315 315
   );
316 316
 }
317 317
 }
318
-#endif // ARDUINO_ARCH_SAM
318
+#endif // TARGET_LPC1768

+ 2
- 0
Marlin/src/HAL/HAL_LPC1768/HAL.h Bestand weergeven

@@ -151,6 +151,8 @@ using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
151 151
 
152 152
 // Parse a G-code word into a pin index
153 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 157
 #define HAL_IDLETASK 1
156 158
 void HAL_idletask(void);

Marlin/src/HAL/HAL_LPC1768/servo_private.h → Marlin/src/HAL/HAL_LPC1768/MarlinServo.h Bestand weergeven

@@ -50,25 +50,24 @@
50 50
 #ifndef SERVO_PRIVATE_H
51 51
 #define SERVO_PRIVATE_H
52 52
 
53
-#include <LPC1768_Servo.h>
53
+#include <Servo.h>
54 54
 
55 55
 class MarlinServo: public Servo  {
56
+  public:
56 57
   void move(const int value) {
57 58
     constexpr uint16_t servo_delay[] = SERVO_DELAY;
58 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 64
       #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
65 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 66
       #endif
69 67
     }
68
+
70 69
   }
71
-}
70
+};
72 71
 
73 72
 #define HAL_SERVO_LIB MarlinServo
74 73
 

+ 0
- 2
Marlin/src/HAL/HAL_LPC1768/main.cpp Bestand weergeven

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

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/spi_pins.h Bestand weergeven

@@ -50,7 +50,7 @@
50 50
 #ifndef SS_PIN
51 51
   #define SS_PIN            P1_23
52 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 54
   #undef SDSS
55 55
   #define SDSS              SS_PIN
56 56
 #endif

+ 1
- 1
Marlin/src/HAL/shared/servo.h Bestand weergeven

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

+ 1
- 2
Marlin/src/module/servo.h Bestand weergeven

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

Laden…
Annuleren
Opslaan