diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 131af4706..173113830 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 f68ec7b09..352c01eb6 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 (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) { + 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 a6a330616..a6cb8889d 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 372d3fff5..29f57a9d1 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 3dabf65d4..10bf0a853 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 c003216e0..dcbb34130 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 903b1ab79..dc3cce298 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 fd07d62e8..86cddce71 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 7ae8a9394..c591d39a2 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 03e130a40..a9115994c 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 4b82cbe35..188522253 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 2ace54433..8ace9a94c 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 ab8ddc908..f9ed3dc76 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 7e714b359..d0aa44293 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 903b1ab79..dc3cce298 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 3f1f4db53..8ac6fde4b 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 4234c831a..9fa70a736 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 295b82b0d..d7fe9281c 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 295b82b0d..d7fe9281c 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 dc0a77bdb..b2431d7e0 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 5f73c52f2..c4341165f 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 1bf2b69c5..2a7371020 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 9050fc676..50843a39a 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 f3022c7b2..19c17e29f 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 d5d595201..9baf16688 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 6e97d702f..09a86c3a3 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 6b3784bac..cfeb0b72b 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)