diff --git a/.travis.yml b/.travis.yml index ffee170385..3bc79606dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -99,7 +99,7 @@ script: # Test a probeless build of AUTO_BED_LEVELING_UBL # - restore_configs - - opt_enable AUTO_BED_LEVELING_UBL UBL_G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT EEPROM_SETTINGS G3D_PANEL + - opt_enable AUTO_BED_LEVELING_UBL G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT EEPROM_SETTINGS G3D_PANEL - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING - build_marlin # @@ -128,7 +128,7 @@ script: # Test MESH_BED_LEVELING feature, with LCD # - restore_configs - - opt_enable MESH_BED_LEVELING MESH_G28_REST_ORIGIN LCD_BED_LEVELING ULTIMAKERCONTROLLER + - opt_enable MESH_BED_LEVELING G26_MESH_EDITING MESH_G28_REST_ORIGIN LCD_BED_LEVELING ULTIMAKERCONTROLLER - build_marlin # # Test MINIRAMBO for PWM_MOTOR_CURRENT @@ -142,7 +142,7 @@ script: # - restore_configs - opt_set MOTHERBOARD BOARD_MINIRAMBO - - opt_enable PROBE_MANUALLY AUTO_BED_LEVELING_BILINEAR LCD_BED_LEVELING ULTIMAKERCONTROLLER + - opt_enable PROBE_MANUALLY AUTO_BED_LEVELING_BILINEAR G26_MESH_EDITING LCD_BED_LEVELING ULTIMAKERCONTROLLER - opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT M100_FREE_MEMORY_WATCHER M100_FREE_MEMORY_DUMPER M100_FREE_MEMORY_CORRUPTOR INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT - opt_enable ULTIMAKERCONTROLLER SDSUPPORT - opt_enable PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE PCA9632 USE_XMAX_PLUG diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index eb9011aa3f..3e89f8b1e4 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -890,6 +890,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + #define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -956,13 +968,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - //#define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/G26_Mesh_Validation_Tool.cpp b/Marlin/G26_Mesh_Validation_Tool.cpp index f2907ac219..23dc19faf8 100644 --- a/Marlin/G26_Mesh_Validation_Tool.cpp +++ b/Marlin/G26_Mesh_Validation_Tool.cpp @@ -26,15 +26,21 @@ #include "MarlinConfig.h" -#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_VALIDATION) +#if ENABLED(G26_MESH_VALIDATION) - #include "ubl.h" #include "Marlin.h" #include "planner.h" #include "stepper.h" #include "temperature.h" #include "ultralcd.h" #include "gcode.h" + #include "bitmap_flags.h" + + #if ENABLED(MESH_BED_LEVELING) + #include "mesh_bed_leveling.h" + #elif ENABLED(AUTO_BED_LEVELING_UBL) + #include "ubl.h" + #endif #define EXTRUSION_MULTIPLIER 1.0 #define RETRACTION_MULTIPLIER 1.0 @@ -48,6 +54,9 @@ #error "SIZE_OF_CROSSHAIRS must be less than SIZE_OF_INTERSECTION_CIRCLES." #endif + #define G26_OK false + #define G26_ERR true + /** * G26 Mesh Validation Tool * @@ -133,10 +142,6 @@ void prepare_move_to_destination(); inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); } inline void set_current_from_destination() { COPY(current_position, destination); } - #if ENABLED(NEWPANEL) - void lcd_setstatusPGM(const char* const message, const int8_t level); - void chirp_at_user(); - #endif // Private functions @@ -147,41 +152,23 @@ static bool g26_retracted = false; // Track the retracted state of the nozzle so mismatched // retracts/recovers won't result in a bad state. - float valid_trig_angle(float); + static float g26_extrusion_multiplier, + g26_retraction_multiplier, + g26_layer_height, + g26_prime_length, + g26_x_pos, g26_y_pos; - float unified_bed_leveling::g26_extrusion_multiplier, - unified_bed_leveling::g26_retraction_multiplier, - unified_bed_leveling::g26_nozzle, - unified_bed_leveling::g26_filament_diameter, - unified_bed_leveling::g26_layer_height, - unified_bed_leveling::g26_prime_length, - unified_bed_leveling::g26_x_pos, - unified_bed_leveling::g26_y_pos, - unified_bed_leveling::g26_ooze_amount; + static int16_t g26_bed_temp, + g26_hotend_temp; - int16_t unified_bed_leveling::g26_bed_temp, - unified_bed_leveling::g26_hotend_temp; - - int8_t unified_bed_leveling::g26_prime_flag; - - bool unified_bed_leveling::g26_continue_with_closest, - unified_bed_leveling::g26_keep_heaters_on; - - int16_t unified_bed_leveling::g26_repeats; - - void unified_bed_leveling::G26_line_to_destination(const float &feed_rate) { - const float save_feedrate = feedrate_mm_s; - feedrate_mm_s = feed_rate; // use specified feed rate - prepare_move_to_destination(); // will ultimately call ubl.line_to_destination_cartesian or ubl.prepare_linear_move_to for UBL_DELTA - feedrate_mm_s = save_feedrate; // restore global feed rate - } + static int8_t g26_prime_flag; #if ENABLED(NEWPANEL) /** - * Detect ubl_lcd_clicked, debounce it, and return true for cancel + * Detect is_lcd_clicked, debounce it, and return true for cancel */ bool user_canceled() { - if (!ubl_lcd_clicked()) return false; + if (!is_lcd_clicked()) return false; safe_delay(10); // Wait for click to settle #if ENABLED(ULTRA_LCD) @@ -189,25 +176,392 @@ lcd_quick_feedback(); #endif - while (!ubl_lcd_clicked()) idle(); // Wait for button release + while (!is_lcd_clicked()) idle(); // Wait for button release // If the button is suddenly pressed again, // ask the user to resolve the issue lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear... - while (ubl_lcd_clicked()) idle(); // unless this loop happens + while (is_lcd_clicked()) idle(); // unless this loop happens lcd_reset_status(); return true; } #endif + #if ENABLED(NEWPANEL) + bool exit_from_g26() { + lcd_setstatusPGM(PSTR("Leaving G26"), -1); + while (is_lcd_clicked()) idle(); + return G26_ERR; + } + #endif + + void G26_line_to_destination(const float &feed_rate) { + const float save_feedrate = feedrate_mm_s; + feedrate_mm_s = feed_rate; // use specified feed rate + prepare_move_to_destination(); // will ultimately call ubl.line_to_destination_cartesian for UBL or ubl.prepare_linear_move_to for UBL_DELTA + feedrate_mm_s = save_feedrate; // restore global feed rate + } + + void move_to(const float &x, const float &y, const float &z, const float &e_delta) { + float feed_value; + static float last_z = -999.99; + + bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement. + + if (z != last_z) { + last_z = z; + feed_value = planner.max_feedrate_mm_s[Z_AXIS]/(3.0); // Base the feed rate off of the configured Z_AXIS feed rate + + destination[X_AXIS] = current_position[X_AXIS]; + destination[Y_AXIS] = current_position[Y_AXIS]; + destination[Z_AXIS] = z; // We know the last_z==z or we wouldn't be in this block of code. + destination[E_AXIS] = current_position[E_AXIS]; + + G26_line_to_destination(feed_value); + + stepper.synchronize(); + set_destination_from_current(); + } + + // Check if X or Y is involved in the movement. + // Yes: a 'normal' movement. No: a retract() or recover() + feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.max_feedrate_mm_s[E_AXIS] / 1.5; + + if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value); + + destination[X_AXIS] = x; + destination[Y_AXIS] = y; + destination[E_AXIS] += e_delta; + + G26_line_to_destination(feed_value); + + stepper.synchronize(); + set_destination_from_current(); + } + + FORCE_INLINE void move_to(const float where[XYZE], const float &de) { move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], de); } + + void retract_filament(const float where[XYZE]) { + if (!g26_retracted) { // Only retract if we are not already retracted! + g26_retracted = true; + move_to(where, -1.0 * g26_retraction_multiplier); + } + } + + void recover_filament(const float where[XYZE]) { + if (g26_retracted) { // Only un-retract if we are retracted. + move_to(where, 1.2 * g26_retraction_multiplier); + g26_retracted = false; + } + } + + /** + * Prime the nozzle if needed. Return true on error. + */ + inline bool prime_nozzle() { + + #if ENABLED(NEWPANEL) + float Total_Prime = 0.0; + + if (g26_prime_flag == -1) { // The user wants to control how much filament gets purged + + lcd_external_control = true; + lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99); + lcd_chirp(); + + set_destination_from_current(); + + recover_filament(destination); // Make sure G26 doesn't think the filament is retracted(). + + while (!is_lcd_clicked()) { + lcd_chirp(); + destination[E_AXIS] += 0.25; + #ifdef PREVENT_LENGTHY_EXTRUDE + Total_Prime += 0.25; + if (Total_Prime >= EXTRUDE_MAXLENGTH) return G26_ERR; + #endif + G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0); + + stepper.synchronize(); // Without this synchronize, the purge is more consistent, + // but because the planner has a buffer, we won't be able + // to stop as quickly. So we put up with the less smooth + // action to give the user a more responsive 'Stop'. + set_destination_from_current(); + idle(); + } + + while (is_lcd_clicked()) idle(); // Debounce Encoder Wheel + + #if ENABLED(ULTRA_LCD) + strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue; + // So... We cheat to get a message up. + lcd_setstatusPGM(PSTR("Done Priming"), 99); + lcd_quick_feedback(); + lcd_external_control = false; + #endif + } + else + #endif + { + #if ENABLED(ULTRA_LCD) + lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99); + lcd_quick_feedback(); + #endif + set_destination_from_current(); + destination[E_AXIS] += g26_prime_length; + G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0); + stepper.synchronize(); + set_destination_from_current(); + retract_filament(destination); + } + + return G26_OK; + } + + mesh_index_pair find_closest_circle_to_print(const float &X, const float &Y) { + float closest = 99999.99; + mesh_index_pair return_val; + + return_val.x_index = return_val.y_index = -1; + + for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { + for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) { + if (!is_bit_set(circle_flags, i, j)) { + const float mx = _GET_MESH_X(i), // We found a circle that needs to be printed + my = _GET_MESH_Y(j); + + // Get the distance to this intersection + float f = HYPOT(X - mx, Y - my); + + // It is possible that we are being called with the values + // to let us find the closest circle to the start position. + // But if this is not the case, add a small weighting to the + // distance calculation to help it choose a better place to continue. + f += HYPOT(g26_x_pos - mx, g26_y_pos - my) / 15.0; + + // Add in the specified amount of Random Noise to our search + if (random_deviation > 1.0) + f += random(0.0, random_deviation); + + if (f < closest) { + closest = f; // We found a closer location that is still + return_val.x_index = i; // un-printed --- save the data for it + return_val.y_index = j; + return_val.distance = closest; + } + } + } + } + bit_set(circle_flags, return_val.x_index, return_val.y_index); // Mark this location as done. + return return_val; + } + + /** + * print_line_from_here_to_there() takes two cartesian coordinates and draws a line from one + * to the other. But there are really three sets of coordinates involved. The first coordinate + * is the present location of the nozzle. We don't necessarily want to print from this location. + * We first need to move the nozzle to the start of line segment where we want to print. Once + * there, we can use the two coordinates supplied to draw the line. + * + * Note: Although we assume the first set of coordinates is the start of the line and the second + * set of coordinates is the end of the line, it does not always work out that way. This function + * optimizes the movement to minimize the travel distance before it can start printing. This saves + * a lot of time and eliminates a lot of nonsensical movement of the nozzle. However, it does + * cause a lot of very little short retracement of th nozzle when it draws the very first line + * segment of a 'circle'. The time this requires is very short and is easily saved by the other + * cases where the optimization comes into play. + */ + void print_line_from_here_to_there(const float &sx, const float &sy, const float &sz, const float &ex, const float &ey, const float &ez) { + const float dx_s = current_position[X_AXIS] - sx, // find our distance from the start of the actual line segment + dy_s = current_position[Y_AXIS] - sy, + dist_start = HYPOT2(dx_s, dy_s), // We don't need to do a sqrt(), we can compare the distance^2 + // to save computation time + dx_e = current_position[X_AXIS] - ex, // find our distance from the end of the actual line segment + dy_e = current_position[Y_AXIS] - ey, + dist_end = HYPOT2(dx_e, dy_e), + + line_length = HYPOT(ex - sx, ey - sy); + + // If the end point of the line is closer to the nozzle, flip the direction, + // moving from the end to the start. On very small lines the optimization isn't worth it. + if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length)) + return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz); + + // Decide whether to retract & bump + + if (dist_start > 2.0) { + retract_filament(destination); + //todo: parameterize the bump height with a define + move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + 0.500, 0.0); // Z bump to minimize scraping + move_to(sx, sy, sz + 0.500, 0.0); // Get to the starting point with no extrusion while bumped + } + + move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion / un-Z bump + + const float e_pos_delta = line_length * g26_e_axis_feedrate * g26_extrusion_multiplier; + + recover_filament(destination); + move_to(ex, ey, ez, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion + } + + inline bool look_for_lines_to_connect() { + float sx, sy, ex, ey; + + for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { + for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) { + + #if ENABLED(NEWPANEL) + if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation + #endif + + if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X. + // This is already a half circle because we are at the edge of the bed. + + if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i + 1, j)) { // check if we can do a line to the left + if (!is_bit_set(horizontal_mesh_line_flags, i, j)) { + + // + // We found two circles that need a horizontal line to connect them + // Print it! + // + sx = _GET_MESH_X( i ) + (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // right edge + ex = _GET_MESH_X(i + 1) - (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // left edge + + sx = constrain(sx, X_MIN_POS + 1, X_MAX_POS - 1); + sy = ey = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1); + ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1); + + if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) { + + if (g26_debug_flag) { + SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx); + SERIAL_ECHOPAIR(", sy=", sy); + SERIAL_ECHOPAIR(") -> (ex=", ex); + SERIAL_ECHOPAIR(", ey=", ey); + SERIAL_CHAR(')'); + SERIAL_EOL(); + //debug_current_and_destination(PSTR("Connecting horizontal line.")); + } + print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height); + } + bit_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it + } + } + + if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y. + // This is already a half circle because we are at the edge of the bed. + + if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i, j + 1)) { // check if we can do a line straight down + if (!is_bit_set( vertical_mesh_line_flags, i, j)) { + // + // We found two circles that need a vertical line to connect them + // Print it! + // + sy = _GET_MESH_Y( j ) + (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // top edge + ey = _GET_MESH_Y(j + 1) - (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // bottom edge + + sx = ex = constrain(_GET_MESH_X(i), X_MIN_POS + 1, X_MAX_POS - 1); + sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1); + ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1); + + if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) { + + if (g26_debug_flag) { + SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx); + SERIAL_ECHOPAIR(", sy=", sy); + SERIAL_ECHOPAIR(") -> (ex=", ex); + SERIAL_ECHOPAIR(", ey=", ey); + SERIAL_CHAR(')'); + SERIAL_EOL(); + + #if ENABLED(AUTO_BED_LEVELING_UBL) + debug_current_and_destination(PSTR("Connecting vertical line.")); + #endif + } + print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height); + } + bit_set(vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if skipped + } + } + } + } + } + } + return false; + } + + float valid_trig_angle(float d) { + while (d > 360.0) d -= 360.0; + while (d < 0.0) d += 360.0; + return d; + } + + /** + * Turn on the bed and nozzle heat and + * wait for them to get up to temperature. + */ + bool turn_on_heaters() { + millis_t next = millis() + 5000UL; + #if HAS_TEMP_BED + #if ENABLED(ULTRA_LCD) + if (g26_bed_temp > 25) { + lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99); + lcd_quick_feedback(); + lcd_external_control = true; + #endif + thermalManager.setTargetBed(g26_bed_temp); + while (abs(thermalManager.degBed() - g26_bed_temp) > 3) { + + #if ENABLED(NEWPANEL) + if (is_lcd_clicked()) return exit_from_g26(); + #endif + + if (ELAPSED(millis(), next)) { + next = millis() + 5000UL; + print_heaterstates(); + SERIAL_EOL(); + } + idle(); + } + #if ENABLED(ULTRA_LCD) + } + lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99); + lcd_quick_feedback(); + #endif + #endif + + // Start heating the nozzle and wait for it to reach temperature. + thermalManager.setTargetHotend(g26_hotend_temp, 0); + while (abs(thermalManager.degHotend(0) - g26_hotend_temp) > 3) { + + #if ENABLED(NEWPANEL) + if (is_lcd_clicked()) return exit_from_g26(); + #endif + + if (ELAPSED(millis(), next)) { + next = millis() + 5000UL; + print_heaterstates(); + SERIAL_EOL(); + } + idle(); + } + + #if ENABLED(ULTRA_LCD) + lcd_reset_status(); + lcd_quick_feedback(); + #endif + + return G26_OK; + } + /** * G26: Mesh Validation Pattern generation. * * Used to interactively edit UBL's Mesh by placing the * nozzle in a problem area and doing a G29 P4 R command. */ - void unified_bed_leveling::G26() { + void gcode_G26() { SERIAL_ECHOLNPGM("G26 command started. Waiting for heater(s)."); float tmp, start_angle, end_angle; int i, xi, yi; @@ -215,7 +569,134 @@ // Don't allow Mesh Validation without homing first, // or if the parameter parsing did not go OK, abort - if (axis_unhomed_error() || parse_G26_parameters()) return; + if (axis_unhomed_error()) return; + + g26_extrusion_multiplier = EXTRUSION_MULTIPLIER; + g26_retraction_multiplier = RETRACTION_MULTIPLIER; + g26_layer_height = MESH_TEST_LAYER_HEIGHT; + g26_prime_length = PRIME_LENGTH; + g26_bed_temp = MESH_TEST_BED_TEMP; + g26_hotend_temp = MESH_TEST_HOTEND_TEMP; + g26_prime_flag = 0; + + float g26_nozzle = MESH_TEST_NOZZLE_SIZE, + g26_filament_diameter = DEFAULT_NOMINAL_FILAMENT_DIA, + g26_ooze_amount = parser.linearval('O', OOZE_AMOUNT); + + bool g26_continue_with_closest = parser.boolval('C'), + g26_keep_heaters_on = parser.boolval('K'); + + if (parser.seenval('B')) { + g26_bed_temp = parser.value_celsius(); + if (!WITHIN(g26_bed_temp, 15, 140)) { + SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible."); + return G26_ERR; + } + } + + if (parser.seenval('L')) { + g26_layer_height = parser.value_linear_units(); + if (!WITHIN(g26_layer_height, 0.0, 2.0)) { + SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible."); + return G26_ERR; + } + } + + if (parser.seen('Q')) { + if (parser.has_value()) { + g26_retraction_multiplier = parser.value_float(); + if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) { + SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible."); + return G26_ERR; + } + } + else { + SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified."); + return G26_ERR; + } + } + + if (parser.seenval('S')) { + g26_nozzle = parser.value_float(); + if (!WITHIN(g26_nozzle, 0.1, 1.0)) { + SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible."); + return G26_ERR; + } + } + + if (parser.seen('P')) { + if (!parser.has_value()) { + #if ENABLED(NEWPANEL) + g26_prime_flag = -1; + #else + SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD."); + return G26_ERR; + #endif + } + else { + g26_prime_flag++; + g26_prime_length = parser.value_linear_units(); + if (!WITHIN(g26_prime_length, 0.0, 25.0)) { + SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible."); + return G26_ERR; + } + } + } + + if (parser.seenval('F')) { + g26_filament_diameter = parser.value_linear_units(); + if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) { + SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible."); + return G26_ERR; + } + } + g26_extrusion_multiplier *= sq(1.75) / sq(g26_filament_diameter); // If we aren't using 1.75mm filament, we need to + // scale up or down the length needed to get the + // same volume of filament + + g26_extrusion_multiplier *= g26_filament_diameter * sq(g26_nozzle) / sq(0.3); // Scale up by nozzle size + + if (parser.seenval('H')) { + g26_hotend_temp = parser.value_celsius(); + if (!WITHIN(g26_hotend_temp, 165, 280)) { + SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible."); + return G26_ERR; + } + } + + if (parser.seen('U')) { + randomSeed(millis()); + // This setting will persist for the next G26 + random_deviation = parser.has_value() ? parser.value_float() : 50.0; + } + + int16_t g26_repeats; + #if ENABLED(NEWPANEL) + g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1); + #else + if (!parser.seen('R')) { + SERIAL_PROTOCOLLNPGM("?(R)epeat must be specified when not using an LCD."); + return G26_ERR; + } + else + g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1; + #endif + if (g26_repeats < 1) { + SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be at least 1."); + return G26_ERR; + } + + g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS]; + g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS]; + if (!position_is_reachable(g26_x_pos, g26_y_pos)) { + SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds."); + return G26_ERR; + } + + /** + * Wait until all parameters are verified before altering the state! + */ + set_bed_leveling_enabled(!parser.seen('D')); if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) { do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); @@ -250,7 +731,10 @@ move_to(destination, 0.0); move_to(destination, g26_ooze_amount); - has_control_of_lcd_panel = true; + #if ENABLED(ULTRA_LCD) + lcd_external_control = true; + #endif + //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern.")); /** @@ -269,8 +753,8 @@ : find_closest_circle_to_print(g26_x_pos, g26_y_pos); // Find the closest Mesh Intersection to where we are now. if (location.x_index >= 0 && location.y_index >= 0) { - const float circle_x = mesh_index_to_xpos(location.x_index), - circle_y = mesh_index_to_ypos(location.y_index); + const float circle_x = _GET_MESH_X(location.x_index), + circle_y = _GET_MESH_Y(location.y_index); // If this mesh location is outside the printable_radius, skip it. @@ -366,14 +850,16 @@ move_to(destination, 0); // Raise the nozzle //debug_current_and_destination(PSTR("done doing Z-Raise.")); - destination[X_AXIS] = g26_x_pos; // Move back to the starting position + destination[X_AXIS] = g26_x_pos; // Move back to the starting position destination[Y_AXIS] = g26_y_pos; - //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is + //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is move_to(destination, 0); // Move back to the starting position //debug_current_and_destination(PSTR("done doing X/Y move.")); - has_control_of_lcd_panel = false; // Give back control of the LCD Panel! + #if ENABLED(ULTRA_LCD) + lcd_external_control = false; // Give back control of the LCD Panel! + #endif if (!g26_keep_heaters_on) { #if HAS_TEMP_BED @@ -383,498 +869,4 @@ } } - float valid_trig_angle(float d) { - while (d > 360.0) d -= 360.0; - while (d < 0.0) d += 360.0; - return d; - } - - mesh_index_pair unified_bed_leveling::find_closest_circle_to_print(const float &X, const float &Y) { - float closest = 99999.99; - mesh_index_pair return_val; - - return_val.x_index = return_val.y_index = -1; - - for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { - for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) { - if (!is_bit_set(circle_flags, i, j)) { - const float mx = mesh_index_to_xpos(i), // We found a circle that needs to be printed - my = mesh_index_to_ypos(j); - - // Get the distance to this intersection - float f = HYPOT(X - mx, Y - my); - - // It is possible that we are being called with the values - // to let us find the closest circle to the start position. - // But if this is not the case, add a small weighting to the - // distance calculation to help it choose a better place to continue. - f += HYPOT(g26_x_pos - mx, g26_y_pos - my) / 15.0; - - // Add in the specified amount of Random Noise to our search - if (random_deviation > 1.0) - f += random(0.0, random_deviation); - - if (f < closest) { - closest = f; // We found a closer location that is still - return_val.x_index = i; // un-printed --- save the data for it - return_val.y_index = j; - return_val.distance = closest; - } - } - } - } - bit_set(circle_flags, return_val.x_index, return_val.y_index); // Mark this location as done. - return return_val; - } - - bool unified_bed_leveling::look_for_lines_to_connect() { - float sx, sy, ex, ey; - - for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { - for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) { - - #if ENABLED(NEWPANEL) - if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation - #endif - - if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X. - // This is already a half circle because we are at the edge of the bed. - - if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i + 1, j)) { // check if we can do a line to the left - if (!is_bit_set(horizontal_mesh_line_flags, i, j)) { - - // - // We found two circles that need a horizontal line to connect them - // Print it! - // - sx = mesh_index_to_xpos( i ) + (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // right edge - ex = mesh_index_to_xpos(i + 1) - (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // left edge - - sx = constrain(sx, X_MIN_POS + 1, X_MAX_POS - 1); - sy = ey = constrain(mesh_index_to_ypos(j), Y_MIN_POS + 1, Y_MAX_POS - 1); - ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1); - - if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) { - - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx); - SERIAL_ECHOPAIR(", sy=", sy); - SERIAL_ECHOPAIR(") -> (ex=", ex); - SERIAL_ECHOPAIR(", ey=", ey); - SERIAL_CHAR(')'); - SERIAL_EOL(); - //debug_current_and_destination(PSTR("Connecting horizontal line.")); - } - print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height); - } - bit_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it - } - } - - if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y. - // This is already a half circle because we are at the edge of the bed. - - if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i, j + 1)) { // check if we can do a line straight down - if (!is_bit_set( vertical_mesh_line_flags, i, j)) { - // - // We found two circles that need a vertical line to connect them - // Print it! - // - sy = mesh_index_to_ypos( j ) + (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // top edge - ey = mesh_index_to_ypos(j + 1) - (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // bottom edge - - sx = ex = constrain(mesh_index_to_xpos(i), X_MIN_POS + 1, X_MAX_POS - 1); - sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1); - ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1); - - if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) { - - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx); - SERIAL_ECHOPAIR(", sy=", sy); - SERIAL_ECHOPAIR(") -> (ex=", ex); - SERIAL_ECHOPAIR(", ey=", ey); - SERIAL_CHAR(')'); - SERIAL_EOL(); - debug_current_and_destination(PSTR("Connecting vertical line.")); - } - print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height); - } - bit_set(vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if skipped - } - } - } - } - } - } - return false; - } - - void unified_bed_leveling::move_to(const float &x, const float &y, const float &z, const float &e_delta) { - float feed_value; - static float last_z = -999.99; - - bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement. - - if (z != last_z) { - last_z = z; - feed_value = planner.max_feedrate_mm_s[Z_AXIS]/(3.0); // Base the feed rate off of the configured Z_AXIS feed rate - - destination[X_AXIS] = current_position[X_AXIS]; - destination[Y_AXIS] = current_position[Y_AXIS]; - destination[Z_AXIS] = z; // We know the last_z==z or we wouldn't be in this block of code. - destination[E_AXIS] = current_position[E_AXIS]; - - G26_line_to_destination(feed_value); - - stepper.synchronize(); - set_destination_from_current(); - } - - // Check if X or Y is involved in the movement. - // Yes: a 'normal' movement. No: a retract() or recover() - feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.max_feedrate_mm_s[E_AXIS] / 1.5; - - if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value); - - destination[X_AXIS] = x; - destination[Y_AXIS] = y; - destination[E_AXIS] += e_delta; - - G26_line_to_destination(feed_value); - - stepper.synchronize(); - set_destination_from_current(); - - } - - void unified_bed_leveling::retract_filament(const float where[XYZE]) { - if (!g26_retracted) { // Only retract if we are not already retracted! - g26_retracted = true; - move_to(where, -1.0 * g26_retraction_multiplier); - } - } - - void unified_bed_leveling::recover_filament(const float where[XYZE]) { - if (g26_retracted) { // Only un-retract if we are retracted. - move_to(where, 1.2 * g26_retraction_multiplier); - g26_retracted = false; - } - } - - /** - * print_line_from_here_to_there() takes two cartesian coordinates and draws a line from one - * to the other. But there are really three sets of coordinates involved. The first coordinate - * is the present location of the nozzle. We don't necessarily want to print from this location. - * We first need to move the nozzle to the start of line segment where we want to print. Once - * there, we can use the two coordinates supplied to draw the line. - * - * Note: Although we assume the first set of coordinates is the start of the line and the second - * set of coordinates is the end of the line, it does not always work out that way. This function - * optimizes the movement to minimize the travel distance before it can start printing. This saves - * a lot of time and eliminates a lot of nonsensical movement of the nozzle. However, it does - * cause a lot of very little short retracement of th nozzle when it draws the very first line - * segment of a 'circle'. The time this requires is very short and is easily saved by the other - * cases where the optimization comes into play. - */ - void unified_bed_leveling::print_line_from_here_to_there(const float &sx, const float &sy, const float &sz, const float &ex, const float &ey, const float &ez) { - const float dx_s = current_position[X_AXIS] - sx, // find our distance from the start of the actual line segment - dy_s = current_position[Y_AXIS] - sy, - dist_start = HYPOT2(dx_s, dy_s), // We don't need to do a sqrt(), we can compare the distance^2 - // to save computation time - dx_e = current_position[X_AXIS] - ex, // find our distance from the end of the actual line segment - dy_e = current_position[Y_AXIS] - ey, - dist_end = HYPOT2(dx_e, dy_e), - - line_length = HYPOT(ex - sx, ey - sy); - - // If the end point of the line is closer to the nozzle, flip the direction, - // moving from the end to the start. On very small lines the optimization isn't worth it. - if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length)) - return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz); - - // Decide whether to retract & bump - - if (dist_start > 2.0) { - retract_filament(destination); - //todo: parameterize the bump height with a define - move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + 0.500, 0.0); // Z bump to minimize scraping - move_to(sx, sy, sz + 0.500, 0.0); // Get to the starting point with no extrusion while bumped - } - - move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion / un-Z bump - - const float e_pos_delta = line_length * g26_e_axis_feedrate * g26_extrusion_multiplier; - - recover_filament(destination); - move_to(ex, ey, ez, e_pos_delta); // Get to the ending point with an appropriate amount of extrusion - } - - /** - * This function used to be inline code in G26. But there are so many - * parameters it made sense to turn them into static globals and get - * this code out of sight of the main routine. - */ - bool unified_bed_leveling::parse_G26_parameters() { - - g26_extrusion_multiplier = EXTRUSION_MULTIPLIER; - g26_retraction_multiplier = RETRACTION_MULTIPLIER; - g26_nozzle = MESH_TEST_NOZZLE_SIZE; - g26_filament_diameter = DEFAULT_NOMINAL_FILAMENT_DIA; - g26_layer_height = MESH_TEST_LAYER_HEIGHT; - g26_prime_length = PRIME_LENGTH; - g26_bed_temp = MESH_TEST_BED_TEMP; - g26_hotend_temp = MESH_TEST_HOTEND_TEMP; - g26_prime_flag = 0; - - g26_ooze_amount = parser.linearval('O', OOZE_AMOUNT); - g26_keep_heaters_on = parser.boolval('K'); - g26_continue_with_closest = parser.boolval('C'); - - if (parser.seenval('B')) { - g26_bed_temp = parser.value_celsius(); - if (!WITHIN(g26_bed_temp, 15, 140)) { - SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible."); - return UBL_ERR; - } - } - - if (parser.seenval('L')) { - g26_layer_height = parser.value_linear_units(); - if (!WITHIN(g26_layer_height, 0.0, 2.0)) { - SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible."); - return UBL_ERR; - } - } - - if (parser.seen('Q')) { - if (parser.has_value()) { - g26_retraction_multiplier = parser.value_float(); - if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) { - SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible."); - return UBL_ERR; - } - } - else { - SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified."); - return UBL_ERR; - } - } - - if (parser.seenval('S')) { - g26_nozzle = parser.value_float(); - if (!WITHIN(g26_nozzle, 0.1, 1.0)) { - SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible."); - return UBL_ERR; - } - } - - if (parser.seen('P')) { - if (!parser.has_value()) { - #if ENABLED(NEWPANEL) - g26_prime_flag = -1; - #else - SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD."); - return UBL_ERR; - #endif - } - else { - g26_prime_flag++; - g26_prime_length = parser.value_linear_units(); - if (!WITHIN(g26_prime_length, 0.0, 25.0)) { - SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible."); - return UBL_ERR; - } - } - } - - if (parser.seenval('F')) { - g26_filament_diameter = parser.value_linear_units(); - if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) { - SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible."); - return UBL_ERR; - } - } - g26_extrusion_multiplier *= sq(1.75) / sq(g26_filament_diameter); // If we aren't using 1.75mm filament, we need to - // scale up or down the length needed to get the - // same volume of filament - - g26_extrusion_multiplier *= g26_filament_diameter * sq(g26_nozzle) / sq(0.3); // Scale up by nozzle size - - if (parser.seenval('H')) { - g26_hotend_temp = parser.value_celsius(); - if (!WITHIN(g26_hotend_temp, 165, 280)) { - SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible."); - return UBL_ERR; - } - } - - if (parser.seen('U')) { - randomSeed(millis()); - // This setting will persist for the next G26 - random_deviation = parser.has_value() ? parser.value_float() : 50.0; - } - - #if ENABLED(NEWPANEL) - g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1); - #else - if (!parser.seen('R')) { - SERIAL_PROTOCOLLNPGM("?(R)epeat must be specified when not using an LCD."); - return UBL_ERR; - } - else - g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1; - #endif - if (g26_repeats < 1) { - SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be at least 1."); - return UBL_ERR; - } - - g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS]; - g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS]; - if (!position_is_reachable(g26_x_pos, g26_y_pos)) { - SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds."); - return UBL_ERR; - } - - /** - * Wait until all parameters are verified before altering the state! - */ - set_bed_leveling_enabled(!parser.seen('D')); - - return UBL_OK; - } - - #if ENABLED(NEWPANEL) - bool unified_bed_leveling::exit_from_g26() { - lcd_setstatusPGM(PSTR("Leaving G26"), -1); - while (ubl_lcd_clicked()) idle(); - return UBL_ERR; - } - #endif - - /** - * Turn on the bed and nozzle heat and - * wait for them to get up to temperature. - */ - bool unified_bed_leveling::turn_on_heaters() { - millis_t next = millis() + 5000UL; - #if HAS_TEMP_BED - #if ENABLED(ULTRA_LCD) - if (g26_bed_temp > 25) { - lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99); - lcd_quick_feedback(); - #endif - has_control_of_lcd_panel = true; - thermalManager.setTargetBed(g26_bed_temp); - while (abs(thermalManager.degBed() - g26_bed_temp) > 3) { - - #if ENABLED(NEWPANEL) - if (ubl_lcd_clicked()) return exit_from_g26(); - #endif - - if (ELAPSED(millis(), next)) { - next = millis() + 5000UL; - print_heaterstates(); - SERIAL_EOL(); - } - idle(); - } - #if ENABLED(ULTRA_LCD) - } - lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99); - lcd_quick_feedback(); - #endif - #endif - - // Start heating the nozzle and wait for it to reach temperature. - thermalManager.setTargetHotend(g26_hotend_temp, 0); - while (abs(thermalManager.degHotend(0) - g26_hotend_temp) > 3) { - - #if ENABLED(NEWPANEL) - if (ubl_lcd_clicked()) return exit_from_g26(); - #endif - - if (ELAPSED(millis(), next)) { - next = millis() + 5000UL; - print_heaterstates(); - SERIAL_EOL(); - } - idle(); - } - - #if ENABLED(ULTRA_LCD) - lcd_reset_status(); - lcd_quick_feedback(); - #endif - - return UBL_OK; - } - - /** - * Prime the nozzle if needed. Return true on error. - */ - bool unified_bed_leveling::prime_nozzle() { - - #if ENABLED(NEWPANEL) - float Total_Prime = 0.0; - - if (g26_prime_flag == -1) { // The user wants to control how much filament gets purged - - has_control_of_lcd_panel = true; - lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99); - chirp_at_user(); - - set_destination_from_current(); - - recover_filament(destination); // Make sure G26 doesn't think the filament is retracted(). - - while (!ubl_lcd_clicked()) { - chirp_at_user(); - destination[E_AXIS] += 0.25; - #ifdef PREVENT_LENGTHY_EXTRUDE - Total_Prime += 0.25; - if (Total_Prime >= EXTRUDE_MAXLENGTH) return UBL_ERR; - #endif - G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0); - - stepper.synchronize(); // Without this synchronize, the purge is more consistent, - // but because the planner has a buffer, we won't be able - // to stop as quickly. So we put up with the less smooth - // action to give the user a more responsive 'Stop'. - set_destination_from_current(); - idle(); - } - - while (ubl_lcd_clicked()) idle(); // Debounce Encoder Wheel - - #if ENABLED(ULTRA_LCD) - strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue; - // So... We cheat to get a message up. - lcd_setstatusPGM(PSTR("Done Priming"), 99); - lcd_quick_feedback(); - #endif - - has_control_of_lcd_panel = false; - - } - else { - #else - { - #endif - #if ENABLED(ULTRA_LCD) - lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99); - lcd_quick_feedback(); - #endif - set_destination_from_current(); - destination[E_AXIS] += g26_prime_length; - G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0); - stepper.synchronize(); - set_destination_from_current(); - retract_filament(destination); - } - - return UBL_OK; - } - -#endif // AUTO_BED_LEVELING_UBL && UBL_G26_MESH_VALIDATION +#endif // G26_MESH_VALIDATION diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 9063ab86ae..9035f08b4a 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -311,6 +311,23 @@ void report_current_position(); void forward_kinematics_SCARA(const float &a, const float &b); #endif +#if ENABLED(G26_MESH_VALIDATION) + extern bool g26_debug_flag; +#elif ENABLED(AUTO_BED_LEVELING_UBL) + constexpr bool g26_debug_flag = false; +#endif + +#if ENABLED(AUTO_BED_LEVELING_BILINEAR) + #define _GET_MESH_X(I) bilinear_start[X_AXIS] + I * bilinear_grid_spacing[X_AXIS] + #define _GET_MESH_Y(J) bilinear_start[Y_AXIS] + J * bilinear_grid_spacing[Y_AXIS] +#elif ENABLED(AUTO_BED_LEVELING_UBL) + #define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I) + #define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J) +#elif ENABLED(MESH_BED_LEVELING) + #define _GET_MESH_X(I) mbl.index_to_xpos[I] + #define _GET_MESH_Y(J) mbl.index_to_ypos[J] +#endif + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) extern int bilinear_grid_spacing[2], bilinear_start[2]; extern float bilinear_grid_factor[2], diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 0159db0b7e..939fce6018 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -59,7 +59,7 @@ * G19 - Select Plane YZ (Requires CNC_WORKSPACE_PLANES) * G20 - Set input units to inches (Requires INCH_MODE_SUPPORT) * G21 - Set input units to millimeters (Requires INCH_MODE_SUPPORT) - * G26 - Mesh Validation Pattern (Requires UBL_G26_MESH_VALIDATION) + * G26 - Mesh Validation Pattern (Requires G26_MESH_VALIDATION) * G27 - Park Nozzle (Requires NOZZLE_PARK_FEATURE) * G28 - Home one or more axes * G29 - Start or continue the bed leveling probe procedure (Requires bed leveling) @@ -326,6 +326,11 @@ void M100_dump_routine(const char * const title, const char *start, const char *end); #endif +#if ENABLED(G26_MESH_VALIDATION) + bool g26_debug_flag; // =false + void gcode_G26(); +#endif + #if ENABLED(SDSUPPORT) CardReader card; #endif @@ -6197,17 +6202,6 @@ void home_all_axes() { gcode_G28(true); } return; } - #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - #define _GET_MESH_X(I) bilinear_start[X_AXIS] + I * bilinear_grid_spacing[X_AXIS] - #define _GET_MESH_Y(J) bilinear_start[Y_AXIS] + J * bilinear_grid_spacing[Y_AXIS] - #elif ENABLED(AUTO_BED_LEVELING_UBL) - #define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I) - #define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J) - #elif ENABLED(MESH_BED_LEVELING) - #define _GET_MESH_X(I) mbl.index_to_xpos[I] - #define _GET_MESH_Y(J) mbl.index_to_ypos[J] - #endif - set_destination_from_current(); if (hasI) destination[X_AXIS] = _GET_MESH_X(ix); if (hasJ) destination[Y_AXIS] = _GET_MESH_Y(iy); @@ -7567,15 +7561,15 @@ inline void gcode_M42() { #endif // Z_MIN_PROBE_REPEATABILITY_TEST -#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_VALIDATION) +#if ENABLED(G26_MESH_VALIDATION) inline void gcode_M49() { - ubl.g26_debug_flag ^= true; - SERIAL_PROTOCOLPGM("UBL Debug Flag turned "); - serialprintPGM(ubl.g26_debug_flag ? PSTR("on.") : PSTR("off.")); + g26_debug_flag ^= true; + SERIAL_PROTOCOLPGM("G26 Debug "); + serialprintPGM(g26_debug_flag ? PSTR("on.") : PSTR("off.")); } -#endif // AUTO_BED_LEVELING_UBL && UBL_G26_MESH_VALIDATION +#endif // G26_MESH_VALIDATION #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) /** @@ -11295,11 +11289,11 @@ void process_parsed_command() { break; #endif // INCH_MODE_SUPPORT - #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_VALIDATION) + #if ENABLED(G26_MESH_VALIDATION) case 26: // G26: Mesh Validation Pattern generation gcode_G26(); break; - #endif // AUTO_BED_LEVELING_UBL + #endif // G26_MESH_VALIDATION #if ENABLED(NOZZLE_PARK_FEATURE) case 27: // G27: Nozzle Park @@ -11459,11 +11453,11 @@ void process_parsed_command() { break; #endif // Z_MIN_PROBE_REPEATABILITY_TEST - #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_VALIDATION) + #if ENABLED(G26_MESH_VALIDATION) case 49: // M49: Turn on or off G26 debug flag for verbose output gcode_M49(); break; - #endif // AUTO_BED_LEVELING_UBL && UBL_G26_MESH_VALIDATION + #endif // G26_MESH_VALIDATION #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) case 73: // M73: Set print progress percentage diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index d2988c3343..b40686a4f7 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -180,10 +180,12 @@ #error "MESH_NUM_[XY]_POINTS is now GRID_MAX_POINTS_[XY]. Please update your configuration." #elif defined(UBL_MESH_NUM_X_POINTS) || defined(UBL_MESH_NUM_Y_POINTS) #error "UBL_MESH_NUM_[XY]_POINTS is now GRID_MAX_POINTS_[XY]. Please update your configuration." +#elif defined(UBL_G26_MESH_VALIDATION) + #error "UBL_G26_MESH_VALIDATION is now G26_MESH_VALIDATION. Please update your configuration." #elif defined(UBL_MESH_EDIT_ENABLED) - #error "UBL_MESH_EDIT_ENABLED is now UBL_G26_MESH_VALIDATION. Please update your configuration." + #error "UBL_MESH_EDIT_ENABLED is now G26_MESH_VALIDATION. Please update your configuration." #elif defined(UBL_MESH_EDITING) - #error "UBL_MESH_EDITING is now UBL_G26_MESH_VALIDATION. Please update your configuration." + #error "UBL_MESH_EDITING is now G26_MESH_VALIDATION. Please update your configuration." #elif defined(BLTOUCH_HEATERS_OFF) #error "BLTOUCH_HEATERS_OFF is now PROBING_HEATERS_OFF. Please update your configuration." #elif defined(BEEPER) @@ -804,6 +806,10 @@ static_assert(1 >= 0 #endif +#if !HAS_MESH && ENABLED(G26_MESH_VALIDATION) + #error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL." +#endif + /** * LCD_BED_LEVELING requirements */ diff --git a/Marlin/bitmap_flags.h b/Marlin/bitmap_flags.h new file mode 100644 index 0000000000..67cd97bf0b --- /dev/null +++ b/Marlin/bitmap_flags.h @@ -0,0 +1,38 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifndef _BITMAP_FLAGS_H_ +#define _BITMAP_FLAGS_H_ + +#include "macros.h" + +/** + * These support functions allow the use of large bit arrays of flags that take very + * little RAM. Currently they are limited to being 16x16 in size. Changing the declaration + * to unsigned long will allow us to go to 32x32 if higher resolution meshes are needed + * in the future. + */ +FORCE_INLINE void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y) { CBI(bits[y], x); } +FORCE_INLINE void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { SBI(bits[y], x); } +FORCE_INLINE bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); } + +#endif // _BITMAP_FLAGS_H_ diff --git a/Marlin/example_configurations/AlephObjects/TAZ4/Configuration.h b/Marlin/example_configurations/AlephObjects/TAZ4/Configuration.h index c93085165f..1dc16ed503 100644 --- a/Marlin/example_configurations/AlephObjects/TAZ4/Configuration.h +++ b/Marlin/example_configurations/AlephObjects/TAZ4/Configuration.h @@ -910,6 +910,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -976,13 +988,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/AliExpress/CL-260/Configuration.h b/Marlin/example_configurations/AliExpress/CL-260/Configuration.h index df21f7b5b7..fbd7acd59b 100644 --- a/Marlin/example_configurations/AliExpress/CL-260/Configuration.h +++ b/Marlin/example_configurations/AliExpress/CL-260/Configuration.h @@ -890,6 +890,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -956,13 +968,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Anet/A6/Configuration.h b/Marlin/example_configurations/Anet/A6/Configuration.h index 83ead84b49..2dd2f75198 100644 --- a/Marlin/example_configurations/Anet/A6/Configuration.h +++ b/Marlin/example_configurations/Anet/A6/Configuration.h @@ -1009,6 +1009,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1099,13 +1111,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Anet/A8/Configuration.h b/Marlin/example_configurations/Anet/A8/Configuration.h index 5704aa006d..c463f13461 100644 --- a/Marlin/example_configurations/Anet/A8/Configuration.h +++ b/Marlin/example_configurations/Anet/A8/Configuration.h @@ -897,6 +897,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -963,13 +975,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/BQ/Hephestos/Configuration.h b/Marlin/example_configurations/BQ/Hephestos/Configuration.h index 6e61777525..d55c9f544e 100644 --- a/Marlin/example_configurations/BQ/Hephestos/Configuration.h +++ b/Marlin/example_configurations/BQ/Hephestos/Configuration.h @@ -881,6 +881,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -947,13 +959,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/BQ/Hephestos_2/Configuration.h b/Marlin/example_configurations/BQ/Hephestos_2/Configuration.h index fff750bb46..13868694e4 100644 --- a/Marlin/example_configurations/BQ/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/BQ/Hephestos_2/Configuration.h @@ -891,6 +891,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -957,13 +969,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/BQ/WITBOX/Configuration.h b/Marlin/example_configurations/BQ/WITBOX/Configuration.h index f6f93609fb..afaa18ed37 100644 --- a/Marlin/example_configurations/BQ/WITBOX/Configuration.h +++ b/Marlin/example_configurations/BQ/WITBOX/Configuration.h @@ -881,6 +881,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -947,13 +959,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Cartesio/Configuration.h b/Marlin/example_configurations/Cartesio/Configuration.h index 9cb71cb715..62840e7b76 100644 --- a/Marlin/example_configurations/Cartesio/Configuration.h +++ b/Marlin/example_configurations/Cartesio/Configuration.h @@ -889,6 +889,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -955,13 +967,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Creality/CR-10/Configuration.h b/Marlin/example_configurations/Creality/CR-10/Configuration.h index b67bf69cd1..6c2e4d893a 100755 --- a/Marlin/example_configurations/Creality/CR-10/Configuration.h +++ b/Marlin/example_configurations/Creality/CR-10/Configuration.h @@ -900,6 +900,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -966,13 +978,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - //#define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index db283d90ec..c923cf6816 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -872,6 +872,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -938,13 +950,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Felix/DUAL/Configuration.h b/Marlin/example_configurations/Felix/DUAL/Configuration.h index ba2cbe28bf..8f550dbc34 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -872,6 +872,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -938,13 +950,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration.h b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration.h index fd4786c9fa..47df6cfd56 100644 --- a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration.h @@ -893,6 +893,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -961,13 +973,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 25 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Geeetech/GT2560/Configuration.h b/Marlin/example_configurations/Geeetech/GT2560/Configuration.h index fa0e477bc0..607df9fb32 100644 --- a/Marlin/example_configurations/Geeetech/GT2560/Configuration.h +++ b/Marlin/example_configurations/Geeetech/GT2560/Configuration.h @@ -905,6 +905,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -971,13 +983,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Geeetech/I3_Pro_X-GT2560/Configuration.h b/Marlin/example_configurations/Geeetech/I3_Pro_X-GT2560/Configuration.h index 85098cd266..fc3eb5e31e 100644 --- a/Marlin/example_configurations/Geeetech/I3_Pro_X-GT2560/Configuration.h +++ b/Marlin/example_configurations/Geeetech/I3_Pro_X-GT2560/Configuration.h @@ -890,6 +890,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -956,13 +968,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Infitary/i3-M508/Configuration.h b/Marlin/example_configurations/Infitary/i3-M508/Configuration.h index bb8a410376..3d608611c2 100644 --- a/Marlin/example_configurations/Infitary/i3-M508/Configuration.h +++ b/Marlin/example_configurations/Infitary/i3-M508/Configuration.h @@ -894,6 +894,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -960,13 +972,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Malyan/M150/Configuration.h b/Marlin/example_configurations/Malyan/M150/Configuration.h index c6e69a7429..8746478900 100644 --- a/Marlin/example_configurations/Malyan/M150/Configuration.h +++ b/Marlin/example_configurations/Malyan/M150/Configuration.h @@ -918,6 +918,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -984,13 +996,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Micromake/C1/basic/Configuration.h b/Marlin/example_configurations/Micromake/C1/basic/Configuration.h index fae1877f98..acbafca73b 100644 --- a/Marlin/example_configurations/Micromake/C1/basic/Configuration.h +++ b/Marlin/example_configurations/Micromake/C1/basic/Configuration.h @@ -894,6 +894,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -960,13 +972,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - //#define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Micromake/C1/enhanced/Configuration.h b/Marlin/example_configurations/Micromake/C1/enhanced/Configuration.h index 620a5bc015..28cd68374b 100644 --- a/Marlin/example_configurations/Micromake/C1/enhanced/Configuration.h +++ b/Marlin/example_configurations/Micromake/C1/enhanced/Configuration.h @@ -894,6 +894,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -960,13 +972,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - //#define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 8cc51fbbb1..663017e8df 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -890,6 +890,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -956,13 +968,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 93c54e66fc..03c07c0d3e 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -888,6 +888,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -954,13 +966,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 79b5408576..eab085fff4 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -902,6 +902,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -968,13 +980,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Sanguinololu/Configuration.h b/Marlin/example_configurations/Sanguinololu/Configuration.h index d3ebae6143..ceab2044d0 100644 --- a/Marlin/example_configurations/Sanguinololu/Configuration.h +++ b/Marlin/example_configurations/Sanguinololu/Configuration.h @@ -921,6 +921,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -987,13 +999,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - //#define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/TinyBoy2/Configuration.h b/Marlin/example_configurations/TinyBoy2/Configuration.h index d17612a121..8ac0320c62 100644 --- a/Marlin/example_configurations/TinyBoy2/Configuration.h +++ b/Marlin/example_configurations/TinyBoy2/Configuration.h @@ -946,6 +946,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1012,13 +1024,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Velleman/K8200/Configuration.h b/Marlin/example_configurations/Velleman/K8200/Configuration.h index f5960f6dad..fa263e5229 100644 --- a/Marlin/example_configurations/Velleman/K8200/Configuration.h +++ b/Marlin/example_configurations/Velleman/K8200/Configuration.h @@ -920,6 +920,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -986,13 +998,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Velleman/K8400/Configuration.h b/Marlin/example_configurations/Velleman/K8400/Configuration.h index e0e1c67c9e..41f7d72405 100644 --- a/Marlin/example_configurations/Velleman/K8400/Configuration.h +++ b/Marlin/example_configurations/Velleman/K8400/Configuration.h @@ -890,6 +890,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -956,13 +968,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/Velleman/K8400/Dual-head/Configuration.h b/Marlin/example_configurations/Velleman/K8400/Dual-head/Configuration.h index e43cf8fa74..72b5b55e17 100644 --- a/Marlin/example_configurations/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/example_configurations/Velleman/K8400/Dual-head/Configuration.h @@ -890,6 +890,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -956,13 +968,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 6966c75274..3a8e5ed0f5 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -890,6 +890,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -956,13 +968,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h index e13538d79b..b2ea045a3b 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h @@ -1020,6 +1020,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z //#define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1090,13 +1102,6 @@ #define UBL_PROBE_PT_3_X _PX(DELTA_PROBEABLE_RADIUS, 240) #define UBL_PROBE_PT_3_Y _PY(DELTA_PROBEABLE_RADIUS, 240) - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h index ca8f41560b..7672b0341e 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h @@ -1020,6 +1020,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z //#define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1084,13 +1096,6 @@ #define UBL_PROBE_PT_3_X _PX(DELTA_PROBEABLE_RADIUS, 240) #define UBL_PROBE_PT_3_Y _PY(DELTA_PROBEABLE_RADIUS, 240) - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 57bb5c5869..674136805b 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -1011,6 +1011,18 @@ // Set the boundaries for probing (where the probe can reach). #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1079,13 +1091,6 @@ #define UBL_PROBE_PT_3_X _PX(DELTA_PROBEABLE_RADIUS, 240) #define UBL_PROBE_PT_3_Y _PY(DELTA_PROBEABLE_RADIUS, 240) - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index ee8afb7d75..49e3f45f53 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -1014,6 +1014,18 @@ // Set the boundaries for probing (where the probe can reach). #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1082,13 +1094,6 @@ #define UBL_PROBE_PT_3_X _PX(DELTA_PROBEABLE_RADIUS, 240) #define UBL_PROBE_PT_3_Y _PY(DELTA_PROBEABLE_RADIUS, 240) - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 2775db20f6..bec4f59d66 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -1014,6 +1014,18 @@ // Set the boundaries for probing (where the probe can reach). #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1082,13 +1094,6 @@ #define UBL_PROBE_PT_3_X _PX(DELTA_PROBEABLE_RADIUS, 240) #define UBL_PROBE_PT_3_Y _PY(DELTA_PROBEABLE_RADIUS, 240) - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 97abdfc2bb..de98d12b64 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -1023,6 +1023,18 @@ // Set the boundaries for probing (where the probe can reach). #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1091,13 +1103,6 @@ #define UBL_PROBE_PT_3_X _PX(DELTA_PROBEABLE_RADIUS, 240) #define UBL_PROBE_PT_3_Y _PY(DELTA_PROBEABLE_RADIUS, 240) - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/gCreate/gMax1.5+/Configuration.h b/Marlin/example_configurations/gCreate/gMax1.5+/Configuration.h index 611bc23b15..6ec90cb4a6 100644 --- a/Marlin/example_configurations/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/example_configurations/gCreate/gMax1.5+/Configuration.h @@ -904,6 +904,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -970,13 +982,6 @@ #define UBL_PROBE_PT_3_X 348 #define UBL_PROBE_PT_3_Y 211 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 177e3b49af..c3bd8bb042 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -893,6 +893,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -959,13 +971,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 540f7806ba..23edb3cc5f 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -885,6 +885,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -951,13 +963,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/example_configurations/wt150/Configuration.h b/Marlin/example_configurations/wt150/Configuration.h index 7964f660d4..db03b7b0e4 100644 --- a/Marlin/example_configurations/wt150/Configuration.h +++ b/Marlin/example_configurations/wt150/Configuration.h @@ -895,6 +895,18 @@ // at which point movement will be level to the machine's XY plane. // The height can be set with M420 Z #define ENABLE_LEVELING_FADE_HEIGHT + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION // Enable G26 mesh validation + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -961,13 +973,6 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation - #if ENABLED(UBL_G26_MESH_VALIDATION) - #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. - #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. - #endif #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index fb0fcb3384..156bf4d8f2 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -58,6 +58,7 @@ * */ +#include "MarlinConfig.h" #include "planner.h" #include "stepper.h" #include "temperature.h" diff --git a/Marlin/types.h b/Marlin/types.h index 8ab7beebea..e4f4ce197f 100644 --- a/Marlin/types.h +++ b/Marlin/types.h @@ -25,4 +25,9 @@ typedef unsigned long millis_t; +typedef struct { + int8_t x_index, y_index; + float distance; // When populated, the distance from the search location +} mesh_index_pair; + #endif diff --git a/Marlin/ubl.cpp b/Marlin/ubl.cpp index 0f7b3b4f81..3f38ba9c0b 100644 --- a/Marlin/ubl.cpp +++ b/Marlin/ubl.cpp @@ -30,16 +30,6 @@ #include "temperature.h" #include "planner.h" - /** - * These support functions allow the use of large bit arrays of flags that take very - * little RAM. Currently they are limited to being 16x16 in size. Changing the declaration - * to unsigned long will allow us to go to 32x32 if higher resolution Mesh's are needed - * in the future. - */ - void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y) { CBI(bits[y], x); } - void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { SBI(bits[y], x); } - bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); } - uint8_t ubl_cnt = 0; void unified_bed_leveling::echo_name() { SERIAL_PROTOCOLPGM("Unified Bed Leveling"); } @@ -70,9 +60,6 @@ constexpr float unified_bed_leveling::_mesh_index_to_xpos[16], unified_bed_leveling::_mesh_index_to_ypos[16]; - bool unified_bed_leveling::g26_debug_flag = false, - unified_bed_leveling::has_control_of_lcd_panel = false; - #if ENABLED(ULTIPANEL) bool unified_bed_leveling::lcd_map_control = false; #endif diff --git a/Marlin/ubl.h b/Marlin/ubl.h index 9f949bc398..2b73d3cfdd 100644 --- a/Marlin/ubl.h +++ b/Marlin/ubl.h @@ -39,17 +39,6 @@ #define USE_NOZZLE_AS_REFERENCE 0 #define USE_PROBE_AS_REFERENCE 1 - typedef struct { - int8_t x_index, y_index; - float distance; // When populated, the distance from the search location - } mesh_index_pair; - - // ubl.cpp - - void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y); - void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y); - bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y); - // ubl_motion.cpp void debug_current_and_destination(const char * const title); @@ -61,7 +50,6 @@ // External references char *ftostr43sign(const float&, char); - bool ubl_lcd_clicked(); void home_all_axes(); extern uint8_t ubl_cnt; @@ -93,22 +81,6 @@ static int g29_grid_size; #endif - #if ENABLED(UBL_G26_MESH_VALIDATION) - static float g26_extrusion_multiplier, - g26_retraction_multiplier, - g26_nozzle, - g26_filament_diameter, - g26_prime_length, - g26_x_pos, g26_y_pos, - g26_ooze_amount, - g26_layer_height; - static int16_t g26_bed_temp, - g26_hotend_temp, - g26_repeats; - static int8_t g26_prime_flag; - static bool g26_continue_with_closest, g26_keep_heaters_on; - #endif - static float measure_point_with_encoder(); static float measure_business_card_thickness(float); static bool g29_parameter_parsing(); @@ -125,21 +97,6 @@ static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir); static void smart_fill_mesh(); - #if ENABLED(UBL_G26_MESH_VALIDATION) - static bool exit_from_g26(); - static bool parse_G26_parameters(); - static void G26_line_to_destination(const float &feed_rate); - static mesh_index_pair find_closest_circle_to_print(const float&, const float&); - static bool look_for_lines_to_connect(); - static bool turn_on_heaters(); - static bool prime_nozzle(); - static void retract_filament(const float where[XYZE]); - static void recover_filament(const float where[XYZE]); - static void print_line_from_here_to_there(const float&, const float&, const float&, const float&, const float&, const float&); - static void move_to(const float&, const float&, const float&, const float&); - inline static void move_to(const float where[XYZE], const float &de) { move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], de); } - #endif - public: static void echo_name(); @@ -147,8 +104,8 @@ static void save_ubl_active_state_and_disable(); static void restore_ubl_active_state_and_leave(); static void display_map(const int); - static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const float&, const float&, const bool, uint16_t[16]); - static mesh_index_pair find_furthest_invalid_mesh_point(); + static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const float&, const float&, const bool, uint16_t[16]); + static mesh_index_pair find_furthest_invalid_mesh_point(); static void reset(); static void invalidate(); static void set_all_mesh_points_to_value(const float); @@ -156,11 +113,6 @@ static void G29() _O0; // O0 for no optimization static void smart_fill_wlsf(const float &) _O2; // O2 gives smaller code than Os on A2560 - - #if ENABLED(UBL_G26_MESH_VALIDATION) - static void G26(); - #endif - static int8_t storage_slot; static float z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; @@ -189,8 +141,6 @@ MESH_MIN_Y + 14 * (MESH_Y_DIST), MESH_MIN_Y + 15 * (MESH_Y_DIST) }; - static bool g26_debug_flag, has_control_of_lcd_panel; - #if ENABLED(ULTIPANEL) static bool lcd_map_control; #endif @@ -390,15 +340,10 @@ || isnan(z_values[0][0]) ); } - }; // class unified_bed_leveling extern unified_bed_leveling ubl; - #if ENABLED(UBL_G26_MESH_VALIDATION) - FORCE_INLINE void gcode_G26() { ubl.G26(); } - #endif - FORCE_INLINE void gcode_G29() { ubl.G29(); } #endif // AUTO_BED_LEVELING_UBL diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 471a7d4753..9306659315 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -32,6 +32,7 @@ #include "stepper.h" #include "planner.h" #include "gcode.h" + #include "bitmap_flags.h" #include #include "least_squares_fit.h" @@ -676,8 +677,7 @@ lcd_reset_alert_level(); LCD_MESSAGEPGM(""); lcd_quick_feedback(); - - has_control_of_lcd_panel = false; + lcd_external_control = false; #endif return; @@ -736,7 +736,10 @@ void unified_bed_leveling::probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, bool close_or_far) { mesh_index_pair location; - has_control_of_lcd_panel = true; + #if ENABLED(NEWPANEL) + lcd_external_control = true; + #endif + save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe DEPLOY_PROBE(); @@ -746,12 +749,12 @@ if (do_ubl_mesh_map) display_map(g29_map_type); #if ENABLED(NEWPANEL) - if (ubl_lcd_clicked()) { + if (is_lcd_clicked()) { SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n"); lcd_quick_feedback(); STOW_PROBE(); - while (ubl_lcd_clicked()) idle(); - has_control_of_lcd_panel = false; + while (is_lcd_clicked()) idle(); + lcd_external_control = false; restore_ubl_active_state_and_leave(); safe_delay(50); // Debounce the Encoder wheel return; @@ -889,13 +892,14 @@ #endif // HAS_BED_PROBE #if ENABLED(NEWPANEL) + float unified_bed_leveling::measure_point_with_encoder() { - while (ubl_lcd_clicked()) delay(50); // wait for user to release encoder wheel + while (is_lcd_clicked()) delay(50); // wait for user to release encoder wheel delay(50); // debounce KEEPALIVE_STATE(PAUSED_FOR_USER); - while (!ubl_lcd_clicked()) { // we need the loop to move the nozzle based on the encoder wheel here! + while (!is_lcd_clicked()) { // we need the loop to move the nozzle based on the encoder wheel here! idle(); if (encoder_diff) { do_blocking_move_to_z(current_position[Z_AXIS] + 0.01 * float(encoder_diff)); @@ -909,7 +913,7 @@ static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); } float unified_bed_leveling::measure_business_card_thickness(float in_height) { - has_control_of_lcd_panel = true; + lcd_external_control = true; save_ubl_active_state_and_disable(); // Disable bed level correction for probing do_blocking_move_to(0.5 * (MESH_MAX_X - (MESH_MIN_X)), 0.5 * (MESH_MAX_Y - (MESH_MIN_Y)), in_height); @@ -943,7 +947,7 @@ in_height = current_position[Z_AXIS]; // do manual probing at lower height - has_control_of_lcd_panel = false; + lcd_external_control = false; restore_ubl_active_state_and_leave(); @@ -952,7 +956,7 @@ void unified_bed_leveling::manually_probe_remaining_mesh(const float &rx, const float &ry, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) { - has_control_of_lcd_panel = true; + lcd_external_control = true; save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); @@ -976,7 +980,7 @@ do_blocking_move_to_z(z_clearance); KEEPALIVE_STATE(PAUSED_FOR_USER); - has_control_of_lcd_panel = true; + lcd_external_control = true; if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing @@ -985,9 +989,9 @@ const float z_step = 0.01; // existing behavior: 0.01mm per click, occasionally step //const float z_step = 1.0 / planner.axis_steps_per_mm[Z_AXIS]; // approx one step each click - while (ubl_lcd_clicked()) delay(50); // wait for user to release encoder wheel + while (is_lcd_clicked()) delay(50); // wait for user to release encoder wheel delay(50); // debounce - while (!ubl_lcd_clicked()) { // we need the loop to move the nozzle based on the encoder wheel here! + while (!is_lcd_clicked()) { // we need the loop to move the nozzle based on the encoder wheel here! idle(); if (encoder_diff) { do_blocking_move_to_z(current_position[Z_AXIS] + float(encoder_diff) * z_step); @@ -995,11 +999,11 @@ } } - // this sequence to detect an ubl_lcd_clicked() debounce it and leave if it is + // this sequence to detect an is_lcd_clicked() debounce it and leave if it is // a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp). This // should be redone and compressed. const millis_t nxt = millis() + 1500L; - while (ubl_lcd_clicked()) { // debounce and watch for abort + while (is_lcd_clicked()) { // debounce and watch for abort idle(); if (ELAPSED(millis(), nxt)) { SERIAL_PROTOCOLLNPGM("\nMesh only partially populated."); @@ -1007,8 +1011,8 @@ #if ENABLED(NEWPANEL) lcd_quick_feedback(); - while (ubl_lcd_clicked()) idle(); - has_control_of_lcd_panel = false; + while (is_lcd_clicked()) idle(); + lcd_external_control = false; #endif KEEPALIVE_STATE(IN_HANDLER); @@ -1510,7 +1514,7 @@ new_z = FLOOR(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place KEEPALIVE_STATE(PAUSED_FOR_USER); - has_control_of_lcd_panel = true; + lcd_external_control = true; if (do_ubl_mesh_map) display_map(g29_map_type); // show the user which point is being adjusted @@ -1524,27 +1528,27 @@ do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited #endif idle(); - } while (!ubl_lcd_clicked()); + } while (!is_lcd_clicked()); if (!lcd_map_control) lcd_return_to_status(); // The technique used here generates a race condition for the encoder click. // It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune) or here. // Let's work on specifying a proper API for the LCD ASAP, OK? - has_control_of_lcd_panel = true; + lcd_external_control = true; - // this sequence to detect an ubl_lcd_clicked() debounce it and leave if it is + // this sequence to detect an is_lcd_clicked() debounce it and leave if it is // a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp). This // should be redone and compressed. const millis_t nxt = millis() + 1500UL; - while (ubl_lcd_clicked()) { // debounce and watch for abort + while (is_lcd_clicked()) { // debounce and watch for abort idle(); if (ELAPSED(millis(), nxt)) { lcd_return_to_status(); do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); LCD_MESSAGEPGM(MSG_EDITING_STOPPED); - while (ubl_lcd_clicked()) idle(); + while (is_lcd_clicked()) idle(); goto FINE_TUNE_EXIT; } @@ -1560,7 +1564,7 @@ FINE_TUNE_EXIT: - has_control_of_lcd_panel = false; + lcd_external_control = false; KEEPALIVE_STATE(IN_HANDLER); if (do_ubl_mesh_map) display_map(g29_map_type); diff --git a/Marlin/ubl_motion.cpp b/Marlin/ubl_motion.cpp index be7ea87c28..3bf679d2cb 100644 --- a/Marlin/ubl_motion.cpp +++ b/Marlin/ubl_motion.cpp @@ -38,23 +38,23 @@ extern void set_current_from_destination(); #endif -#if ENABLED(DELTA) + #if ENABLED(DELTA) - extern float delta[ABC]; + extern float delta[ABC]; - extern float delta_endstop_adj[ABC], - delta_radius, - delta_tower_angle_trim[ABC], - delta_tower[ABC][2], - delta_diagonal_rod, - delta_calibration_radius, - delta_diagonal_rod_2_tower[ABC], - delta_segments_per_second, - delta_clip_start_height; + extern float delta_endstop_adj[ABC], + delta_radius, + delta_tower_angle_trim[ABC], + delta_tower[ABC][2], + delta_diagonal_rod, + delta_calibration_radius, + delta_diagonal_rod_2_tower[ABC], + delta_segments_per_second, + delta_clip_start_height; - extern float delta_safe_distance_from_top(); + extern float delta_safe_distance_from_top(); -#endif + #endif static void debug_echo_axis(const AxisEnum axis) { @@ -68,7 +68,7 @@ // if the title message starts with a '!' it is so important, we are going to // ignore the status of the g26_debug_flag - if (*title != '!' && !ubl.g26_debug_flag) return; + if (*title != '!' && !g26_debug_flag) return; const float de = destination[E_AXIS] - current_position[E_AXIS]; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index e30cfc672f..f16796be2a 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -57,6 +57,10 @@ extern void mesh_probing_done(); #endif +#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + bool lcd_external_control; +#endif + // Initialized by settings.load() int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; @@ -4603,8 +4607,8 @@ void lcd_update() { lcd_buttons_update(); - #if ENABLED(AUTO_BED_LEVELING_UBL) - const bool UBL_CONDITION = !ubl.has_control_of_lcd_panel; + #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + const bool UBL_CONDITION = lcd_external_control; #else constexpr bool UBL_CONDITION = true; #endif @@ -5071,7 +5075,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } case encrot3: ENCODER_SPIN(encrot2, encrot0); break; } #if ENABLED(AUTO_BED_LEVELING_UBL) - if (ubl.has_control_of_lcd_panel) { + if (lcd_external_control) { ubl.encoder_diff = encoderDiff; // Make the encoder's rotation available to G29's Mesh Editor encoderDiff = 0; // We are going to lie to the LCD Panel and claim the encoder // knob has not turned. @@ -5087,18 +5091,18 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } bool lcd_detected() { return true; } #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) - - void chirp_at_user() { + #if ENABLED(G26_MESH_VALIDATION) + void lcd_chirp() { #if ENABLED(LCD_USE_I2C_BUZZER) lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); #elif PIN_EXISTS(BEEPER) buzzer.tone(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); #endif } + #endif - bool ubl_lcd_clicked() { return LCD_CLICKED; } - + #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + bool is_lcd_clicked() { return LCD_CLICKED; } #endif #endif // ULTIPANEL diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index db52bb0e61..69a536a8fc 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -27,6 +27,13 @@ #if ENABLED(ULTRA_LCD) + #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + extern bool lcd_external_control; + #if ENABLED(G26_MESH_VALIDATION) + void lcd_chirp(); + #endif + #endif + #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0) #define BUTTON_PRESSED(BN) !READ(BTN_## BN) @@ -167,6 +174,10 @@ #define LCD_CLICKED false #endif + #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + bool is_lcd_clicked(); + #endif + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD)) extern uint8_t progress_bar_percent; #endif