|
@@ -36,7 +36,7 @@
|
36
|
36
|
#endif
|
37
|
37
|
#endif // ENABLE_AUTO_BED_LEVELING
|
38
|
38
|
|
39
|
|
-#define SERVO_LEVELING (defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
|
39
|
+#define SERVO_LEVELING (defined(ENABLE_AUTO_BED_LEVELING) && defined(DEACTIVATE_SERVOS_AFTER_MOVE))
|
40
|
40
|
|
41
|
41
|
#ifdef MESH_BED_LEVELING
|
42
|
42
|
#include "mesh_bed_leveling.h"
|
|
@@ -570,13 +570,9 @@ void servo_init() {
|
570
|
570
|
#ifdef SERVO_ENDSTOPS
|
571
|
571
|
for (int i = 0; i < 3; i++)
|
572
|
572
|
if (servo_endstops[i] >= 0)
|
573
|
|
- servo[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]);
|
|
573
|
+ servo[servo_endstops[i]].move(0, servo_endstop_angles[i * 2 + 1]);
|
574
|
574
|
#endif
|
575
|
575
|
|
576
|
|
- #if SERVO_LEVELING
|
577
|
|
- delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
578
|
|
- servo[servo_endstops[Z_AXIS]].detach();
|
579
|
|
- #endif
|
580
|
576
|
}
|
581
|
577
|
|
582
|
578
|
/**
|
|
@@ -1315,14 +1311,7 @@ static void setup_for_endstop_move() {
|
1315
|
1311
|
// Engage Z Servo endstop if enabled
|
1316
|
1312
|
if (servo_endstops[Z_AXIS] >= 0) {
|
1317
|
1313
|
Servo *srv = &servo[servo_endstops[Z_AXIS]];
|
1318
|
|
- #if SERVO_LEVELING
|
1319
|
|
- srv->attach(0);
|
1320
|
|
- #endif
|
1321
|
|
- srv->write(servo_endstop_angles[Z_AXIS * 2]);
|
1322
|
|
- #if SERVO_LEVELING
|
1323
|
|
- delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
1324
|
|
- srv->detach();
|
1325
|
|
- #endif
|
|
1314
|
+ srv->move(0, servo_endstop_angles[Z_AXIS * 2]);
|
1326
|
1315
|
}
|
1327
|
1316
|
|
1328
|
1317
|
#elif defined(Z_PROBE_ALLEN_KEY)
|
|
@@ -1424,14 +1413,7 @@ static void setup_for_endstop_move() {
|
1424
|
1413
|
|
1425
|
1414
|
// Change the Z servo angle
|
1426
|
1415
|
Servo *srv = &servo[servo_endstops[Z_AXIS]];
|
1427
|
|
- #if SERVO_LEVELING
|
1428
|
|
- srv->attach(0);
|
1429
|
|
- #endif
|
1430
|
|
- srv->write(servo_endstop_angles[Z_AXIS * 2 + 1]);
|
1431
|
|
- #if SERVO_LEVELING
|
1432
|
|
- delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
1433
|
|
- srv->detach();
|
1434
|
|
- #endif
|
|
1416
|
+ srv->move(0, servo_endstop_angles[Z_AXIS * 2 + 1]);
|
1435
|
1417
|
}
|
1436
|
1418
|
|
1437
|
1419
|
#elif defined(Z_PROBE_ALLEN_KEY)
|
|
@@ -1683,7 +1665,7 @@ static void homeaxis(AxisEnum axis) {
|
1683
|
1665
|
if (axis != Z_AXIS) {
|
1684
|
1666
|
// Engage Servo endstop if enabled
|
1685
|
1667
|
if (servo_endstops[axis] > -1)
|
1686
|
|
- servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
|
|
1668
|
+ servo[servo_endstops[axis]].move(0, servo_endstop_angles[axis * 2]);
|
1687
|
1669
|
}
|
1688
|
1670
|
#endif
|
1689
|
1671
|
|
|
@@ -1786,7 +1768,7 @@ static void homeaxis(AxisEnum axis) {
|
1786
|
1768
|
{
|
1787
|
1769
|
// Retract Servo endstop if enabled
|
1788
|
1770
|
if (servo_endstops[axis] > -1)
|
1789
|
|
- servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]);
|
|
1771
|
+ servo[servo_endstops[axis]].move(0, servo_endstop_angles[axis * 2 + 1]);
|
1790
|
1772
|
}
|
1791
|
1773
|
#endif
|
1792
|
1774
|
|
|
@@ -4354,14 +4336,7 @@ inline void gcode_M226() {
|
4354
|
4336
|
servo_position = code_value_short();
|
4355
|
4337
|
if (servo_index >= 0 && servo_index < NUM_SERVOS) {
|
4356
|
4338
|
Servo *srv = &servo[servo_index];
|
4357
|
|
- #if SERVO_LEVELING
|
4358
|
|
- srv->attach(0);
|
4359
|
|
- #endif
|
4360
|
|
- srv->write(servo_position);
|
4361
|
|
- #if SERVO_LEVELING
|
4362
|
|
- delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
4363
|
|
- srv->detach();
|
4364
|
|
- #endif
|
|
4339
|
+ srv->move(0, servo_position);
|
4365
|
4340
|
}
|
4366
|
4341
|
else {
|
4367
|
4342
|
SERIAL_ECHO_START;
|