Move servo code to modules/servo.*

This commit is contained in:
Scott Lahteine
2017-11-19 13:39:46 -06:00
parent 81bc428b48
commit c0000a0cdc
8 changed files with 110 additions and 41 deletions

View File

@ -75,7 +75,7 @@
#endif
#if HAS_SERVOS
#include "HAL/servo.h"
#include "module/servo.h"
#endif
#if HAS_DIGIPOTSS
@ -247,35 +247,6 @@ void setup_powerhold() {
#endif
}
#if HAS_SERVOS
HAL_SERVO_LIB servo[NUM_SERVOS];
void servo_init() {
#if NUM_SERVOS >= 1 && HAS_SERVO_0
servo[0].attach(SERVO0_PIN);
servo[0].detach(); // Just set up the pin. We don't have a position yet. Don't move to a random position.
#endif
#if NUM_SERVOS >= 2 && HAS_SERVO_1
servo[1].attach(SERVO1_PIN);
servo[1].detach();
#endif
#if NUM_SERVOS >= 3 && HAS_SERVO_2
servo[2].attach(SERVO2_PIN);
servo[2].detach();
#endif
#if NUM_SERVOS >= 4 && HAS_SERVO_3
servo[3].attach(SERVO3_PIN);
servo[3].detach();
#endif
#if HAS_Z_SERVO_ENDSTOP
servo_probe_init();
#endif
}
#endif // HAS_SERVOS
/**
* Stepper Reset (RigidBoard, et.al.)
*/
@ -745,6 +716,10 @@ void setup() {
servo_init();
#endif
#if HAS_Z_SERVO_ENDSTOP
servo_probe_init();
#endif
#if HAS_PHOTOGRAPH
OUT_WRITE(PHOTOGRAPH_PIN, LOW);
#endif