Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚸 Fix extra Z raises #27395

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void GcodeSuite::G28() {
bool with_probe = ENABLED(HOMING_Z_WITH_PROBE);
// Raise above the current Z (which should be synced in the planner)
// The "height" for Z is a coordinate. But if Z is not trusted/homed make it relative.
if (seenR || !TERN(HOME_AFTER_DEACTIVATE, axis_is_trusted, axis_was_homed)(Z_AXIS)) {
if (seenR || !(z_min_trusted || axis_should_home(Z_AXIS))) {
z_homing_height += current_position.z;
with_probe = false;
}
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/inc/Conditionals-3-etc.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,9 @@
#if DISABLED(DELTA)
#undef DELTA_HOME_TO_SAFE_ZONE
#endif
#if ANY(DELTA, AXEL_TPARA)
#define Z_CAN_FALL_DOWN
#endif

/**
* This setting is also used by M109 when trying to calculate
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
// Relative Mode. Enable with G91, disable with G90.
bool relative_mode; // = false

#if HAS_Z_AXIS
// If Z has been powered on trust that the real Z is >= current_position.z
bool z_min_trusted; // = false
#endif

/**
* Cartesian Current Position
* Used to track the native machine position as moves are queued.
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/module/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ void restore_feedrate_and_scaling();
typedef bits_t(NUM_AXES) main_axes_bits_t;
constexpr main_axes_bits_t main_axes_mask = _BV(NUM_AXES) - 1;

#if HAS_Z_AXIS
extern bool z_min_trusted; // If Z has been powered on trust that the real Z is >= current_position.z
#endif

void set_axis_is_at_home(const AxisEnum axis);

#if HAS_ENDSTOPS
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ bool Stepper::disable_axis(const AxisEnum axis) {
// and keep a count of how many times each ENA pin has been set.

// If all the axes that share the enabled bit are disabled
// toggle the ENA state that they all share.
const bool can_disable = can_axis_disable(axis);
if (can_disable) {
#define _CASE_DISABLE(N) case N##_AXIS: DISABLE_AXIS_##N(); break;
Expand Down
10 changes: 10 additions & 0 deletions Marlin/src/module/stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "../inc/MarlinConfig.h"

#include "planner.h"
#include "motion.h"
#include "stepper/indirection.h"
#include "stepper/cycles.h"
#ifdef __AVR__
Expand Down Expand Up @@ -633,9 +634,18 @@ class Stepper {
}
static void mark_axis_enabled(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
SBI(axis_enabled.bits, INDEX_OF_AXIS(axis, eindex));
TERN_(HAS_Z_AXIS, if (axis == Z_AXIS) z_min_trusted = true);
// TODO: DELTA should have "Z" state affect all (ABC) motors and treat "XY" on/off as meaningless
}
static void mark_axis_disabled(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
CBI(axis_enabled.bits, INDEX_OF_AXIS(axis, eindex));
#if HAS_Z_AXIS
if (TERN0(Z_CAN_FALL_DOWN, axis == Z_AXIS)) {
z_min_trusted = false;
current_position.z = 0;
}
#endif
// TODO: DELTA should have "Z" state affect all (ABC) motors and treat "XY" on/off as meaningless
}
static bool can_axis_disable(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
return !any_enable_overlap() || !(axis_enabled.bits & enable_overlap[INDEX_OF_AXIS(axis, eindex)]);
Expand Down
Loading