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
2.0.x
AnHardt 10 years ago committed by Richard Wackerbarth
parent 40b6edcad7
commit 49609f6c14

@ -504,13 +504,6 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
//If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
//The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
// You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
// #define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!!!

@ -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;

Loading…
Cancel
Save