|
@ -305,7 +305,7 @@ void unified_bed_leveling::G29() { |
|
|
bool probe_deployed = false; |
|
|
bool probe_deployed = false; |
|
|
if (G29_parse_parameters()) return; // Abort on parameter error
|
|
|
if (G29_parse_parameters()) return; // Abort on parameter error
|
|
|
|
|
|
|
|
|
const int8_t p_val = parser.intval('P', -1); |
|
|
const uint8_t p_val = parser.byteval('P'); |
|
|
const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen_test('J'); |
|
|
const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen_test('J'); |
|
|
#if ENABLED(HAS_MULTI_HOTEND) |
|
|
#if ENABLED(HAS_MULTI_HOTEND) |
|
|
const uint8_t old_tool_index = active_extruder; |
|
|
const uint8_t old_tool_index = active_extruder; |
|
@ -321,7 +321,7 @@ void unified_bed_leveling::G29() { |
|
|
|
|
|
|
|
|
// Invalidate one or more nearby mesh points, possibly all.
|
|
|
// Invalidate one or more nearby mesh points, possibly all.
|
|
|
if (parser.seen('I')) { |
|
|
if (parser.seen('I')) { |
|
|
int16_t count = parser.has_value() ? parser.value_int() : 1; |
|
|
uint8_t count = parser.has_value() ? parser.value_byte() : 1; |
|
|
bool invalidate_all = count >= GRID_MAX_POINTS; |
|
|
bool invalidate_all = count >= GRID_MAX_POINTS; |
|
|
if (!invalidate_all) { |
|
|
if (!invalidate_all) { |
|
|
while (count--) { |
|
|
while (count--) { |
|
@ -345,7 +345,7 @@ void unified_bed_leveling::G29() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (parser.seen('Q')) { |
|
|
if (parser.seen('Q')) { |
|
|
const int test_pattern = parser.has_value() ? parser.value_int() : -99; |
|
|
const int16_t test_pattern = parser.has_value() ? parser.value_int() : -99; |
|
|
if (!WITHIN(test_pattern, -1, 2)) { |
|
|
if (!WITHIN(test_pattern, -1, 2)) { |
|
|
SERIAL_ECHOLNPGM("Invalid test_pattern value. (-1 to 2)\n"); |
|
|
SERIAL_ECHOLNPGM("Invalid test_pattern value. (-1 to 2)\n"); |
|
|
return; |
|
|
return; |
|
@ -592,7 +592,7 @@ void unified_bed_leveling::G29() { |
|
|
//
|
|
|
//
|
|
|
|
|
|
|
|
|
if (parser.seen('L')) { // Load Current Mesh Data
|
|
|
if (parser.seen('L')) { // Load Current Mesh Data
|
|
|
param.KLS_storage_slot = parser.has_value() ? parser.value_int() : storage_slot; |
|
|
param.KLS_storage_slot = parser.has_value() ? (int8_t)parser.value_int() : storage_slot; |
|
|
|
|
|
|
|
|
int16_t a = settings.calc_num_meshes(); |
|
|
int16_t a = settings.calc_num_meshes(); |
|
|
|
|
|
|
|
@ -617,10 +617,10 @@ void unified_bed_leveling::G29() { |
|
|
//
|
|
|
//
|
|
|
|
|
|
|
|
|
if (parser.seen('S')) { // Store (or Save) Current Mesh Data
|
|
|
if (parser.seen('S')) { // Store (or Save) Current Mesh Data
|
|
|
param.KLS_storage_slot = parser.has_value() ? parser.value_int() : storage_slot; |
|
|
param.KLS_storage_slot = parser.has_value() ? (int8_t)parser.value_int() : storage_slot; |
|
|
|
|
|
|
|
|
if (param.KLS_storage_slot == -1) // Special case, the user wants to 'Export' the mesh to the
|
|
|
if (param.KLS_storage_slot == -1) // Special case: 'Export' the mesh to the
|
|
|
return report_current_mesh(); // host program to be saved on the user's computer
|
|
|
return report_current_mesh(); // host so it can be saved in a file.
|
|
|
|
|
|
|
|
|
int16_t a = settings.calc_num_meshes(); |
|
|
int16_t a = settings.calc_num_meshes(); |
|
|
|
|
|
|
|
@ -673,7 +673,7 @@ void unified_bed_leveling::G29() { |
|
|
*/ |
|
|
*/ |
|
|
void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t offset) { |
|
|
void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t offset) { |
|
|
float sum = 0; |
|
|
float sum = 0; |
|
|
int n = 0; |
|
|
uint8_t n = 0; |
|
|
GRID_LOOP(x, y) |
|
|
GRID_LOOP(x, y) |
|
|
if (!isnan(z_values[x][y])) { |
|
|
if (!isnan(z_values[x][y])) { |
|
|
sum += z_values[x][y]; |
|
|
sum += z_values[x][y]; |
|
@ -734,7 +734,7 @@ void unified_bed_leveling::shift_mesh_height() { |
|
|
do { |
|
|
do { |
|
|
if (do_ubl_mesh_map) display_map(param.T_map_type); |
|
|
if (do_ubl_mesh_map) display_map(param.T_map_type); |
|
|
|
|
|
|
|
|
const int point_num = (GRID_MAX_POINTS) - count + 1; |
|
|
const uint8_t point_num = (GRID_MAX_POINTS - count) + 1; |
|
|
SERIAL_ECHOLNPAIR("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, "."); |
|
|
SERIAL_ECHOLNPAIR("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, "."); |
|
|
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), point_num, int(GRID_MAX_POINTS))); |
|
|
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), point_num, int(GRID_MAX_POINTS))); |
|
|
|
|
|
|
|
@ -1083,7 +1083,7 @@ bool unified_bed_leveling::G29_parse_parameters() { |
|
|
param.R_repetition = 0; |
|
|
param.R_repetition = 0; |
|
|
|
|
|
|
|
|
if (parser.seen('R')) { |
|
|
if (parser.seen('R')) { |
|
|
param.R_repetition = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS; |
|
|
param.R_repetition = parser.has_value() ? parser.value_byte() : GRID_MAX_POINTS; |
|
|
NOMORE(param.R_repetition, GRID_MAX_POINTS); |
|
|
NOMORE(param.R_repetition, GRID_MAX_POINTS); |
|
|
if (param.R_repetition < 1) { |
|
|
if (param.R_repetition < 1) { |
|
|
SERIAL_ECHOLNPGM("?(R)epetition count invalid (1+).\n"); |
|
|
SERIAL_ECHOLNPGM("?(R)epetition count invalid (1+).\n"); |
|
@ -1091,14 +1091,14 @@ bool unified_bed_leveling::G29_parse_parameters() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
param.V_verbosity = parser.intval('V'); |
|
|
param.V_verbosity = parser.byteval('V'); |
|
|
if (!WITHIN(param.V_verbosity, 0, 4)) { |
|
|
if (!WITHIN(param.V_verbosity, 0, 4)) { |
|
|
SERIAL_ECHOLNPGM("?(V)erbose level implausible (0-4).\n"); |
|
|
SERIAL_ECHOLNPGM("?(V)erbose level implausible (0-4).\n"); |
|
|
err_flag = true; |
|
|
err_flag = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (parser.seen('P')) { |
|
|
if (parser.seen('P')) { |
|
|
const int pv = parser.value_int(); |
|
|
const uint8_t pv = parser.value_byte(); |
|
|
#if !HAS_BED_PROBE |
|
|
#if !HAS_BED_PROBE |
|
|
if (pv == 1) { |
|
|
if (pv == 1) { |
|
|
SERIAL_ECHOLNPGM("G29 P1 requires a probe.\n"); |
|
|
SERIAL_ECHOLNPGM("G29 P1 requires a probe.\n"); |
|
@ -1181,7 +1181,7 @@ bool unified_bed_leveling::G29_parse_parameters() { |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
param.T_map_type = parser.intval('T'); |
|
|
param.T_map_type = parser.byteval('T'); |
|
|
if (!WITHIN(param.T_map_type, 0, 2)) { |
|
|
if (!WITHIN(param.T_map_type, 0, 2)) { |
|
|
SERIAL_ECHOLNPGM("Invalid map type.\n"); |
|
|
SERIAL_ECHOLNPGM("Invalid map type.\n"); |
|
|
return UBL_ERR; |
|
|
return UBL_ERR; |
|
@ -1833,7 +1833,7 @@ void unified_bed_leveling::smart_fill_mesh() { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
param.KLS_storage_slot = parser.value_int(); |
|
|
param.KLS_storage_slot = (int8_t)parser.value_int(); |
|
|
|
|
|
|
|
|
float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; |
|
|
float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; |
|
|
settings.load_mesh(param.KLS_storage_slot, &tmp_z_values); |
|
|
settings.load_mesh(param.KLS_storage_slot, &tmp_z_values); |
|
|