Browse Source

Homing feedrates as XYZ array (#20426)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
vanilla_fb_2.0.x
rafaljot 4 years ago
committed by Scott Lahteine
parent
commit
f50abfcb1b
  1. 5
      Marlin/Configuration.h
  2. 6
      Marlin/src/inc/Conditionals_post.h
  3. 4
      Marlin/src/inc/SanityCheck.h
  4. 16
      Marlin/src/module/motion.cpp
  5. 22
      Marlin/src/module/motion.h
  6. 12
      Marlin/src/module/probe.cpp

5
Marlin/Configuration.h

@ -1001,7 +1001,7 @@
#define XY_PROBE_SPEED (133*60)
// 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
#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
@ -1458,8 +1458,7 @@
#endif
// Homing speeds (mm/min)
#define HOMING_FEEDRATE_XY (50*60)
#define HOMING_FEEDRATE_Z (4*60)
#define HOMING_FEEDRATE_MM_M { (50*60), (50*60), (4*60) }
// Validate that endstops are triggered on homing moves
#define VALIDATE_HOMING_ENDSTOPS

6
Marlin/src/inc/Conditionals_post.h

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

4
Marlin/src/inc/SanityCheck.h

@ -189,7 +189,9 @@
#elif defined(ENDSTOPS_ONLY_FOR_HOMING)
#error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead."
#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)
#error "MANUAL_HOME_POSITIONS is deprecated. Set MANUAL_[XYZ]_HOME_POS as-needed instead."
#elif defined(PID_ADD_EXTRUSION_RATE)

16
Marlin/src/module/motion.cpp

@ -143,16 +143,6 @@ xyze_pos_t destination; // {0}
feedRate_t feedrate_mm_s = MMM_TO_MMS(1500);
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:
xyz_pos_t cartes;
@ -195,7 +185,7 @@ xyz_pos_t cartes;
#endif
#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
/**
@ -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;
float zdest = zclear + (rel ? current_position.z : 0.0f);
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;
line_to_current_position(
#if HOMING_Z_WITH_PROBE
(axis == Z_AXIS) ? MMM_TO_MMS(Z_PROBE_SPEED_FAST) :
(axis == Z_AXIS) ? z_probe_fast_mm_s :
#endif
homing_feedrate(axis)
);

22
Marlin/src/module/motion.h

@ -57,7 +57,7 @@ extern xyz_pos_t cartes;
#endif
#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
#elif defined(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()
#endif
constexpr feedRate_t z_probe_fast_mm_s = MMM_TO_MMS(Z_PROBE_SPEED_FAST);
/**
* Feed rates are often configured with mm/m
* but the planner and stepper like mm/s units.
*/
extern const feedRate_t homing_feedrate_mm_s[XYZ];
FORCE_INLINE feedRate_t homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
constexpr xyz_feedrate_t homing_feedrate_mm_m = HOMING_FEEDRATE_MM_M;
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);
/**

12
Marlin/src/module/probe.cpp

@ -516,7 +516,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#if TOTAL_PROBING == 2
// 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;
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);
// 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
@ -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);
if (current_position.z > z) {
// 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)))
do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, 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, z_probe_fast_mm_s);
}
#endif
@ -582,7 +582,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#if EXTRA_PROBING > 0
< TOTAL_PROBING - 1
#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
}
@ -672,7 +672,7 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
if (!isnan(measured_z)) {
const bool big_raise = raise_after == PROBE_PT_BIG_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)
if (stow()) measured_z = NAN; // Error on stow?

Loading…
Cancel
Save