Skip to content

Commit

Permalink
HAS_Z_ENDSTOP_SERVO => HAS_Z_SERVO_ENDSTOP
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 17, 2016
1 parent 47ce810 commit 1bed392
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions Marlin/Conditionals.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#endif

#define HAS_Z_ENDSTOP_SERVO (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
#define SERVO_LEVELING (ENABLED(AUTO_BED_LEVELING_FEATURE) && HAS_Z_ENDSTOP_SERVO)
#define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
#define SERVO_LEVELING (ENABLED(AUTO_BED_LEVELING_FEATURE) && HAS_Z_SERVO_ENDSTOP)

/**
* Sled Options
Expand Down Expand Up @@ -769,7 +769,7 @@
#endif
#endif

#define PROBE_SELECTED (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(MECHANICAL_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_SLED))
#define PROBE_SELECTED (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(MECHANICAL_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED))

#define PROBE_PIN_CONFIGURED (HAS_Z_MIN_PROBE_PIN || (HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)))

Expand Down
40 changes: 20 additions & 20 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ static uint8_t target_extruder;
};
#endif

#if HAS_Z_ENDSTOP_SERVO
#if HAS_Z_SERVO_ENDSTOP
const int z_servo_angle[2] = Z_SERVO_ANGLES;
#endif

Expand Down Expand Up @@ -746,7 +746,7 @@ void servo_init() {
servo[3].detach();
#endif

#if HAS_Z_ENDSTOP_SERVO
#if HAS_Z_SERVO_ENDSTOP

endstops.enable_z_probe(false);

Expand All @@ -760,7 +760,7 @@ void servo_init() {
*
*/
STOW_Z_SERVO();
#endif // HAS_Z_ENDSTOP_SERVO
#endif // HAS_Z_SERVO_ENDSTOP

}

Expand Down Expand Up @@ -1829,7 +1829,7 @@ static void setup_for_endstop_move() {

if (endstops.z_probe_enabled) return;

#if HAS_Z_ENDSTOP_SERVO
#if HAS_Z_SERVO_ENDSTOP

// Engage Z Servo endstop if enabled
DEPLOY_Z_SERVO();
Expand Down Expand Up @@ -1916,7 +1916,7 @@ static void setup_for_endstop_move() {
}

static void stow_z_probe(bool doRaise = true) {
#if !(HAS_Z_ENDSTOP_SERVO && (Z_RAISE_AFTER_PROBING > 0))
#if !(HAS_Z_SERVO_ENDSTOP && (Z_RAISE_AFTER_PROBING > 0))
UNUSED(doRaise);
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
Expand All @@ -1925,7 +1925,7 @@ static void setup_for_endstop_move() {

if (!endstops.z_probe_enabled) return;

#if HAS_Z_ENDSTOP_SERVO
#if HAS_Z_SERVO_ENDSTOP

// Retract Z Servo endstop if enabled
#if Z_RAISE_AFTER_PROBING > 0
Expand Down Expand Up @@ -2156,7 +2156,7 @@ static void setup_for_endstop_move() {

#endif // DELTA

#if HAS_Z_ENDSTOP_SERVO && DISABLED(Z_PROBE_SLED)
#if HAS_Z_SERVO_ENDSTOP

/**
* Raise Z to a minimum height to make room for a servo to move
Expand Down Expand Up @@ -2283,15 +2283,15 @@ static void homeaxis(AxisEnum axis) {
#define _Z_STOW (stow_z_probe())
#define _Z_SERVO_TEST (axis != Z_AXIS) // already deployed Z
#define _Z_SERVO_SUBTEST false // Z will never be invoked
#elif HAS_Z_ENDSTOP_SERVO
#elif HAS_Z_SERVO_ENDSTOP
#define _Z_DEPLOY do{ raise_z_for_servo(Z_RAISE_BEFORE_PROBING); DEPLOY_Z_SERVO(); endstops.z_probe_enabled = true; }while(0)
#define _Z_STOW do{ raise_z_for_servo(Z_RAISE_AFTER_PROBING); STOW_Z_SERVO(); endstops.z_probe_enabled = false; }while(0)
#define _Z_SERVO_TEST true // Z not deployed yet
#define _Z_SERVO_SUBTEST (axis == Z_AXIS) // Z is a probe
#endif

// Homing Z towards the bed? Deploy the Z probe or endstop.
#if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE) || HAS_Z_ENDSTOP_SERVO
#if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE) || HAS_Z_SERVO_ENDSTOP
if (axis == Z_AXIS && axis_home_dir < 0) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> SERVO_LEVELING > " STRINGIFY(_Z_DEPLOY));
Expand Down Expand Up @@ -2414,7 +2414,7 @@ static void homeaxis(AxisEnum axis) {
axis_homed[axis] = true;

// Put away the Z probe
#if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE) || HAS_Z_ENDSTOP_SERVO
#if ENABLED(Z_PROBE_SLED) || SERVO_LEVELING || ENABLED(FIX_MOUNTED_PROBE) || HAS_Z_SERVO_ENDSTOP
if (axis == Z_AXIS && axis_home_dir < 0) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> SERVO_LEVELING > " STRINGIFY(_Z_STOW));
Expand Down Expand Up @@ -3764,7 +3764,7 @@ inline void gcode_G28() {
#endif

current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z)
#if HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
#if HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
+ Z_RAISE_AFTER_PROBING
#endif
;
Expand All @@ -3779,7 +3779,7 @@ inline void gcode_G28() {
// Sled assembly for Cartesian bots
#if ENABLED(Z_PROBE_SLED)
dock_sled(true); // dock the sled
#elif !HAS_Z_ENDSTOP_SERVO && DISABLED(Z_PROBE_ALLEN_KEY) && DISABLED(Z_PROBE_SLED)
#elif !HAS_Z_SERVO_ENDSTOP && DISABLED(Z_PROBE_ALLEN_KEY) && DISABLED(Z_PROBE_SLED)
// Raise Z axis for non-delta and non servo based probes
raise_z_after_probing();
#endif
Expand Down Expand Up @@ -3823,7 +3823,7 @@ inline void gcode_G28() {
* G30: Do a single Z probe at the current XY
*/
inline void gcode_G30() {
#if HAS_Z_ENDSTOP_SERVO
#if HAS_Z_SERVO_ENDSTOP
raise_z_for_servo(Z_RAISE_BEFORE_PROBING);
#endif
deploy_z_probe(); // Engage Z Servo endstop if available. Z_PROBE_SLED is missed here.
Expand All @@ -3845,7 +3845,7 @@ inline void gcode_G28() {

clean_up_after_endstop_move(); // Too early. must be done after the stowing.

#if HAS_Z_ENDSTOP_SERVO
#if HAS_Z_SERVO_ENDSTOP
raise_z_for_servo(Z_RAISE_AFTER_PROBING);
#endif
stow_z_probe(false); // Retract Z Servo endstop if available. Z_PROBE_SLED is missed here.
Expand Down Expand Up @@ -5980,13 +5980,13 @@ inline void gcode_M303() {
*/
inline void gcode_M400() { stepper.synchronize(); }

#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && (HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_ALLEN_KEY))
#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && (HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_ALLEN_KEY))

/**
* M401: Engage Z Servo endstop if available
*/
inline void gcode_M401() {
#if HAS_Z_ENDSTOP_SERVO
#if HAS_Z_SERVO_ENDSTOP
raise_z_for_servo(Z_RAISE_BEFORE_PROBING);
#endif
deploy_z_probe();
Expand All @@ -5996,13 +5996,13 @@ inline void gcode_M400() { stepper.synchronize(); }
* M402: Retract Z Servo endstop if enabled
*/
inline void gcode_M402() {
#if HAS_Z_ENDSTOP_SERVO
#if HAS_Z_SERVO_ENDSTOP
raise_z_for_servo(Z_RAISE_AFTER_PROBING);
#endif
stow_z_probe(false);
}

#endif // AUTO_BED_LEVELING_FEATURE && (HAS_Z_ENDSTOP_SERVO || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
#endif // AUTO_BED_LEVELING_FEATURE && (HAS_Z_SERVO_ENDSTOP || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED

#if ENABLED(FILAMENT_WIDTH_SENSOR)

Expand Down Expand Up @@ -7299,14 +7299,14 @@ void process_next_command() {
gcode_M400();
break;

#if ENABLED(AUTO_BED_LEVELING_FEATURE) && (HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_ALLEN_KEY)) && DISABLED(Z_PROBE_SLED)
#if ENABLED(AUTO_BED_LEVELING_FEATURE) && (HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_ALLEN_KEY)) && DISABLED(Z_PROBE_SLED)
case 401:
gcode_M401();
break;
case 402:
gcode_M402();
break;
#endif // AUTO_BED_LEVELING_FEATURE && (HAS_Z_ENDSTOP_SERVO || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
#endif // AUTO_BED_LEVELING_FEATURE && (HAS_Z_SERVO_ENDSTOP || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED

#if ENABLED(FILAMENT_WIDTH_SENSOR)
case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
Expand Down
12 changes: 6 additions & 6 deletions Marlin/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@
#if defined(NUM_SERVOS) && NUM_SERVOS > 0
#if NUM_SERVOS > 4
#error "The maximum number of SERVOS in Marlin is 4."
#elif HAS_Z_ENDSTOP_SERVO && Z_ENDSTOP_SERVO_NR >= NUM_SERVOS
#elif HAS_Z_SERVO_ENDSTOP && Z_ENDSTOP_SERVO_NR >= NUM_SERVOS
#error "Z_ENDSTOP_SERVO_NR must be smaller than NUM_SERVOS."
#endif
#endif

/**
* Servo deactivation depends on servo endstops
*/
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && !HAS_Z_ENDSTOP_SERVO
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && !HAS_Z_SERVO_ENDSTOP
#error "Z_ENDSTOP_SERVO_NR is required for DEACTIVATE_SERVOS_AFTER_MOVE."
#endif

Expand Down Expand Up @@ -246,10 +246,10 @@
/**
* Only allow one probe option to be defined
*/
#if (ENABLED(FIX_MOUNTED_PROBE) && (ENABLED(MECHANICAL_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_SLED))) \
|| (ENABLED(MECHANICAL_PROBE) && (ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_SLED))) \
|| (ENABLED(Z_PROBE_ALLEN_KEY) && (HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_SLED))) \
|| (HAS_Z_ENDSTOP_SERVO && ENABLED(Z_PROBE_SLED))
#if (ENABLED(FIX_MOUNTED_PROBE) && (ENABLED(MECHANICAL_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED))) \
|| (ENABLED(MECHANICAL_PROBE) && (ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED))) \
|| (ENABLED(Z_PROBE_ALLEN_KEY) && (HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED))) \
|| (HAS_Z_SERVO_ENDSTOP && ENABLED(Z_PROBE_SLED))
#error "Please define only one type of probe: Z Servo, MECHANICAL_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or FIX_MOUNTED_PROBE."
#endif

Expand Down

0 comments on commit 1bed392

Please sign in to comment.