1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 13:25:54 +00:00

🚸 Fix extra Z raises (#27395)

This commit is contained in:
Scott Lahteine 2024-09-05 12:07:17 -05:00 committed by GitHub
parent 17a5a1f97d
commit 2c6f8a30f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,6 +44,7 @@
#include "../inc/MarlinConfig.h"
#include "planner.h"
#include "motion.h"
#include "stepper/indirection.h"
#include "stepper/cycles.h"
#ifdef __AVR__
@ -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)]);