|
@@ -372,7 +372,7 @@ static uint8_t target_extruder;
|
372
|
372
|
};
|
373
|
373
|
#endif
|
374
|
374
|
|
375
|
|
-#if HAS_SERVO_ENDSTOPS
|
|
375
|
+#if ENABLED(HAS_SERVO_ENDSTOPS)
|
376
|
376
|
const int servo_endstop_id[] = SERVO_ENDSTOP_IDS;
|
377
|
377
|
const int servo_endstop_angle[][2] = SERVO_ENDSTOP_ANGLES;
|
378
|
378
|
#endif
|
|
@@ -719,7 +719,7 @@ void servo_init() {
|
719
|
719
|
servo[3].detach();
|
720
|
720
|
#endif
|
721
|
721
|
|
722
|
|
- #if HAS_SERVO_ENDSTOPS
|
|
722
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
723
|
723
|
|
724
|
724
|
endstops.enable_z_probe(false);
|
725
|
725
|
|
|
@@ -1719,7 +1719,7 @@ static void setup_for_endstop_move() {
|
1719
|
1719
|
|
1720
|
1720
|
if (endstops.z_probe_enabled) return;
|
1721
|
1721
|
|
1722
|
|
- #if HAS_SERVO_ENDSTOPS
|
|
1722
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
1723
|
1723
|
|
1724
|
1724
|
// Engage Z Servo endstop if enabled
|
1725
|
1725
|
if (servo_endstop_id[Z_AXIS] >= 0) servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angle[Z_AXIS][0]);
|
|
@@ -1806,7 +1806,7 @@ static void setup_for_endstop_move() {
|
1806
|
1806
|
}
|
1807
|
1807
|
|
1808
|
1808
|
static void stow_z_probe(bool doRaise = true) {
|
1809
|
|
- #if !(HAS_SERVO_ENDSTOPS && (Z_RAISE_AFTER_PROBING > 0))
|
|
1809
|
+ #if !(ENABLED(HAS_SERVO_ENDSTOPS) && (Z_RAISE_AFTER_PROBING > 0))
|
1810
|
1810
|
UNUSED(doRaise);
|
1811
|
1811
|
#endif
|
1812
|
1812
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -1815,7 +1815,7 @@ static void setup_for_endstop_move() {
|
1815
|
1815
|
|
1816
|
1816
|
if (!endstops.z_probe_enabled) return;
|
1817
|
1817
|
|
1818
|
|
- #if HAS_SERVO_ENDSTOPS
|
|
1818
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
1819
|
1819
|
|
1820
|
1820
|
// Retract Z Servo endstop if enabled
|
1821
|
1821
|
if (servo_endstop_id[Z_AXIS] >= 0) {
|
|
@@ -2057,7 +2057,7 @@ static void setup_for_endstop_move() {
|
2057
|
2057
|
|
2058
|
2058
|
#endif // DELTA
|
2059
|
2059
|
|
2060
|
|
- #if HAS_SERVO_ENDSTOPS && DISABLED(Z_PROBE_SLED)
|
|
2060
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS) && DISABLED(Z_PROBE_SLED)
|
2061
|
2061
|
|
2062
|
2062
|
void raise_z_for_servo() {
|
2063
|
2063
|
float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_PROBING;
|
|
@@ -2168,33 +2168,36 @@ static void homeaxis(AxisEnum axis) {
|
2168
|
2168
|
sync_plan_position();
|
2169
|
2169
|
|
2170
|
2170
|
#if ENABLED(Z_PROBE_SLED)
|
2171
|
|
- #define _Z_SERVO_TEST (axis != Z_AXIS) // deploy Z, servo.move XY
|
2172
|
|
- #define _Z_PROBE_SUBTEST false // Z will never be invoked
|
|
2171
|
+ #define _Z_SERVO_TEST (axis != Z_AXIS) // already deployed Z
|
|
2172
|
+ #define _Z_SERVO_SUBTEST false // Z will never be invoked
|
2173
|
2173
|
#define _Z_DEPLOY (dock_sled(false))
|
2174
|
2174
|
#define _Z_STOW (dock_sled(true))
|
2175
|
2175
|
#elif SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
|
2176
|
|
- #define _Z_SERVO_TEST (axis != Z_AXIS) // servo.move XY
|
2177
|
|
- #define _Z_PROBE_SUBTEST false // Z will never be invoked
|
|
2176
|
+ #define _Z_SERVO_TEST (axis != Z_AXIS) // already deployed Z
|
|
2177
|
+ #define _Z_SERVO_SUBTEST false // Z will never be invoked
|
2178
|
2178
|
#define _Z_DEPLOY (deploy_z_probe())
|
2179
|
2179
|
#define _Z_STOW (stow_z_probe())
|
2180
|
|
- #elif HAS_SERVO_ENDSTOPS
|
2181
|
|
- #define _Z_SERVO_TEST true // servo.move X, Y, Z
|
2182
|
|
- #define _Z_PROBE_SUBTEST (axis == Z_AXIS) // Z is a probe
|
|
2180
|
+ #elif ENABLED(HAS_SERVO_ENDSTOPS)
|
|
2181
|
+ #define _Z_SERVO_TEST true // Z not deployed yet
|
|
2182
|
+ #define _Z_SERVO_SUBTEST (axis == Z_AXIS) // Z is a probe
|
2183
|
2183
|
#endif
|
2184
|
2184
|
|
2185
|
|
- if (axis == Z_AXIS) {
|
2186
|
|
- // If there's a Z probe that needs deployment...
|
2187
|
|
- #if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
|
2188
|
|
- // ...and homing Z towards the bed? Deploy it.
|
2189
|
|
- if (axis_home_dir < 0) _Z_DEPLOY;
|
2190
|
|
- #endif
|
2191
|
|
- }
|
|
2185
|
+ // If there's a Z probe that needs deployment...
|
|
2186
|
+ #if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
|
|
2187
|
+ // ...and homing Z towards the bed? Deploy it.
|
|
2188
|
+ if (axis == Z_AXIS && axis_home_dir < 0) {
|
|
2189
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2190
|
+ if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> SERVO_LEVELING > " STRINGIFY(_Z_DEPLOY));
|
|
2191
|
+ #endif
|
|
2192
|
+ _Z_DEPLOY;
|
|
2193
|
+ }
|
|
2194
|
+ #endif
|
2192
|
2195
|
|
2193
|
|
- #if HAS_SERVO_ENDSTOPS
|
2194
|
|
- // Engage an X or Y Servo endstop if enabled
|
|
2196
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
|
2197
|
+ // Engage an X, Y (or Z) Servo endstop if enabled
|
2195
|
2198
|
if (_Z_SERVO_TEST && servo_endstop_id[axis] >= 0) {
|
2196
|
2199
|
servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][0]);
|
2197
|
|
- if (_Z_PROBE_SUBTEST) endstops.z_probe_enabled = true;
|
|
2200
|
+ if (_Z_SERVO_SUBTEST) endstops.z_probe_enabled = true;
|
2198
|
2201
|
}
|
2199
|
2202
|
#endif
|
2200
|
2203
|
|
|
@@ -2311,7 +2314,7 @@ static void homeaxis(AxisEnum axis) {
|
2311
|
2314
|
axis_known_position[axis] = true;
|
2312
|
2315
|
axis_homed[axis] = true;
|
2313
|
2316
|
|
2314
|
|
- // Put away the Z probe
|
|
2317
|
+ // Put away the Z probe with a function
|
2315
|
2318
|
#if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE)
|
2316
|
2319
|
if (axis == Z_AXIS && axis_home_dir < 0) {
|
2317
|
2320
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
@@ -2321,27 +2324,32 @@ static void homeaxis(AxisEnum axis) {
|
2321
|
2324
|
}
|
2322
|
2325
|
#endif
|
2323
|
2326
|
|
2324
|
|
- // Retract Servo endstop if enabled
|
2325
|
|
- #if HAS_SERVO_ENDSTOPS
|
|
2327
|
+ // Retract X, Y (or Z) Servo endstop if enabled
|
|
2328
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
2326
|
2329
|
if (_Z_SERVO_TEST && servo_endstop_id[axis] >= 0) {
|
|
2330
|
+ // Raise the servo probe before stow outside ABL context.
|
|
2331
|
+ // This is a workaround to allow use of a Servo Probe without
|
|
2332
|
+ // ABL until more global probe handling is implemented.
|
|
2333
|
+ #if Z_RAISE_AFTER_PROBING > 0
|
|
2334
|
+ if (axis == Z_AXIS) {
|
|
2335
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2336
|
+ if (DEBUGGING(LEVELING)) SERIAL_ECHOPAIR("Raise Z (after) by ", Z_RAISE_AFTER_PROBING);
|
|
2337
|
+ #endif
|
|
2338
|
+ current_position[Z_AXIS] = Z_RAISE_AFTER_PROBING;
|
|
2339
|
+ feedrate = homing_feedrate[Z_AXIS];
|
|
2340
|
+ line_to_current_position();
|
|
2341
|
+ stepper.synchronize();
|
|
2342
|
+ }
|
|
2343
|
+ #endif
|
|
2344
|
+
|
2327
|
2345
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
2328
|
2346
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> SERVO_ENDSTOPS > Stow with servo.move()");
|
2329
|
2347
|
#endif
|
2330
|
|
- // Raise the servo probe before stow outside ABL context... This is a workaround that allows the use of a Servo Probe without ABL until a more global probe handling is implemented.
|
2331
|
|
- #if DISABLED(AUTO_BED_LEVELING_FEATURE)
|
2332
|
|
- #ifndef Z_RAISE_AFTER_PROBING
|
2333
|
|
- #define Z_RAISE_AFTER_PROBING 15 // default height
|
2334
|
|
- #endif
|
2335
|
|
- current_position[Z_AXIS] = Z_RAISE_AFTER_PROBING;
|
2336
|
|
- feedrate = homing_feedrate[Z_AXIS];
|
2337
|
|
- line_to_current_position();
|
2338
|
|
- stepper.synchronize();
|
2339
|
|
- #endif
|
2340
|
|
-
|
2341
|
2348
|
servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][1]);
|
2342
|
|
- if (_Z_PROBE_SUBTEST) endstops.enable_z_probe(false);
|
|
2349
|
+ if (_Z_SERVO_SUBTEST) endstops.enable_z_probe(false);
|
2343
|
2350
|
}
|
2344
|
|
- #endif
|
|
2351
|
+
|
|
2352
|
+ #endif // HAS_SERVO_ENDSTOPS
|
2345
|
2353
|
|
2346
|
2354
|
}
|
2347
|
2355
|
|
|
@@ -3630,7 +3638,7 @@ inline void gcode_G28() {
|
3630
|
3638
|
#endif
|
3631
|
3639
|
|
3632
|
3640
|
current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z)
|
3633
|
|
- #if HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
|
|
3641
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS) || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
|
3634
|
3642
|
+ Z_RAISE_AFTER_PROBING
|
3635
|
3643
|
#endif
|
3636
|
3644
|
;
|
|
@@ -3647,7 +3655,7 @@ inline void gcode_G28() {
|
3647
|
3655
|
dock_sled(true); // dock the sled
|
3648
|
3656
|
#elif Z_RAISE_AFTER_PROBING > 0
|
3649
|
3657
|
// Raise Z axis for non-delta and non servo based probes
|
3650
|
|
- #if !defined(HAS_SERVO_ENDSTOPS) && DISABLED(Z_PROBE_ALLEN_KEY) && DISABLED(Z_PROBE_SLED)
|
|
3658
|
+ #if DISABLED(HAS_SERVO_ENDSTOPS) && DISABLED(Z_PROBE_ALLEN_KEY) && DISABLED(Z_PROBE_SLED)
|
3651
|
3659
|
raise_z_after_probing();
|
3652
|
3660
|
#endif
|
3653
|
3661
|
#endif
|
|
@@ -3691,7 +3699,7 @@ inline void gcode_G28() {
|
3691
|
3699
|
* G30: Do a single Z probe at the current XY
|
3692
|
3700
|
*/
|
3693
|
3701
|
inline void gcode_G30() {
|
3694
|
|
- #if HAS_SERVO_ENDSTOPS
|
|
3702
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
3695
|
3703
|
raise_z_for_servo();
|
3696
|
3704
|
#endif
|
3697
|
3705
|
deploy_z_probe(); // Engage Z Servo endstop if available. Z_PROBE_SLED is missed here.
|
|
@@ -3713,7 +3721,7 @@ inline void gcode_G28() {
|
3713
|
3721
|
|
3714
|
3722
|
clean_up_after_endstop_move(); // Too early. must be done after the stowing.
|
3715
|
3723
|
|
3716
|
|
- #if HAS_SERVO_ENDSTOPS
|
|
3724
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
3717
|
3725
|
raise_z_for_servo();
|
3718
|
3726
|
#endif
|
3719
|
3727
|
stow_z_probe(false); // Retract Z Servo endstop if available. Z_PROBE_SLED is missed here.
|
|
@@ -5822,13 +5830,13 @@ inline void gcode_M303() {
|
5822
|
5830
|
*/
|
5823
|
5831
|
inline void gcode_M400() { stepper.synchronize(); }
|
5824
|
5832
|
|
5825
|
|
-#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY))
|
|
5833
|
+#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && (ENABLED(HAS_SERVO_ENDSTOPS) || ENABLED(Z_PROBE_ALLEN_KEY))
|
5826
|
5834
|
|
5827
|
5835
|
/**
|
5828
|
5836
|
* M401: Engage Z Servo endstop if available
|
5829
|
5837
|
*/
|
5830
|
5838
|
inline void gcode_M401() {
|
5831
|
|
- #if HAS_SERVO_ENDSTOPS
|
|
5839
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
5832
|
5840
|
raise_z_for_servo();
|
5833
|
5841
|
#endif
|
5834
|
5842
|
deploy_z_probe();
|
|
@@ -5838,13 +5846,13 @@ inline void gcode_M400() { stepper.synchronize(); }
|
5838
|
5846
|
* M402: Retract Z Servo endstop if enabled
|
5839
|
5847
|
*/
|
5840
|
5848
|
inline void gcode_M402() {
|
5841
|
|
- #if HAS_SERVO_ENDSTOPS
|
|
5849
|
+ #if ENABLED(HAS_SERVO_ENDSTOPS)
|
5842
|
5850
|
raise_z_for_servo();
|
5843
|
5851
|
#endif
|
5844
|
5852
|
stow_z_probe(false);
|
5845
|
5853
|
}
|
5846
|
5854
|
|
5847
|
|
-#endif // AUTO_BED_LEVELING_FEATURE && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
|
|
5855
|
+#endif // AUTO_BED_LEVELING_FEATURE && (ENABLED(HAS_SERVO_ENDSTOPS) || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
|
5848
|
5856
|
|
5849
|
5857
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
5850
|
5858
|
|
|
@@ -7038,14 +7046,14 @@ void process_next_command() {
|
7038
|
7046
|
gcode_M400();
|
7039
|
7047
|
break;
|
7040
|
7048
|
|
7041
|
|
- #if ENABLED(AUTO_BED_LEVELING_FEATURE) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY)) && DISABLED(Z_PROBE_SLED)
|
|
7049
|
+ #if ENABLED(AUTO_BED_LEVELING_FEATURE) && (ENABLED(HAS_SERVO_ENDSTOPS) || ENABLED(Z_PROBE_ALLEN_KEY)) && DISABLED(Z_PROBE_SLED)
|
7042
|
7050
|
case 401:
|
7043
|
7051
|
gcode_M401();
|
7044
|
7052
|
break;
|
7045
|
7053
|
case 402:
|
7046
|
7054
|
gcode_M402();
|
7047
|
7055
|
break;
|
7048
|
|
- #endif // AUTO_BED_LEVELING_FEATURE && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
|
|
7056
|
+ #endif // AUTO_BED_LEVELING_FEATURE && (ENABLED(HAS_SERVO_ENDSTOPS) || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
|
7049
|
7057
|
|
7050
|
7058
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
7051
|
7059
|
case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
|