|
@@ -31,46 +31,65 @@
|
31
|
31
|
#if HAS_SERVO_ANGLES
|
32
|
32
|
|
33
|
33
|
#if ENABLED(SWITCHING_EXTRUDER)
|
34
|
|
- #ifndef SWITCHING_EXTRUDER_E23_SERVO_NR
|
35
|
|
- #define SWITCHING_EXTRUDER_E23_SERVO_NR -1
|
36
|
|
- #endif
|
|
34
|
+ // Switching extruder can have 2 or 4 angles
|
37
|
35
|
#if EXTRUDERS > 3
|
38
|
36
|
#define REQ_ANGLES 4
|
39
|
37
|
#else
|
40
|
38
|
#define REQ_ANGLES 2
|
41
|
39
|
#endif
|
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)
|
|
40
|
+ constexpr uint16_t sase[] = SWITCHING_EXTRUDER_SERVO_ANGLES;
|
|
41
|
+ static_assert(COUNT(sase) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles.");
|
|
42
|
+ #else
|
|
43
|
+ constexpr uint16_t sase[4] = { 0 };
|
|
44
|
+ #endif
|
|
45
|
+
|
|
46
|
+ #if ENABLED(SWITCHING_NOZZLE)
|
|
47
|
+ constexpr uint16_t sasn[] = SWITCHING_NOZZLE_SERVO_ANGLES;
|
|
48
|
+ static_assert(COUNT(sasn) == 2, "SWITCHING_NOZZLE_SERVO_ANGLES needs 2 angles.");
|
|
49
|
+ #else
|
|
50
|
+ constexpr uint16_t sasn[2] = { 0 };
|
|
51
|
+ #endif
|
|
52
|
+
|
|
53
|
+ #ifdef Z_PROBE_SERVO_NR
|
49
|
54
|
#if ENABLED(BLTOUCH)
|
50
|
55
|
#include "../feature/bltouch.h"
|
|
56
|
+ #undef Z_SERVO_ANGLES
|
|
57
|
+ #define Z_SERVO_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW }
|
51
|
58
|
#endif
|
52
|
|
- #ifdef BLTOUCH_ANGLES
|
53
|
|
- #define SADATA BLTOUCH_ANGLES
|
54
|
|
- #elif defined(Z_SERVO_ANGLES)
|
55
|
|
- #define SADATA Z_SERVO_ANGLES
|
56
|
|
- #else
|
57
|
|
- #error "Servo angles are needed!"
|
58
|
|
- #endif
|
|
59
|
+ constexpr uint16_t sazp[] = Z_SERVO_ANGLES;
|
|
60
|
+ static_assert(COUNT(sazp) == 2, "Z_SERVO_ANGLES needs 2 angles.");
|
|
61
|
+ #else
|
|
62
|
+ constexpr uint16_t sazp[2] = { 0 };
|
59
|
63
|
#endif
|
60
|
64
|
|
|
65
|
+ #ifndef SWITCHING_EXTRUDER_SERVO_NR
|
|
66
|
+ #define SWITCHING_EXTRUDER_SERVO_NR -1
|
|
67
|
+ #endif
|
|
68
|
+ #ifndef SWITCHING_EXTRUDER_E23_SERVO_NR
|
|
69
|
+ #define SWITCHING_EXTRUDER_E23_SERVO_NR -1
|
|
70
|
+ #endif
|
|
71
|
+ #ifndef SWITCHING_NOZZLE_SERVO_NR
|
|
72
|
+ #define SWITCHING_NOZZLE_SERVO_NR -1
|
|
73
|
+ #endif
|
|
74
|
+ #ifndef Z_PROBE_SERVO_NR
|
|
75
|
+ #define Z_PROBE_SERVO_NR -1
|
|
76
|
+ #endif
|
|
77
|
+
|
|
78
|
+ #define ASRC(N,I) ( \
|
|
79
|
+ N == SWITCHING_EXTRUDER_SERVO_NR ? sase[I] \
|
|
80
|
+ : N == SWITCHING_EXTRUDER_E23_SERVO_NR ? sase[I+2] \
|
|
81
|
+ : N == SWITCHING_NOZZLE_SERVO_NR ? sasn[I] \
|
|
82
|
+ : N == Z_PROBE_SERVO_NR ? sazp[I] \
|
|
83
|
+ : 0 )
|
|
84
|
+
|
61
|
85
|
#if ENABLED(EDITABLE_SERVO_ANGLES)
|
62
|
86
|
extern uint16_t servo_angles[NUM_SERVOS][2];
|
63
|
|
- #define BASE_SERVO_ANGLES base_servo_angles
|
|
87
|
+ #define CONST_SERVO_ANGLES base_servo_angles
|
64
|
88
|
#else
|
65
|
|
- #define BASE_SERVO_ANGLES servo_angles
|
66
|
|
- #endif
|
67
|
|
-
|
68
|
|
- constexpr uint16_t asrc[] = SADATA;
|
69
|
|
- #if REQ_ANGLES
|
70
|
|
- static_assert(COUNT(asrc) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles.");
|
|
89
|
+ #define CONST_SERVO_ANGLES servo_angles
|
71
|
90
|
#endif
|
72
|
91
|
|
73
|
|
- constexpr uint16_t BASE_SERVO_ANGLES [NUM_SERVOS][2] = {
|
|
92
|
+ constexpr uint16_t CONST_SERVO_ANGLES [NUM_SERVOS][2] = {
|
74
|
93
|
{ ASRC(0,0), ASRC(0,1) }
|
75
|
94
|
#if NUM_SERVOS > 1
|
76
|
95
|
, { ASRC(1,0), ASRC(1,1) }
|