From f5f09f147c557e9c08329d6ae097844f3c11d020 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Sat, 13 May 2023 22:03:34 +0200 Subject: [PATCH] Add a limit to how many times G80 can fail Flash: +80 SRAM: +1 --- Firmware/Marlin_main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d15ab8a8f..34de07b70 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2970,7 +2970,11 @@ static void gcode_G80() current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; plan_buffer_line_curposXYZE(Z_LIFT_FEEDRATE); st_synchronize(); + static uint8_t g80_fail_cnt = 0; if (mesh_point != MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) { + if (g80_fail_cnt++ >= 2) { + kill(_i("Mesh bed leveling failed. Please run Z calibration")); + } Sound_MakeSound(e_SOUND_TYPE_StandardAlert); bool bState; do { // repeat until Z-leveling o.k. @@ -3005,6 +3009,8 @@ static void gcode_G80() repeatcommand_front(); // re-run (i.e. of "G80") return; } + g80_fail_cnt = 0; // no fail was detected. Reset the error counter. + clean_up_after_endstop_move(l_feedmultiply); #ifndef PINDA_THERMISTOR