Combine Z_AFTER_DEACTIVATE with UNKNOWN_Z_NO_RAISE (#20444)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
swissnorp 2021-02-25 17:09:00 +01:00 committed by GitHub
parent 7fc75fc482
commit bcda46e3f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 29 additions and 27 deletions

View File

@ -569,7 +569,6 @@
* the issues involved, don't use chamber PID until someone else verifies that your hardware works.
*/
//#define PIDTEMPCHAMBER
//#define CHAMBER_LIMIT_SWITCHING
/**
@ -1196,7 +1195,13 @@
//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed. Also enable HOME_AFTER_DEACTIVATE for extra safety.
//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated. Also enable NO_MOTION_BEFORE_HOMING for extra safety.
//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off.
/**
* Set Z_IDLE_HEIGHT if the Z-Axis moves on its own when steppers are disabled.
* - Use a low value (i.e., Z_MIN_POS) if the nozzle falls down to the bed.
* - Use a large value (i.e., Z_MAX_POS) if the bed falls down, away from the nozzle.
*/
//#define Z_IDLE_HEIGHT Z_HOME_POS
//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...
// Be sure to have this much clearance over your Z_MAX_POS to prevent grinding.

View File

@ -869,9 +869,6 @@
#define DISABLE_INACTIVE_Z true // Set 'false' if the nozzle could fall onto your printed part!
#define DISABLE_INACTIVE_E true
// If the Nozzle or Bed falls when the Z stepper is disabled, set its resting position here.
//#define Z_AFTER_DEACTIVATE Z_HOME_POS
// Default Minimum Feedrates for printing and travel moves
#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s) Minimum feedrate. Set with M205 S.
#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s) Minimum travel feedrate. Set with M205 T.

View File

@ -326,14 +326,12 @@ void GcodeSuite::G28() {
#endif
const float z_homing_height = TERN1(UNKNOWN_Z_NO_RAISE, axis_is_trusted(Z_AXIS))
? (parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT)
: 0;
const float z_homing_height = parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT;
if (z_homing_height && (doX || doY || TERN0(Z_SAFE_HOMING, doZ))) {
// Raise Z before homing any other axes and z is not already high enough (never lower z)
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) by ", z_homing_height);
do_z_clearance(z_homing_height, axis_is_trusted(Z_AXIS), DISABLED(UNKNOWN_Z_NO_RAISE));
do_z_clearance(z_homing_height);
}
#if ENABLED(QUICK_HOME)

View File

@ -539,6 +539,10 @@
#endif
#elif defined(ASSISTED_TRAMMING_MENU_ITEM)
#error "ASSISTED_TRAMMING_MENU_ITEM is deprecated and should be removed."
#elif defined(UNKNOWN_Z_NO_RAISE)
#error "UNKNOWN_Z_NO_RAISE is replaced by setting Z_IDLE_HEIGHT to Z_MAX_POS."
#elif defined(Z_AFTER_DEACTIVATE)
#error "Z_AFTER_DEACTIVATE is replaced by Z_IDLE_HEIGHT."
#endif
/**

View File

@ -83,7 +83,13 @@ bool relative_mode; // = false;
* Used by 'line_to_current_position' to do a move after changing it.
* Used by 'sync_plan_position' to update 'planner.position'.
*/
xyze_pos_t current_position = { X_HOME_POS, Y_HOME_POS, Z_HOME_POS };
xyze_pos_t current_position = { X_HOME_POS, Y_HOME_POS,
#ifdef Z_IDLE_HEIGHT
Z_IDLE_HEIGHT
#else
Z_HOME_POS
#endif
};
/**
* Cartesian Destination
@ -494,9 +500,8 @@ void do_blocking_move_to_xy_z(const xy_pos_t &raw, const float &z, const feedRat
do_blocking_move_to(raw.x, raw.y, z, fr_mm_s);
}
void do_z_clearance(const float &zclear, const bool z_trusted/*=true*/, const bool raise_on_untrusted/*=true*/, const bool lower_allowed/*=false*/) {
const bool rel = raise_on_untrusted && !z_trusted;
float zdest = zclear + (rel ? current_position.z : 0.0f);
void do_z_clearance(const float &zclear, const bool lower_allowed/*=false*/) {
float zdest = zclear;
if (!lower_allowed) NOLESS(zdest, current_position.z);
do_blocking_move_to_z(_MIN(zdest, Z_MAX_POS), TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS)));
}

View File

@ -278,7 +278,7 @@ void remember_feedrate_and_scaling();
void remember_feedrate_scaling_off();
void restore_feedrate_and_scaling();
void do_z_clearance(const float &zclear, const bool z_trusted=true, const bool raise_on_untrusted=true, const bool lower_allowed=false);
void do_z_clearance(const float &zclear, const bool lower_allowed=false);
/**
* Homing and Trusted Axes

View File

@ -401,14 +401,7 @@ bool Probe::set_deployed(const bool deploy) {
constexpr bool z_raise_wanted = true;
#endif
// For beds that fall when Z is powered off only raise for trusted Z
#if ENABLED(UNKNOWN_Z_NO_RAISE)
const bool z_is_trusted = axis_is_trusted(Z_AXIS);
#else
constexpr float z_is_trusted = true;
#endif
if (z_is_trusted && z_raise_wanted)
if (z_raise_wanted)
do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)

View File

@ -100,7 +100,7 @@ public:
static void move_z_after_probing() {
#ifdef Z_AFTER_PROBING
do_z_clearance(Z_AFTER_PROBING, true, true, true); // Move down still permitted
do_z_clearance(Z_AFTER_PROBING, true); // Move down still permitted
#endif
}
static float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true, const bool sanity_check=true);
@ -120,7 +120,7 @@ public:
static void move_z_after_homing() {
#ifdef Z_AFTER_HOMING
do_z_clearance(Z_AFTER_HOMING, true, true, true);
do_z_clearance(Z_AFTER_HOMING, true);
#elif BOTH(Z_AFTER_PROBING, HAS_BED_PROBE)
move_z_after_probing();
#endif

View File

@ -862,8 +862,8 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define ENABLE_AXIS_Z() if (SHOULD_ENABLE(z)) { ENABLE_STEPPER_Z(); ENABLE_STEPPER_Z2(); ENABLE_STEPPER_Z3(); ENABLE_STEPPER_Z4(); AFTER_CHANGE(z, true); }
#define DISABLE_AXIS_Z() if (SHOULD_DISABLE(z)) { DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); AFTER_CHANGE(z, false); set_axis_untrusted(Z_AXIS); Z_RESET(); }
#ifdef Z_AFTER_DEACTIVATE
#define Z_RESET() do{ current_position.z = Z_AFTER_DEACTIVATE; sync_plan_position(); }while(0)
#ifdef Z_IDLE_HEIGHT
#define Z_RESET() do{ current_position.z = Z_IDLE_HEIGHT; sync_plan_position(); }while(0)
#else
#define Z_RESET()
#endif

View File

@ -17,7 +17,7 @@ opt_set X_DRIVER_TYPE TMC2209
opt_set Y_DRIVER_TYPE TMC2209
opt_set Z_DRIVER_TYPE TMC2209
opt_set E0_DRIVER_TYPE TMC2209
opt_enable PINS_DEBUGGING
opt_enable PINS_DEBUGGING Z_IDLE_HEIGHT
exec_test $1 $2 "BigTreeTech SKR Mini E3 1.0 - Basic Config with TMC2209 HW Serial" "$3"