From 39f1222060fd34ec8e61159432a4169811b10d5a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 5 Mar 2019 07:53:15 -0600 Subject: [PATCH] One fewer G29 error string --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 42659c920d..b04ffac15d 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -1737,25 +1737,20 @@ * 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() { - int16_t a = settings.calc_num_meshes(); + const int16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_ECHOLNPGM("?EEPROM storage not available."); return; } - if (!parser.has_value()) { - SERIAL_ECHOLNPAIR("?Storage slot # required.\n?Use 0 to ", a - 1); + if (!parser.has_value() || !WITHIN(g29_storage_slot, 0, a - 1)) { + SERIAL_ECHOLNPAIR("?Invalid storage slot.\n?Use 0 to ", a - 1); return; } g29_storage_slot = parser.value_int(); - if (!WITHIN(g29_storage_slot, 0, a - 1)) { - SERIAL_ECHOLNPAIR("?Invalid storage slot.\n?Use 0 to ", a - 1); - return; - } - float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; settings.load_mesh(g29_storage_slot, &tmp_z_values);