Activate the new servo.move() function
by replacing the sequences (attach, write, delay, detach), and their conditions with the new function in Marlin.main.cpp and removing the old configuration in the ABL part of Configuration.h
This commit is contained in:
committed by
Richard Wackerbarth
parent
40b6edcad7
commit
49609f6c14
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
#endif // ENABLE_AUTO_BED_LEVELING
|
||||
|
||||
#define SERVO_LEVELING (defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
||||
#define SERVO_LEVELING (defined(ENABLE_AUTO_BED_LEVELING) && defined(DEACTIVATE_SERVOS_AFTER_MOVE))
|
||||
|
||||
#ifdef MESH_BED_LEVELING
|
||||
#include "mesh_bed_leveling.h"
|
||||
@ -570,13 +570,9 @@ void servo_init() {
|
||||
#ifdef SERVO_ENDSTOPS
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (servo_endstops[i] >= 0)
|
||||
servo[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]);
|
||||
servo[servo_endstops[i]].move(0, servo_endstop_angles[i * 2 + 1]);
|
||||
#endif
|
||||
|
||||
#if SERVO_LEVELING
|
||||
delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
||||
servo[servo_endstops[Z_AXIS]].detach();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1315,14 +1311,7 @@ static void setup_for_endstop_move() {
|
||||
// Engage Z Servo endstop if enabled
|
||||
if (servo_endstops[Z_AXIS] >= 0) {
|
||||
Servo *srv = &servo[servo_endstops[Z_AXIS]];
|
||||
#if SERVO_LEVELING
|
||||
srv->attach(0);
|
||||
#endif
|
||||
srv->write(servo_endstop_angles[Z_AXIS * 2]);
|
||||
#if SERVO_LEVELING
|
||||
delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
||||
srv->detach();
|
||||
#endif
|
||||
srv->move(0, servo_endstop_angles[Z_AXIS * 2]);
|
||||
}
|
||||
|
||||
#elif defined(Z_PROBE_ALLEN_KEY)
|
||||
@ -1424,14 +1413,7 @@ static void setup_for_endstop_move() {
|
||||
|
||||
// Change the Z servo angle
|
||||
Servo *srv = &servo[servo_endstops[Z_AXIS]];
|
||||
#if SERVO_LEVELING
|
||||
srv->attach(0);
|
||||
#endif
|
||||
srv->write(servo_endstop_angles[Z_AXIS * 2 + 1]);
|
||||
#if SERVO_LEVELING
|
||||
delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
||||
srv->detach();
|
||||
#endif
|
||||
srv->move(0, servo_endstop_angles[Z_AXIS * 2 + 1]);
|
||||
}
|
||||
|
||||
#elif defined(Z_PROBE_ALLEN_KEY)
|
||||
@ -1683,7 +1665,7 @@ static void homeaxis(AxisEnum axis) {
|
||||
if (axis != Z_AXIS) {
|
||||
// Engage Servo endstop if enabled
|
||||
if (servo_endstops[axis] > -1)
|
||||
servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
|
||||
servo[servo_endstops[axis]].move(0, servo_endstop_angles[axis * 2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1786,7 +1768,7 @@ static void homeaxis(AxisEnum axis) {
|
||||
{
|
||||
// Retract Servo endstop if enabled
|
||||
if (servo_endstops[axis] > -1)
|
||||
servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]);
|
||||
servo[servo_endstops[axis]].move(0, servo_endstop_angles[axis * 2 + 1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4354,14 +4336,7 @@ inline void gcode_M226() {
|
||||
servo_position = code_value_short();
|
||||
if (servo_index >= 0 && servo_index < NUM_SERVOS) {
|
||||
Servo *srv = &servo[servo_index];
|
||||
#if SERVO_LEVELING
|
||||
srv->attach(0);
|
||||
#endif
|
||||
srv->write(servo_position);
|
||||
#if SERVO_LEVELING
|
||||
delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
||||
srv->detach();
|
||||
#endif
|
||||
srv->move(0, servo_position);
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START;
|
||||
|
Reference in New Issue
Block a user