From 2e5a6243dffb1e1ff69c27a252e1392c23cb9fb0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine <github@thinkyhead.com> Date: Sun, 18 Feb 2018 01:06:57 -0600 Subject: [PATCH] Option to force X or Y to home first when homing the other axis --- .travis.yml | 15 +++++++++++---- Marlin/Configuration_adv.h | 3 +++ Marlin/Marlin_main.cpp | 16 ++++++++++++---- Marlin/SanityCheck.h | 10 +++++++++- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5cb0b0bf064..34c0a15c9a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,17 +95,24 @@ script: - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS - opt_enable BLINKM PCA9632 RGB_LED NEOPIXEL_LED AUTO_POWER_CONTROL - opt_enable AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE - - opt_enable_adv FWRETRACT MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL + - opt_enable_adv FWRETRACT MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CODEPENDENT_XY_HOMING - opt_set ABL_GRID_POINTS_X 16 - opt_set ABL_GRID_POINTS_Y 16 - opt_set_adv FANMUX0_PIN 53 - build_marlin # - # Test a probeless build of AUTO_BED_LEVELING_UBL + # Test a probeless build of AUTO_BED_LEVELING_UBL, with lots of extruders # - restore_configs - - opt_enable AUTO_BED_LEVELING_UBL DEBUG_LEVELING_FEATURE G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT EEPROM_SETTINGS EEPROM_CHITCHAT G3D_PANEL - - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING BABYSTEP_XY NANODLP_Z_SYNC + - opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO + - opt_set EXTRUDERS 5 + - opt_set TEMP_SENSOR_1 1 + - opt_set TEMP_SENSOR_2 5 + - opt_set TEMP_SENSOR_3 20 + - opt_set TEMP_SENSOR_4 999 + - opt_set TEMP_SENSOR_BED 1 + - opt_enable AUTO_BED_LEVELING_UBL DEBUG_LEVELING_FEATURE G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT EEPROM_SETTINGS EEPROM_CHITCHAT G3D_PANEL SKEW_CORRECTION + - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING BABYSTEP_XY LIN_ADVANCE NANODLP_Z_SYNC QUICK_HOME - build_marlin # # Add a Sled Z Probe, use UBL Cartesian moves, use Japanese language diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d0e807783cf..dc8f8a320ed 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -362,6 +362,9 @@ // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X +// Enable this if X or Y can't home without homing the other axis first. +//#define CODEPENDENT_XY_HOMING + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 34a82140a5f..637bf33538c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3994,10 +3994,14 @@ inline void gcode_G28(const bool always_home_all) { #endif + // Home Y (before X) #if ENABLED(HOME_Y_BEFORE_X) - // Home Y - if (home_all || homeY) { + if (home_all || homeY + #if ENABLED(CODEPENDENT_XY_HOMING) + || homeX + #endif + ) { HOMEAXIS(Y); #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position); @@ -4007,7 +4011,11 @@ inline void gcode_G28(const bool always_home_all) { #endif // Home X - if (home_all || homeX) { + if (home_all || homeX + #if ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X) + || homeY + #endif + ) { #if ENABLED(DUAL_X_CARRIAGE) @@ -4038,8 +4046,8 @@ inline void gcode_G28(const bool always_home_all) { #endif } + // Home Y (after X) #if DISABLED(HOME_Y_BEFORE_X) - // Home Y if (home_all || homeY) { HOMEAXIS(Y); #if ENABLED(DEBUG_LEVELING_FEATURE) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index af8289a3450..704a63318cb 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -888,12 +888,20 @@ static_assert(1 >= 0 #endif /** - * Homing Bump + * Homing */ #if X_HOME_BUMP_MM < 0 || Y_HOME_BUMP_MM < 0 || Z_HOME_BUMP_MM < 0 #error "[XYZ]_HOME_BUMP_MM must be greater than or equal to 0." #endif +#if ENABLED(CODEPENDENT_XY_HOMING) + #if ENABLED(QUICK_HOME) + #error "QUICK_HOME is incompatible with CODEPENDENT_XY_HOMING." + #elif IS_KINEMATIC + #error "CODEPENDENT_XY_HOMING requires a Cartesian setup." + #endif +#endif + /** * Make sure Z_SAFE_HOMING point is reachable */