Browse Source

Homing backoff enhancements

- Define homing bump as an array
- Add pre and post homing backoff options
- Consolidate homing config options
vanilla_fb_2.0.x
George Fu 5 years ago
committed by Scott Lahteine
parent
commit
a794538c54
  1. 34
      Marlin/Configuration_adv.h
  2. 4
      Marlin/src/inc/SanityCheck.h
  3. 4
      Marlin/src/module/delta.cpp
  4. 32
      Marlin/src/module/motion.cpp
  5. 17
      Marlin/src/module/motion.h
  6. 4
      buildroot/share/tests/SAMD51_grandcentral_m4-tests
  7. 1
      buildroot/share/tests/mega1280-tests

34
Marlin/Configuration_adv.h

@ -592,8 +592,7 @@
// Default x offset in duplication mode (typically set to half print bed width) // Default x offset in duplication mode (typically set to half print bed width)
#define DEFAULT_DUPLICATION_X_OFFSET 100 #define DEFAULT_DUPLICATION_X_OFFSET 100
#endif
#endif // DUAL_X_CARRIAGE
// Activate a solenoid on the active extruder with M380. Disable all with M381. // Activate a solenoid on the active extruder with M380. Disable all with M381.
// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. // Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid.
@ -601,19 +600,24 @@
// @section homing // @section homing
// Homing hits each endstop, retracts by these distances, then does a slower bump. /**
#define X_HOME_BUMP_MM 5 * Homing Procedure
#define Y_HOME_BUMP_MM 5 * Homing (G28) does an indefinite move towards the endstops to establish
#define Z_HOME_BUMP_MM 2 * the position of the toolhead relative to the workspace.
#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) */
//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially
//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing //#define SENSORLESS_BACKOFF_MM { 2, 2 } // (mm) Backoff from endstops before sensorless homing
// When G28 is called, this option will make Y home before X #define HOMING_BUMP_MM { 5, 5, 2 } // (mm) Backoff from endstops after first bump
//#define HOME_Y_BEFORE_X #define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate)
// Enable this if X or Y can't home without homing the other axis first. //#define HOMING_BACKOFF_POST_MM { 2, 2, 2 } // (mm) Backoff from endstops after homing
//#define CODEPENDENT_XY_HOMING
//#define QUICK_HOME // If G28 contains XY do a diagonal move first
//#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X
//#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first
// @section bltouch
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
/** /**
@ -682,6 +686,8 @@
#endif // BLTOUCH #endif // BLTOUCH
// @section extras
/** /**
* Z Steppers Auto-Alignment * Z Steppers Auto-Alignment
* Add the G34 command to align multiple Z steppers using a bed probe. * Add the G34 command to align multiple Z steppers using a bed probe.
@ -2319,7 +2325,7 @@
* HIGHEST 255 -64 (Too sensitive => False positive) * HIGHEST 255 -64 (Too sensitive => False positive)
* LOWEST 0 63 (Too insensitive => No trigger) * LOWEST 0 63 (Too insensitive => No trigger)
* *
* It is recommended to set [XYZ]_HOME_BUMP_MM to 0. * It is recommended to set HOMING_BUMP_MM to { 0, 0, 0 }.
* *
* SPI_ENDSTOPS *** Beta feature! *** TMC2130 Only *** * SPI_ENDSTOPS *** Beta feature! *** TMC2130 Only ***
* Poll the driver through SPI to determine load when homing. * Poll the driver through SPI to determine load when homing.

4
Marlin/src/inc/SanityCheck.h

@ -493,6 +493,10 @@
#error "ORIG_Ex_AUTO_FAN_PIN is now just Ex_AUTO_FAN_PIN. Make sure your pins are up to date." #error "ORIG_Ex_AUTO_FAN_PIN is now just Ex_AUTO_FAN_PIN. Make sure your pins are up to date."
#elif defined(ORIG_CHAMBER_AUTO_FAN_PIN) #elif defined(ORIG_CHAMBER_AUTO_FAN_PIN)
#error "ORIG_CHAMBER_AUTO_FAN_PIN is now just CHAMBER_AUTO_FAN_PIN. Make sure your pins are up to date." #error "ORIG_CHAMBER_AUTO_FAN_PIN is now just CHAMBER_AUTO_FAN_PIN. Make sure your pins are up to date."
#elif defined(HOMING_BACKOFF_MM)
#error "HOMING_BACKOFF_MM is now HOMING_BACKOFF_POST_MM. Please update Configuration_adv.h."
#elif defined(X_HOME_BUMP_MM) || defined(Y_HOME_BUMP_MM) || defined(Z_HOME_BUMP_MM)
#error "[XYZ]_HOME_BUMP_MM is now HOMING_BUMP_MM. Please update Configuration_adv.h."
#endif #endif
/** /**

4
Marlin/src/module/delta.cpp

@ -280,8 +280,8 @@ void home_delta() {
sync_plan_position(); sync_plan_position();
#if DISABLED(DELTA_HOME_TO_SAFE_ZONE) && defined(HOMING_BACKOFF_MM) #if DISABLED(DELTA_HOME_TO_SAFE_ZONE) && defined(HOMING_BACKOFF_POST_MM)
constexpr xyz_float_t endstop_backoff = HOMING_BACKOFF_MM; constexpr xyz_float_t endstop_backoff = HOMING_BACKOFF_POST_MM;
if (endstop_backoff.z) { if (endstop_backoff.z) {
current_position.z -= ABS(endstop_backoff.z) * Z_HOME_DIR; current_position.z -= ABS(endstop_backoff.z) * Z_HOME_DIR;
line_to_current_position(homing_feedrate(Z_AXIS)); line_to_current_position(homing_feedrate(Z_AXIS));

32
Marlin/src/module/motion.cpp

@ -74,15 +74,6 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../core/debug_out.h" #include "../core/debug_out.h"
#define XYZ_CONSTS(T, NAME, OPT) const PROGMEM XYZval<T> NAME##_P = { X_##OPT, Y_##OPT, Z_##OPT }
XYZ_CONSTS(float, base_min_pos, MIN_POS);
XYZ_CONSTS(float, base_max_pos, MAX_POS);
XYZ_CONSTS(float, base_home_pos, HOME_POS);
XYZ_CONSTS(float, max_length, MAX_LENGTH);
XYZ_CONSTS(float, home_bump_mm, HOME_BUMP_MM);
XYZ_CONSTS(signed char, home_dir, HOME_DIR);
/** /**
* axis_homed * axis_homed
* Flags that each linear axis was homed. * Flags that each linear axis was homed.
@ -1567,14 +1558,13 @@ void homeaxis(const AxisEnum axis) {
if (axis == Z_AXIS && bltouch.deploy()) return; // The initial DEPLOY if (axis == Z_AXIS && bltouch.deploy()) return; // The initial DEPLOY
#endif #endif
do_homing_move(axis, 1.5f * max_length( #if DISABLED(DELTA) && defined(SENSORLESS_BACKOFF_MM)
#if ENABLED(DELTA) const xy_float_t backoff = SENSORLESS_BACKOFF_MM;
Z_AXIS if (((ENABLED(X_SENSORLESS) && axis == X_AXIS) || (ENABLED(Y_SENSORLESS) && axis == Y_AXIS)) && backoff[axis])
#else do_homing_move(axis, -ABS(backoff[axis]) * axis_home_dir, homing_feedrate(axis));
axis #endif
#endif
) * axis_home_dir do_homing_move(axis, 1.5f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir);
);
#if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE) #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE) if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE)
@ -1583,14 +1573,14 @@ void homeaxis(const AxisEnum axis) {
// When homing Z with probe respect probe clearance // When homing Z with probe respect probe clearance
const float bump = axis_home_dir * ( const float bump = axis_home_dir * (
#if HOMING_Z_WITH_PROBE #if HOMING_Z_WITH_PROBE
(axis == Z_AXIS && (Z_HOME_BUMP_MM)) ? _MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_HOME_BUMP_MM) : (axis == Z_AXIS && home_bump_mm(Z_AXIS)) ? _MAX(Z_CLEARANCE_BETWEEN_PROBES, home_bump_mm(Z_AXIS)) :
#endif #endif
home_bump_mm(axis) home_bump_mm(axis)
); );
// If a second homing move is configured... // If a second homing move is configured...
if (bump) { if (bump) {
// Move away from the endstop by the axis HOME_BUMP_MM // Move away from the endstop by the axis HOMING_BUMP_MM
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move Away:"); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move Away:");
do_homing_move(axis, -bump do_homing_move(axis, -bump
#if HOMING_Z_WITH_PROBE #if HOMING_Z_WITH_PROBE
@ -1785,8 +1775,8 @@ void homeaxis(const AxisEnum axis) {
if (axis == Z_AXIS && probe.stow()) return; if (axis == Z_AXIS && probe.stow()) return;
#endif #endif
#if DISABLED(DELTA) && defined(HOMING_BACKOFF_MM) #if DISABLED(DELTA) && defined(HOMING_BACKOFF_POST_MM)
const xyz_float_t endstop_backoff = HOMING_BACKOFF_MM; const xyz_float_t endstop_backoff = HOMING_BACKOFF_POST_MM;
if (endstop_backoff[axis]) { if (endstop_backoff[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(

17
Marlin/src/module/motion.h

@ -114,20 +114,25 @@ extern int16_t feedrate_percentage;
extern float e_move_accumulator; extern float e_move_accumulator;
#endif #endif
FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float(p); } inline float pgm_read_any(const float *p) { return pgm_read_float(p); }
FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte(p); } inline signed char pgm_read_any(const signed char *p) { return pgm_read_byte(p); }
#define XYZ_DEFS(T, NAME, OPT) \ #define XYZ_DEFS(T, NAME, OPT) \
extern const XYZval<T> NAME##_P; \ inline T NAME(const AxisEnum axis) { \
FORCE_INLINE T NAME(AxisEnum axis) { return pgm_read_any(&NAME##_P[axis]); } static const XYZval<T> NAME##_P PROGMEM = { X_##OPT, Y_##OPT, Z_##OPT }; \
return pgm_read_any(&NAME##_P[axis]); \
}
XYZ_DEFS(float, base_min_pos, MIN_POS); XYZ_DEFS(float, base_min_pos, MIN_POS);
XYZ_DEFS(float, base_max_pos, MAX_POS); XYZ_DEFS(float, base_max_pos, MAX_POS);
XYZ_DEFS(float, base_home_pos, HOME_POS); XYZ_DEFS(float, base_home_pos, HOME_POS);
XYZ_DEFS(float, max_length, MAX_LENGTH); XYZ_DEFS(float, max_length, MAX_LENGTH);
XYZ_DEFS(float, home_bump_mm, HOME_BUMP_MM);
XYZ_DEFS(signed char, home_dir, HOME_DIR); XYZ_DEFS(signed char, home_dir, HOME_DIR);
inline float home_bump_mm(const AxisEnum axis) {
static const xyz_pos_t home_bump_mm_P PROGMEM = HOMING_BUMP_MM;
return pgm_read_any(&home_bump_mm_P[axis]);
}
#if HAS_WORKSPACE_OFFSET #if HAS_WORKSPACE_OFFSET
void update_workspace_offset(const AxisEnum axis); void update_workspace_offset(const AxisEnum axis);
#else #else

4
buildroot/share/tests/SAMD51_grandcentral_m4-tests

@ -22,9 +22,7 @@ opt_set E0_DRIVER_TYPE TMC2209
opt_set RESTORE_LEVELING_AFTER_G28 false opt_set RESTORE_LEVELING_AFTER_G28 false
opt_set LCD_LANGUAGE it opt_set LCD_LANGUAGE it
opt_set NUM_Z_STEPPER_DRIVERS 2 opt_set NUM_Z_STEPPER_DRIVERS 2
opt_set X_HOME_BUMP_MM 0 opt_set HOMING_BUMP_MM "{ 0, 0, 0 }"
opt_set Y_HOME_BUMP_MM 0
opt_set Z_HOME_BUMP_MM 0
opt_set SDCARD_CONNECTION LCD opt_set SDCARD_CONNECTION LCD
opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \ opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \
FILAMENT_RUNOUT_SENSOR G26_MESH_VALIDATION MESH_EDIT_GFX_OVERLAY Z_SAFE_HOMING \ FILAMENT_RUNOUT_SENSOR G26_MESH_VALIDATION MESH_EDIT_GFX_OVERLAY Z_SAFE_HOMING \

1
buildroot/share/tests/mega1280-tests

@ -18,6 +18,7 @@ set -e
restore_configs restore_configs
opt_set LCD_LANGUAGE an opt_set LCD_LANGUAGE an
opt_enable SPINDLE_FEATURE ULTIMAKERCONTROLLER LCD_BED_LEVELING \ opt_enable SPINDLE_FEATURE ULTIMAKERCONTROLLER LCD_BED_LEVELING \
SENSORLESS_BACKOFF_MM HOMING_BACKOFF_POST_MM HOME_Y_BEFORE_X CODEPENDENT_XY_HOMING \
MESH_BED_LEVELING ENABLE_LEVELING_FADE_HEIGHT MESH_G28_REST_ORIGIN \ MESH_BED_LEVELING ENABLE_LEVELING_FADE_HEIGHT MESH_G28_REST_ORIGIN \
G26_MESH_VALIDATION MESH_EDIT_MENU GCODE_QUOTED_STRINGS G26_MESH_VALIDATION MESH_EDIT_MENU GCODE_QUOTED_STRINGS
exec_test $1 $2 "Spindle, MESH_BED_LEVELING, and LCD" exec_test $1 $2 "Spindle, MESH_BED_LEVELING, and LCD"

Loading…
Cancel
Save