diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e83dbcacf..bc2541dcb 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4490,7 +4490,7 @@ void home_all_axes() { gcode_G28(true); } const uint8_t old_debug_flags = marlin_debug_flags; if (query) marlin_debug_flags |= DEBUG_LEVELING; if (DEBUGGING(LEVELING)) { - DEBUG_POS(">>> gcode_G29", current_position); + DEBUG_POS(">>> G29", current_position); log_machine_info(); } marlin_debug_flags = old_debug_flags; @@ -4552,12 +4552,10 @@ void home_all_axes() { gcode_G28(true); } abl_grid_points_y = GRID_MAX_POINTS_Y; #endif - #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(PROBE_MANUALLY) - #if ENABLED(AUTO_BED_LEVELING_LINEAR) - ABL_VAR int abl2; - #else // Bilinear - int constexpr abl2 = GRID_MAX_POINTS; - #endif + #if ENABLED(AUTO_BED_LEVELING_LINEAR) + ABL_VAR int abl2; + #elif ENABLED(PROBE_MANUALLY) // Bilinear + int constexpr abl2 = GRID_MAX_POINTS; #endif #if ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -4575,7 +4573,9 @@ void home_all_axes() { gcode_G28(true); } #elif ENABLED(AUTO_BED_LEVELING_3POINT) - int constexpr abl2 = 3; + #if ENABLED(PROBE_MANUALLY) + int constexpr abl2 = 3; // used to show total points + #endif // Probe at 3 arbitrary points ABL_VAR vector_3 points[3] = { @@ -4624,7 +4624,7 @@ void home_all_axes() { gcode_G28(true); } j = parser.byteval('J', -1); if (!isnan(rx) && !isnan(ry)) { - // Get nearest i / j from x / y + // Get nearest i / j from rx / ry i = (rx - bilinear_start[X_AXIS] + 0.5 * xGridSpacing) / xGridSpacing; j = (ry - bilinear_start[Y_AXIS] + 0.5 * yGridSpacing) / yGridSpacing; i = constrain(i, 0, GRID_MAX_POINTS_X - 1); @@ -4637,22 +4637,18 @@ void home_all_axes() { gcode_G28(true); } bed_level_virt_interpolate(); #endif set_bed_leveling_enabled(abl_should_enable); - report_current_position(); + if (abl_should_enable) report_current_position(); } return; } // parser.seen('W') #endif - #if HAS_LEVELING - - // Jettison bed leveling data - if (parser.seen('J')) { - reset_bed_level(); - return; - } - - #endif + // Jettison bed leveling data + if (parser.seen('J')) { + reset_bed_level(); + return; + } verbose_level = parser.intval('V'); if (!WITHIN(verbose_level, 0, 4)) { @@ -4682,6 +4678,7 @@ void home_all_axes() { gcode_G28(true); } } abl2 = abl_grid_points_x * abl_grid_points_y; + mean = 0; #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -4734,8 +4731,9 @@ void home_all_axes() { gcode_G28(true); } #endif // ABL_GRID if (verbose_level > 0) { - SERIAL_PROTOCOLLNPGM("G29 Auto Bed Leveling"); - if (dryrun) SERIAL_PROTOCOLLNPGM("Running in DRY-RUN mode"); + SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling"); + if (dryrun) SERIAL_PROTOCOLPGM(" (DRYRUN)"); + SERIAL_EOL(); } stepper.synchronize(); @@ -4744,15 +4742,6 @@ void home_all_axes() { gcode_G28(true); } // Be formal so G29 can be done successively without G28. set_bed_leveling_enabled(false); - if (!dryrun) { - // Re-orient the current position without leveling - // based on where the steppers are positioned. - set_current_from_steppers_for_axis(ALL_AXES); - - // Sync the planner to where the steppers stopped - SYNC_PLAN_POSITION_KINEMATIC(); - } - #if HAS_BED_PROBE // Deploy the probe. Probe will raise if needed. if (DEPLOY_PROBE()) { @@ -4934,9 +4923,10 @@ void home_all_axes() { gcode_G28(true); } #elif ENABLED(AUTO_BED_LEVELING_3POINT) // Probe at 3 arbitrary points - if (abl_probe_index < 3) { + if (abl_probe_index < abl2) { xProbe = points[abl_probe_index].x; yProbe = points[abl_probe_index].y; + _manual_goto_xy(xProbe, yProbe); #if HAS_SOFTWARE_ENDSTOPS // Disable software endstops to allow manual adjustment // If G29 is not completed, they will not be re-enabled @@ -4974,6 +4964,8 @@ void home_all_axes() { gcode_G28(true); } { const bool stow_probe_after_each = parser.boolval('E'); + measured_z = 0; + #if ABL_GRID bool zig = PR_OUTER_END & 1; // Always end at RIGHT and BACK_PROBE_BED_POSITION @@ -5307,7 +5299,7 @@ void home_all_axes() { gcode_G28(true); } if (!faux) clean_up_after_endstop_or_probe_move(); #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G29"); + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G29"); #endif report_current_position(); @@ -9638,7 +9630,7 @@ void quickstop_stepper() { #if ENABLED(EEPROM_SETTINGS) const int8_t storage_slot = parser.has_value() ? parser.value_int() : ubl.storage_slot; - const uint16_t a = settings.calc_num_meshes(); + const int16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index f3b2707d0..e741e391d 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -608,7 +608,7 @@ if (parser.seen('L')) { // Load Current Mesh Data g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot; - uint16_t a = settings.calc_num_meshes(); + int16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); @@ -650,7 +650,7 @@ return; } - uint16_t a = settings.calc_num_meshes(); + int16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); @@ -1327,7 +1327,7 @@ * use cases for the users. So we can wait and see what to do with it. */ void unified_bed_leveling::g29_compare_current_mesh_to_stored_mesh() { - uint16_t a = settings.calc_num_meshes(); + int16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 35f034228..8d78d5a50 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2279,7 +2279,7 @@ void kill_screen(const char* lcd_msg) { * Save Bed Mesh */ void _lcd_ubl_storage_mesh() { - uint16_t a = settings.calc_num_meshes(); + int16_t a = settings.calc_num_meshes(); START_MENU(); MENU_BACK(MSG_UBL_LEVEL_BED); if (!WITHIN(ubl_storage_slot, 0, a - 1)) {