28 #include "../inc/MarlinConfig.h"
29 #include "../HAL/shared/servo.h"
33 #if ENABLED(SWITCHING_EXTRUDER)
34 #ifndef SWITCHING_EXTRUDER_E23_SERVO_NR
35 #define SWITCHING_EXTRUDER_E23_SERVO_NR -1
42 #define SADATA SWITCHING_EXTRUDER_SERVO_ANGLES
43 #define ASRC(N,E) (SWITCHING_EXTRUDER_SERVO_NR == N ? asrc[E] : SWITCHING_EXTRUDER_E23_SERVO_NR == N ? asrc[E+2] : 0)
44 #elif ENABLED(SWITCHING_NOZZLE)
45 #define SADATA SWITCHING_NOZZLE_SERVO_ANGLES
46 #define ASRC(N,E) (SWITCHING_NOZZLE_SERVO_NR == N ? asrc[E] : 0)
47 #elif defined(Z_PROBE_SERVO_NR)
48 #define ASRC(N,E) (Z_PROBE_SERVO_NR == N ? asrc[E] : 0)
50 #include "../feature/bltouch.h"
53 #define SADATA BLTOUCH_ANGLES
54 #elif defined(Z_SERVO_ANGLES)
55 #define SADATA Z_SERVO_ANGLES
57 #error "Servo angles are needed!"
61 #if ENABLED(EDITABLE_SERVO_ANGLES)
62 extern uint16_t servo_angles[NUM_SERVOS][2];
63 #define BASE_SERVO_ANGLES base_servo_angles
65 #define BASE_SERVO_ANGLES servo_angles
68 constexpr uint16_t
asrc[] = SADATA;
70 static_assert(
COUNT(
asrc) == REQ_ANGLES,
"SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES)
" angles.");
74 { ASRC(0,0), ASRC(0,1) }
76 , { ASRC(1,0), ASRC(1,1) }
78 , { ASRC(2,0), ASRC(2,1) }
80 , { ASRC(3,0), ASRC(3,1) }
87 #define DEPLOY_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][0])
88 #define STOW_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][1])
91 #endif // HAS_SERVO_ANGLES
93 #define MOVE_SERVO(I, P) servo[I].move(P)