diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 131af4706f6..173113830f4 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f68ec7b098b..352c01eb61e 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1856,9 +1856,15 @@ static void clean_up_after_endstop_or_probe_move() { #if HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION) bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) { +#if ENABLED(HOME_AFTER_DEACTIVATE) const bool xx = x && !axis_known_position[X_AXIS], yy = y && !axis_known_position[Y_AXIS], zz = z && !axis_known_position[Z_AXIS]; +#else + const bool xx = x && !axis_homed[X_AXIS], + yy = y && !axis_homed[Y_AXIS], + zz = z && !axis_homed[Z_AXIS]; +#endif if (xx || yy || zz) { SERIAL_ECHO_START; SERIAL_ECHOPGM(MSG_HOME " "); @@ -8550,12 +8556,12 @@ void quickstop_stepper() { */ inline void gcode_M421() { const bool hasX = code_seen('X'), hasI = code_seen('I'); - const int8_t ix = hasI ? code_value_byte() : hasX ? mbl.probe_index_x(RAW_X_POSITION(code_value_linear_units())) : -1; + const int8_t ix = hasI ? code_value_int() : hasX ? mbl.probe_index_x(RAW_X_POSITION(code_value_linear_units())) : -1; const bool hasY = code_seen('Y'), hasJ = code_seen('J'); - const int8_t iy = hasJ ? code_value_byte() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(code_value_linear_units())) : -1; - const bool hasZ = code_seen('Z'), hasQ = code_seen('Q'); + const int8_t iy = hasJ ? code_value_int() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(code_value_linear_units())) : -1; + const bool hasZ = code_seen('Z'), hasQ = !hasZ && code_seen('Q'); - if (int(hasI && hasJ) + int(hasX && hasY) != 1 || hasZ == hasQ) { + if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ)) { SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS); } @@ -8578,12 +8584,12 @@ void quickstop_stepper() { */ inline void gcode_M421() { const bool hasI = code_seen('I'); - const int8_t ix = hasI ? code_value_byte() : -1; + const int8_t ix = hasI ? code_value_int() : -1; const bool hasJ = code_seen('J'); - const int8_t iy = hasJ ? code_value_byte() : -1; - const bool hasZ = code_seen('Z'), hasQ = code_seen('Q'); + const int8_t iy = hasJ ? code_value_int() : -1; + const bool hasZ = code_seen('Z'), hasQ = !hasZ && code_seen('Q'); - if (!hasI || !hasJ || hasZ == hasQ) { + if (!hasI || !hasJ || !(hasZ || hasQ)) { SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS); } @@ -8611,14 +8617,20 @@ void quickstop_stepper() { * M421 C Q */ inline void gcode_M421() { - const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, current_position[X_AXIS], current_position[Y_AXIS], USE_NOZZLE_AS_REFERENCE, NULL, false); - const bool hasC = code_seen('C'), hasI = code_seen('I'); - const int8_t ix = hasI ? code_value_byte() : hasC ? location.x_index : -1; + const bool hasC = code_seen('C'); + const bool hasI = code_seen('I'); + int8_t ix = hasI ? code_value_int() : -1; const bool hasJ = code_seen('J'); - const int8_t iy = hasJ ? code_value_byte() : hasC ? location.y_index : -1; - const bool hasZ = code_seen('Z'), hasQ = code_seen('Q'); + int8_t iy = hasJ ? code_value_int() : -1; + const bool hasZ = code_seen('Z'), hasQ = !hasZ && code_seen('Q'); - if (int(hasC) + int(hasI && hasJ) != 1 || hasZ == hasQ) { + if (hasC) { + const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, current_position[X_AXIS], current_position[Y_AXIS], USE_NOZZLE_AS_REFERENCE, NULL, false); + ix = location.x_index; + iy = location.y_index; + } + + if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ)) { SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS); } diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index a6a33061613..a6cb8889d6d 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -625,18 +625,18 @@ void MarlinSettings::postprocess() { if (!eeprom_error) { const int eeprom_size = eeprom_index; - const uint16_t tcrc = working_crc; + const uint16_t final_crc = working_crc; // Write the EEPROM header eeprom_index = EEPROM_OFFSET; EEPROM_WRITE(version); - EEPROM_WRITE(tcrc); + EEPROM_WRITE(final_crc); // Report storage size SERIAL_ECHO_START; SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET)); - SERIAL_ECHOPAIR(" bytes; crc ", tcrc); + SERIAL_ECHOPAIR(" bytes; crc ", final_crc); SERIAL_ECHOLNPGM(")"); } @@ -1066,7 +1066,7 @@ void MarlinSettings::postprocess() { // Write crc to MAT along with other data, or just tack on to the beginning or end - SERIAL_PROTOCOLPAIR("Mesh saved in slot ", slot); + SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot); #else @@ -1093,7 +1093,7 @@ void MarlinSettings::postprocess() { // Compare crc with crc from MAT, or read from end - SERIAL_PROTOCOLPAIR("Mesh loaded from slot ", slot); + SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot); #else diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 372d3fff58e..29f57a9d189 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 3dabf65d41f..10bf0a853f8 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h index c003216e09f..dcbb3413097 100644 --- a/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h +++ b/Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 903b1ab798d..dc3cce298f6 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index fd07d62e818..86cddce711d 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 7ae8a93940e..c591d39a28a 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -378,6 +378,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index 03e130a40fa..a9115994c1c 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index 4b82cbe3553..18852225306 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 2ace544332e..8ace9a94c31 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index ab8ddc9088e..f9ed3dc764a 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h index 7e714b3595e..d0aa4429300 100644 --- a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h +++ b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 903b1ab798d..dc3cce298f6 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h index 3f1f4db5335..8ac6fde4b96 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h index 4234c831a31..9fa70a7363e 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 295b82b0d68..d7fe9281c21 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 295b82b0d68..d7fe9281c21 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index dc0a77bdb0f..b2431d7e070 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -370,6 +370,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 5f73c52f2b3..c4341165fa6 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h index 1bf2b69c58e..2a73710208e 100644 --- a/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h +++ b/Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 9050fc67607..50843a39a18 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index f3022c7b233..19c17e29f30 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/example_configurations/wt150/Configuration_adv.h b/Marlin/example_configurations/wt150/Configuration_adv.h index d5d5952017a..9baf16688ba 100644 --- a/Marlin/example_configurations/wt150/Configuration_adv.h +++ b/Marlin/example_configurations/wt150/Configuration_adv.h @@ -365,6 +365,8 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + // @section lcd #if ENABLED(ULTIPANEL) diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 6e97d702fab..09a86c3a3d3 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -307,7 +307,7 @@ static int g29_verbose_level, phase_value, repetition_cnt, storage_slot = 0, map_type, grid_size; static bool repeat_flag, c_flag, x_flag, y_flag; - static float x_pos, y_pos, measured_z, card_thickness = 0.0, ubl_constant = 0.0; + static float x_pos, y_pos, card_thickness = 0.0, ubl_constant = 0.0; extern void lcd_setstatus(const char* message, const bool persist); extern void lcd_setstatuspgm(const char* message, const uint8_t level); @@ -1026,7 +1026,6 @@ if (do_ubl_mesh_map) ubl.display_map(map_type); - LEAVE: ubl.restore_ubl_active_state_and_leave(); KEEPALIVE_STATE(IN_HANDLER); do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 6b3784bac7b..cfeb0b72beb 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1858,7 +1858,6 @@ void kill_screen(const char* lcd_msg) { * UBL Build Mesh submenu */ void _lcd_ubl_build_mesh() { - int GRID_NUM_POINTS = GRID_MAX_POINTS; START_MENU(); MENU_BACK(MSG_UBL_TOOLS); #if (WATCH_THE_BED)