From a7fb55ea6dc14c98c6ba293f73a117064a92781d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 12 May 2017 06:48:15 -0500 Subject: [PATCH] Use GRID_MAX_POINTS. Some formatting --- Marlin/G26_Mesh_Validation_Tool.cpp | 7 ++----- Marlin/planner.cpp | 4 ++-- Marlin/ubl.h | 4 +--- Marlin/ubl_G29.cpp | 18 ++++++++---------- Marlin/ultralcd.cpp | 16 ++++++++-------- 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/Marlin/G26_Mesh_Validation_Tool.cpp b/Marlin/G26_Mesh_Validation_Tool.cpp index e4fa01dd3c..596f24f12c 100644 --- a/Marlin/G26_Mesh_Validation_Tool.cpp +++ b/Marlin/G26_Mesh_Validation_Tool.cpp @@ -69,7 +69,7 @@ * B # Bed Set the Bed Temperature. If not specified, a default of 60 C. will be assumed. * * C Current When searching for Mesh Intersection points to draw, use the current nozzle location - as the base for any distance comparison. + * as the base for any distance comparison. * * D Disable Disable the Unified Bed Leveling System. In the normal case the user is invoking this * command to see how well a Mesh as been adjusted to match a print surface. In order to do @@ -748,10 +748,7 @@ } /** - * We save the question of what to do with the Unified Bed Leveling System's Activation until the very - * end. The reason is, if one of the parameters specified up above is incorrect, we don't want to - * alter the system's status. We wait until we know everything is correct before altering the state - * of the system. + * Wait until all parameters are verified before altering the state! */ ubl.state.active = !code_seen('D'); diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 21a98a304f..155a4717f5 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -539,7 +539,7 @@ void Planner::check_axes_activity() { #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) // if z_fade_height enabled (nonzero) and raw_z above it, no leveling required if ((planner.z_fade_height) && (planner.z_fade_height <= RAW_Z_POSITION(lz))) return; - lz += ubl.state.z_offset + ubl.get_z_correction(lx,ly) * ubl.fade_scaling_factor_for_z(lz); + lz += ubl.state.z_offset + ubl.get_z_correction(lx, ly) * ubl.fade_scaling_factor_for_z(lz); #else // no fade lz += ubl.state.z_offset + ubl.get_z_correction(lx,ly); #endif // FADE @@ -617,7 +617,7 @@ void Planner::check_axes_activity() { // so U==(L-O-M)/(1-M/H) for U= ( GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y )) { + if (repetition_cnt >= GRID_MAX_POINTS) { for ( uint8_t x = 0; x < GRID_MAX_POINTS_X; x++ ) { for ( uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++ ) { ubl.z_values[x][y] = ubl_constant; @@ -735,7 +735,7 @@ ubl.save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe DEPLOY_PROBE(); - uint16_t max_iterations = ( GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y ); + uint16_t max_iterations = GRID_MAX_POINTS; do { if (ubl_lcd_clicked()) { @@ -941,7 +941,7 @@ return thickness; } - void manually_probe_remaining_mesh(const float &lx, const float &ly, float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map) { + void manually_probe_remaining_mesh(const float &lx, const float &ly, const float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map) { ubl.has_control_of_lcd_panel = true; ubl.save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe @@ -956,14 +956,11 @@ if (location.x_index < 0 && location.y_index < 0) continue; const float rawx = pgm_read_float(&ubl.mesh_index_to_xpos[location.x_index]), - rawy = pgm_read_float(&ubl.mesh_index_to_ypos[location.y_index]); - - const float xProbe = LOGICAL_X_POSITION(rawx), + rawy = pgm_read_float(&ubl.mesh_index_to_ypos[location.y_index]), + xProbe = LOGICAL_X_POSITION(rawx), yProbe = LOGICAL_Y_POSITION(rawy); - if ( ! position_is_reachable_raw_xy( rawx, rawy )) { // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points) - break; - } + if (!position_is_reachable_raw_xy(rawx, rawy)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points) do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); @@ -1129,6 +1126,7 @@ SERIAL_PROTOCOLLNPGM("Invalid map type.\n"); return UBL_ERR; } + // Check if a map type was specified if (code_seen('M')) { // Warning! Use of 'M' flouts established standards. map_type = code_has_value() ? code_value_int() : 0; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index a398a4fda6..7a810d3e3a 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1674,13 +1674,13 @@ void kill_screen(const char* lcd_msg) { void _lcd_ubl_level_bed(); - int UBL_STORAGE_SLOT = 0; - int CUSTOM_BED_TEMP = 50; - int CUSTOM_HOTEND_TEMP = 190; - int SIDE_POINTS = 3; - int UBL_FILLIN_AMOUNT = 5; - int UBL_HEIGHT_AMOUNT; - int map_type; + int UBL_STORAGE_SLOT = 0, + CUSTOM_BED_TEMP = 50, + CUSTOM_HOTEND_TEMP = 190, + SIDE_POINTS = 3, + UBL_FILLIN_AMOUNT = 5, + UBL_HEIGHT_AMOUNT, + map_type; char UBL_LCD_GCODE [30]; @@ -1858,7 +1858,7 @@ void kill_screen(const char* lcd_msg) { * UBL Build Mesh submenu */ void _lcd_ubl_build_mesh() { - int GRID_NUM_POINTS = GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y ; + int GRID_NUM_POINTS = GRID_MAX_POINTS; START_MENU(); MENU_BACK(MSG_UBL_TOOLS); #if (WATCH_THE_BED)