Homing feedrates as XYZ array (#20426)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
rafaljot 2020-12-17 13:02:05 +01:00 committed by GitHub
parent 20b3af1cc2
commit fbcc07261d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 31 deletions

View File

@ -1001,7 +1001,7 @@
#define XY_PROBE_SPEED (133*60) #define XY_PROBE_SPEED (133*60)
// Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2) // Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2)
#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z #define Z_PROBE_SPEED_FAST (4*60)
// Feedrate (mm/min) for the "accurate" probe of each point // Feedrate (mm/min) for the "accurate" probe of each point
#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) #define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
@ -1458,8 +1458,7 @@
#endif #endif
// Homing speeds (mm/min) // Homing speeds (mm/min)
#define HOMING_FEEDRATE_XY (50*60) #define HOMING_FEEDRATE_MM_M { (50*60), (50*60), (4*60) }
#define HOMING_FEEDRATE_Z (4*60)
// Validate that endstops are triggered on homing moves // Validate that endstops are triggered on homing moves
#define VALIDATE_HOMING_ENDSTOPS #define VALIDATE_HOMING_ENDSTOPS

View File

@ -2317,11 +2317,7 @@
#define Z_PROBE_OFFSET_RANGE_MAX 20 #define Z_PROBE_OFFSET_RANGE_MAX 20
#endif #endif
#ifndef XY_PROBE_SPEED #ifndef XY_PROBE_SPEED
#ifdef HOMING_FEEDRATE_XY #define XY_PROBE_SPEED ((homing_feedrate_mm_m.x + homing_feedrate_mm_m.y) / 2)
#define XY_PROBE_SPEED HOMING_FEEDRATE_XY
#else
#define XY_PROBE_SPEED 4000
#endif
#endif #endif
#ifndef NOZZLE_TO_PROBE_OFFSET #ifndef NOZZLE_TO_PROBE_OFFSET
#define NOZZLE_TO_PROBE_OFFSET { 0, 0, 0 } #define NOZZLE_TO_PROBE_OFFSET { 0, 0, 0 }

View File

@ -189,7 +189,9 @@
#elif defined(ENDSTOPS_ONLY_FOR_HOMING) #elif defined(ENDSTOPS_ONLY_FOR_HOMING)
#error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead." #error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead."
#elif defined(HOMING_FEEDRATE) #elif defined(HOMING_FEEDRATE)
#error "HOMING_FEEDRATE is deprecated. Set individual rates with HOMING_FEEDRATE_(XY|Z|E) instead." #error "HOMING_FEEDRATE is now set using the HOMING_FEEDRATE_MM_M array instead."
#elif defined(HOMING_FEEDRATE_XY) || defined(HOMING_FEEDRATE_Z)
#error "HOMING_FEEDRATE_XY and HOMING_FEEDRATE_Z are now set using the HOMING_FEEDRATE_MM_M array instead."
#elif defined(MANUAL_HOME_POSITIONS) #elif defined(MANUAL_HOME_POSITIONS)
#error "MANUAL_HOME_POSITIONS is deprecated. Set MANUAL_[XYZ]_HOME_POS as-needed instead." #error "MANUAL_HOME_POSITIONS is deprecated. Set MANUAL_[XYZ]_HOME_POS as-needed instead."
#elif defined(PID_ADD_EXTRUSION_RATE) #elif defined(PID_ADD_EXTRUSION_RATE)

View File

@ -143,16 +143,6 @@ xyze_pos_t destination; // {0}
feedRate_t feedrate_mm_s = MMM_TO_MMS(1500); feedRate_t feedrate_mm_s = MMM_TO_MMS(1500);
int16_t feedrate_percentage = 100; int16_t feedrate_percentage = 100;
// Homing feedrate is const progmem - compare to constexpr in the header
const feedRate_t homing_feedrate_mm_s[XYZ] PROGMEM = {
#if ENABLED(DELTA)
MMM_TO_MMS(HOMING_FEEDRATE_Z), MMM_TO_MMS(HOMING_FEEDRATE_Z),
#else
MMM_TO_MMS(HOMING_FEEDRATE_XY), MMM_TO_MMS(HOMING_FEEDRATE_XY),
#endif
MMM_TO_MMS(HOMING_FEEDRATE_Z)
};
// Cartesian conversion result goes here: // Cartesian conversion result goes here:
xyz_pos_t cartes; xyz_pos_t cartes;
@ -195,7 +185,7 @@ xyz_pos_t cartes;
#endif #endif
#if HAS_ABL_NOT_UBL #if HAS_ABL_NOT_UBL
float xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED); feedRate_t xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
#endif #endif
/** /**
@ -510,7 +500,7 @@ void do_z_clearance(const float &zclear, const bool z_trusted/*=true*/, const bo
const bool rel = raise_on_untrusted && !z_trusted; const bool rel = raise_on_untrusted && !z_trusted;
float zdest = zclear + (rel ? current_position.z : 0.0f); float zdest = zclear + (rel ? current_position.z : 0.0f);
if (!lower_allowed) NOLESS(zdest, current_position.z); if (!lower_allowed) NOLESS(zdest, current_position.z);
do_blocking_move_to_z(_MIN(zdest, Z_MAX_POS), TERN(HAS_BED_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST), homing_feedrate(Z_AXIS))); do_blocking_move_to_z(_MIN(zdest, Z_MAX_POS), TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS)));
} }
// //
@ -1841,7 +1831,7 @@ void homeaxis(const AxisEnum axis) {
current_position[axis] -= ABS(endstop_backoff[axis]) * axis_home_dir; current_position[axis] -= ABS(endstop_backoff[axis]) * axis_home_dir;
line_to_current_position( line_to_current_position(
#if HOMING_Z_WITH_PROBE #if HOMING_Z_WITH_PROBE
(axis == Z_AXIS) ? MMM_TO_MMS(Z_PROBE_SPEED_FAST) : (axis == Z_AXIS) ? z_probe_fast_mm_s :
#endif #endif
homing_feedrate(axis) homing_feedrate(axis)
); );

View File

@ -57,7 +57,7 @@ extern xyz_pos_t cartes;
#endif #endif
#if HAS_ABL_NOT_UBL #if HAS_ABL_NOT_UBL
extern float xy_probe_feedrate_mm_s; extern feedRate_t xy_probe_feedrate_mm_s;
#define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s #define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s
#elif defined(XY_PROBE_SPEED) #elif defined(XY_PROBE_SPEED)
#define XY_PROBE_FEEDRATE_MM_S MMM_TO_MMS(XY_PROBE_SPEED) #define XY_PROBE_FEEDRATE_MM_S MMM_TO_MMS(XY_PROBE_SPEED)
@ -65,12 +65,28 @@ extern xyz_pos_t cartes;
#define XY_PROBE_FEEDRATE_MM_S PLANNER_XY_FEEDRATE() #define XY_PROBE_FEEDRATE_MM_S PLANNER_XY_FEEDRATE()
#endif #endif
constexpr feedRate_t z_probe_fast_mm_s = MMM_TO_MMS(Z_PROBE_SPEED_FAST);
/** /**
* Feed rates are often configured with mm/m * Feed rates are often configured with mm/m
* but the planner and stepper like mm/s units. * but the planner and stepper like mm/s units.
*/ */
extern const feedRate_t homing_feedrate_mm_s[XYZ]; constexpr xyz_feedrate_t homing_feedrate_mm_m = HOMING_FEEDRATE_MM_M;
FORCE_INLINE feedRate_t homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); } FORCE_INLINE feedRate_t homing_feedrate(const AxisEnum a) {
float v;
#if ENABLED(DELTA)
v = homing_feedrate_mm_m.z;
#else
switch (a) {
case X_AXIS: v = homing_feedrate_mm_m.x; break;
case Y_AXIS: v = homing_feedrate_mm_m.y; break;
case Z_AXIS:
default: v = homing_feedrate_mm_m.z;
}
#endif
return MMM_TO_MMS(v);
}
feedRate_t get_homing_bump_feedrate(const AxisEnum axis); feedRate_t get_homing_bump_feedrate(const AxisEnum axis);
/** /**

View File

@ -516,7 +516,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#if TOTAL_PROBING == 2 #if TOTAL_PROBING == 2
// Do a first probe at the fast speed // Do a first probe at the fast speed
if (try_to_probe(PSTR("FAST"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST), if (try_to_probe(PSTR("FAST"), z_probe_low_point, z_probe_fast_mm_s,
sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN; sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN;
const float first_probe_z = current_position.z; const float first_probe_z = current_position.z;
@ -524,7 +524,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("1st Probe Z:", first_probe_z); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("1st Probe Z:", first_probe_z);
// Raise to give the probe clearance // Raise to give the probe clearance
do_blocking_move_to_z(current_position.z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); do_blocking_move_to_z(current_position.z + Z_CLEARANCE_MULTI_PROBE, z_probe_fast_mm_s);
#elif Z_PROBE_SPEED_FAST != Z_PROBE_SPEED_SLOW #elif Z_PROBE_SPEED_FAST != Z_PROBE_SPEED_SLOW
@ -533,8 +533,8 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0); const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0);
if (current_position.z > z) { if (current_position.z > z) {
// Probe down fast. If the probe never triggered, raise for probe clearance // Probe down fast. If the probe never triggered, raise for probe clearance
if (!probe_down_to_z(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) if (!probe_down_to_z(z, z_probe_fast_mm_s))
do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, z_probe_fast_mm_s);
} }
#endif #endif
@ -582,7 +582,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#if EXTRA_PROBING > 0 #if EXTRA_PROBING > 0
< TOTAL_PROBING - 1 < TOTAL_PROBING - 1
#endif #endif
) do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); ) do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, z_probe_fast_mm_s);
#endif #endif
} }
@ -672,7 +672,7 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
if (!isnan(measured_z)) { if (!isnan(measured_z)) {
const bool big_raise = raise_after == PROBE_PT_BIG_RAISE; const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
if (big_raise || raise_after == PROBE_PT_RAISE) if (big_raise || raise_after == PROBE_PT_RAISE)
do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), MMM_TO_MMS(Z_PROBE_SPEED_FAST)); do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), z_probe_fast_mm_s);
else if (raise_after == PROBE_PT_STOW) else if (raise_after == PROBE_PT_STOW)
if (stow()) measured_z = NAN; // Error on stow? if (stow()) measured_z = NAN; // Error on stow?