From 13c84938784d4ec7e82839ef1e3d4227dae90393 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Tue, 18 Apr 2017 14:43:25 +0200 Subject: [PATCH 01/18] M665 rework and related issues (all delta's) - Making M665 compatible with repetier (see http://reprap.org/wiki/G_code#M665:_Set_delta_configuration) - M665 B also sets the radius for manual calibration menu - Converting tower ajustment definitions to arrays - tower angle corrections compatible with Esher 3D wizzard - Only tower angles need to be adjustable with M665 and stored to EEPROM - tower radius and diag rod can be adjusted in the FW only with #define --- Marlin/Conditionals_post.h | 43 ++++------------- Marlin/Marlin.h | 4 +- Marlin/Marlin_main.cpp | 47 ++++++++++--------- Marlin/configuration_store.cpp | 36 +++++++------- .../FLSUN/auto_calibrate/Configuration.h | 32 ++++++------- .../delta/FLSUN/kossel_mini/Configuration.h | 28 +++++------ .../delta/generic/Configuration.h | 28 ++++++----- .../delta/kossel_mini/Configuration.h | 26 +++++----- .../delta/kossel_pro/Configuration.h | 28 ++++++----- .../delta/kossel_xl/Configuration.h | 26 +++++----- Marlin/ultralcd.cpp | 10 +--- 11 files changed, 141 insertions(+), 167 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 02a1eb0f6..617384bd5 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -691,43 +691,20 @@ * Delta radius/rod trimmers/angle trimmers */ #if ENABLED(DELTA) - #ifndef DELTA_ENDSTOP_ADJ - #define DELTA_ENDSTOP_ADJ { 0 } - #endif - #ifndef DELTA_RADIUS_TRIM_TOWER_1 - #define DELTA_RADIUS_TRIM_TOWER_1 0.0 - #endif - #ifndef DELTA_RADIUS_TRIM_TOWER_2 - #define DELTA_RADIUS_TRIM_TOWER_2 0.0 - #endif - #ifndef DELTA_RADIUS_TRIM_TOWER_3 - #define DELTA_RADIUS_TRIM_TOWER_3 0.0 - #endif - #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_1 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0 + #ifndef DELTA_CALIBRATION_RADIUS + #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - 10 #endif - #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_2 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0 - #endif - #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 - #endif - #ifndef DELTA_TOWER_ANGLE_TRIM_1 - #define DELTA_TOWER_ANGLE_TRIM_1 0.0 + #ifndef DELTA_ENDSTOP_ADJ + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } #endif - #ifndef DELTA_TOWER_ANGLE_TRIM_2 - #define DELTA_TOWER_ANGLE_TRIM_2 0.0 + #ifndef DELTA_TOWER_ANGLE_TRIM + #define DELTA_TOWER_ANGLE_TRIM {0.0, 0.0} #endif - #ifndef DELTA_TOWER_ANGLE_TRIM_3 - #define DELTA_TOWER_ANGLE_TRIM_3 0.0 + #ifndef DELTA_RADIUS_TRIM_TOWER + #define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) - #ifndef H_FACTOR - #define H_FACTOR 1.00 - #endif - #ifndef R_FACTOR - #define R_FACTOR -2.25 - #endif + #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER + #define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} #endif #endif diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index cea3d7fd6..8b0e3708f 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -302,9 +302,9 @@ float code_value_temp_diff(); extern float endstop_adj[ABC], delta_radius, delta_diagonal_rod, + delta_calibration_radius, delta_segments_per_second, - delta_diagonal_rod_trim[ABC], - delta_tower_angle_trim[ABC], + delta_tower_angle_trim[2], delta_clip_start_height; void recalc_delta_settings(float radius, float diagonal_rod); #elif IS_SCARA diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 8db285174..2e28f4603 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -585,10 +585,10 @@ static uint8_t target_extruder; // These values are loaded or reset at boot time when setup() calls // settings.load(), which calls recalc_delta_settings(). float delta_radius, - delta_tower_angle_trim[ABC], + delta_tower_angle_trim[2], delta_tower[ABC][2], delta_diagonal_rod, - delta_diagonal_rod_trim[ABC], + delta_calibration_radius, delta_diagonal_rod_2_tower[ABC], delta_segments_per_second, delta_clip_start_height = Z_MAX_POS; @@ -5109,8 +5109,8 @@ inline void gcode_G28() { if (probe_points >= 3) { for (int8_t axis = 9; axis > 0; axis -= step_axis) { // uint8_t starts endless loop z_at_pt[0] += probe_pt( - 0.1 * cos(RADIANS(180 + 30 * axis)) * (DELTA_CALIBRATION_RADIUS), - 0.1 * sin(RADIANS(180 + 30 * axis)) * (DELTA_CALIBRATION_RADIUS), true, 1); + 0.1 * cos(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), + 0.1 * sin(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), true, 1); } center_points += 3; z_at_pt[0] /= center_points; @@ -5124,8 +5124,8 @@ inline void gcode_G28() { if (probe_points != 1) { for (uint8_t axis = start; axis < 13; axis += step_axis) z_at_pt[axis] += probe_pt( - cos(RADIANS(180 + 30 * axis)) * (DELTA_CALIBRATION_RADIUS), - sin(RADIANS(180 + 30 * axis)) * (DELTA_CALIBRATION_RADIUS), true, 1 + cos(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), + sin(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), true, 1 ); if (probe_points == 4) step_axis = 2; @@ -5308,7 +5308,7 @@ inline void gcode_G28() { } SERIAL_EOL; if (zero_std_dev >= test_precision) - SERIAL_PROTOCOLLNPGM("Save with M500"); + SERIAL_PROTOCOLLNPGM("save with M500 and/or copy to configuration.h"); } else { // forced end #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) @@ -7546,12 +7546,13 @@ inline void gcode_M205() { if (code_seen('L')) delta_diagonal_rod = code_value_linear_units(); if (code_seen('R')) delta_radius = code_value_linear_units(); if (code_seen('S')) delta_segments_per_second = code_value_float(); - if (code_seen('A')) delta_diagonal_rod_trim[A_AXIS] = code_value_linear_units(); - if (code_seen('B')) delta_diagonal_rod_trim[B_AXIS] = code_value_linear_units(); - if (code_seen('C')) delta_diagonal_rod_trim[C_AXIS] = code_value_linear_units(); - if (code_seen('I')) delta_tower_angle_trim[A_AXIS] = code_value_linear_units(); - if (code_seen('J')) delta_tower_angle_trim[B_AXIS] = code_value_linear_units(); - if (code_seen('K')) delta_tower_angle_trim[C_AXIS] = code_value_linear_units(); + if (code_seen('B')) delta_calibration_radius = code_value_float(); + if (code_seen('X')) delta_tower_angle_trim[A_AXIS] = code_value_linear_units(); + if (code_seen('Y')) delta_tower_angle_trim[B_AXIS] = code_value_linear_units(); + if (code_seen('Z')) { // rotate all 3 axis for Z = 0 + delta_tower_angle_trim[A_AXIS] += code_value_linear_units(); + delta_tower_angle_trim[B_AXIS] = code_value_linear_units(); + } recalc_delta_settings(delta_radius, delta_diagonal_rod); } /** @@ -10555,15 +10556,17 @@ void ok_to_send() { * settings have been changed (e.g., by M665). */ void recalc_delta_settings(float radius, float diagonal_rod) { - delta_tower[A_AXIS][X_AXIS] = -sin(RADIANS(60 - delta_tower_angle_trim[A_AXIS])) * (radius + DELTA_RADIUS_TRIM_TOWER_1); // front left tower - delta_tower[A_AXIS][Y_AXIS] = -cos(RADIANS(60 - delta_tower_angle_trim[A_AXIS])) * (radius + DELTA_RADIUS_TRIM_TOWER_1); - delta_tower[B_AXIS][X_AXIS] = sin(RADIANS(60 + delta_tower_angle_trim[B_AXIS])) * (radius + DELTA_RADIUS_TRIM_TOWER_2); // front right tower - delta_tower[B_AXIS][Y_AXIS] = -cos(RADIANS(60 + delta_tower_angle_trim[B_AXIS])) * (radius + DELTA_RADIUS_TRIM_TOWER_2); - delta_tower[C_AXIS][X_AXIS] = -sin(RADIANS( delta_tower_angle_trim[C_AXIS])) * (radius + DELTA_RADIUS_TRIM_TOWER_3); // back middle tower - delta_tower[C_AXIS][Y_AXIS] = cos(RADIANS( delta_tower_angle_trim[C_AXIS])) * (radius + DELTA_RADIUS_TRIM_TOWER_3); - delta_diagonal_rod_2_tower[A_AXIS] = sq(diagonal_rod + delta_diagonal_rod_trim[A_AXIS]); - delta_diagonal_rod_2_tower[B_AXIS] = sq(diagonal_rod + delta_diagonal_rod_trim[B_AXIS]); - delta_diagonal_rod_2_tower[C_AXIS] = sq(diagonal_rod + delta_diagonal_rod_trim[C_AXIS]); + const float trt[ABC] = DELTA_RADIUS_TRIM_TOWER, + drt[ABC] = DELTA_DIAGONAL_ROD_TRIM_TOWER; + delta_tower[A_AXIS][X_AXIS] = -cos(RADIANS(30 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); // front left tower + delta_tower[A_AXIS][Y_AXIS] = -sin(RADIANS(30 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); + delta_tower[B_AXIS][X_AXIS] = cos(RADIANS(30 - delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); // front right tower + delta_tower[B_AXIS][Y_AXIS] = -sin(RADIANS(30 - delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); + delta_tower[C_AXIS][X_AXIS] = 0.0; // back middle tower + delta_tower[C_AXIS][Y_AXIS] = (radius + trt[C_AXIS]); + delta_diagonal_rod_2_tower[A_AXIS] = sq(diagonal_rod + drt[A_AXIS]); + delta_diagonal_rod_2_tower[B_AXIS] = sq(diagonal_rod + drt[B_AXIS]); + delta_diagonal_rod_2_tower[C_AXIS] = sq(diagonal_rod + drt[C_AXIS]); } #if ENABLED(DELTA_FAST_SQRT) diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index fb82f2370..c0c3b8d7e 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -92,12 +92,10 @@ * 360 M665 R delta_radius (float) * 364 M665 L delta_diagonal_rod (float) * 368 M665 S delta_segments_per_second (float) - * 372 M665 A delta_diagonal_rod_trim[A] (float) - * 376 M665 B delta_diagonal_rod_trim[B] (float) - * 380 M665 C delta_diagonal_rod_trim[C] (float) - * 384 M665 I delta_tower_angle_trim[A] (float) - * 388 M665 J delta_tower_angle_trim[B] (float) - * 392 M665 K delta_tower_angle_trim[C] (float) + * 372 M665 B delta_calibration_radius (float) + * 376 M665 X delta_tower_angle_trim[A] (float) + * 380 M665 Y delta_tower_angle_trim[B] (float) + * --- M665 Z delta_tower_angle_trim[C] (float) is always 0.0 * * Z_DUAL_ENDSTOPS: 48 bytes * 348 M666 Z z_endstop_adj (float) @@ -412,8 +410,8 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(delta_radius); // 1 float EEPROM_WRITE(delta_diagonal_rod); // 1 float EEPROM_WRITE(delta_segments_per_second); // 1 float - EEPROM_WRITE(delta_diagonal_rod_trim); // 3 floats - EEPROM_WRITE(delta_tower_angle_trim); // 3 floats + EEPROM_WRITE(delta_calibration_radius); // 1 floats + EEPROM_WRITE(delta_tower_angle_trim); // 2 floats #elif ENABLED(Z_DUAL_ENDSTOPS) EEPROM_WRITE(z_endstop_adj); // 1 float dummy = 0.0f; @@ -780,8 +778,8 @@ void MarlinSettings::postprocess() { EEPROM_READ(delta_radius); // 1 float EEPROM_READ(delta_diagonal_rod); // 1 float EEPROM_READ(delta_segments_per_second); // 1 float - EEPROM_READ(delta_diagonal_rod_trim); // 3 floats - EEPROM_READ(delta_tower_angle_trim); // 3 floats + EEPROM_READ(delta_calibration_radius); // 1 floats + EEPROM_READ(delta_tower_angle_trim); // 2 floats #elif ENABLED(Z_DUAL_ENDSTOPS) EEPROM_READ(z_endstop_adj); dummy = 0.0f; @@ -1068,13 +1066,12 @@ void MarlinSettings::reset() { #if ENABLED(DELTA) const float adj[ABC] = DELTA_ENDSTOP_ADJ, - drt[ABC] = { DELTA_DIAGONAL_ROD_TRIM_TOWER_1, DELTA_DIAGONAL_ROD_TRIM_TOWER_2, DELTA_DIAGONAL_ROD_TRIM_TOWER_3 }, - dta[ABC] = { DELTA_TOWER_ANGLE_TRIM_1, DELTA_TOWER_ANGLE_TRIM_2, DELTA_TOWER_ANGLE_TRIM_3 }; + dta[2] = DELTA_TOWER_ANGLE_TRIM; COPY(endstop_adj, adj); delta_radius = DELTA_RADIUS; delta_diagonal_rod = DELTA_DIAGONAL_ROD; delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND; - COPY(delta_diagonal_rod_trim, drt); + delta_calibration_radius = DELTA_CALIBRATION_RADIUS; COPY(delta_tower_angle_trim, dta); home_offset[Z_AXIS] = 0; @@ -1473,19 +1470,18 @@ void MarlinSettings::reset() { SERIAL_ECHOLNPAIR(" Z", LINEAR_UNIT(endstop_adj[Z_AXIS])); if (!forReplay) { CONFIG_ECHO_START; - SERIAL_ECHOLNPGM("Delta settings: L R H S ABC"); + SERIAL_ECHOLNPGM("Delta settings: L R H S B XYZ"); } CONFIG_ECHO_START; SERIAL_ECHOPAIR(" M665 L", LINEAR_UNIT(delta_diagonal_rod)); SERIAL_ECHOPAIR(" R", LINEAR_UNIT(delta_radius)); SERIAL_ECHOPAIR(" H", LINEAR_UNIT(DELTA_HEIGHT + home_offset[Z_AXIS])); SERIAL_ECHOPAIR(" S", delta_segments_per_second); - SERIAL_ECHOPAIR(" A", LINEAR_UNIT(delta_diagonal_rod_trim[A_AXIS])); - SERIAL_ECHOPAIR(" B", LINEAR_UNIT(delta_diagonal_rod_trim[B_AXIS])); - SERIAL_ECHOPAIR(" C", LINEAR_UNIT(delta_diagonal_rod_trim[C_AXIS])); - SERIAL_ECHOPAIR(" I", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS])); - SERIAL_ECHOPAIR(" J", LINEAR_UNIT(delta_tower_angle_trim[B_AXIS])); - SERIAL_ECHOLNPAIR(" K", LINEAR_UNIT(delta_tower_angle_trim[C_AXIS])); + SERIAL_ECHOPAIR(" B", LINEAR_UNIT(delta_calibration_radius); + SERIAL_ECHOPAIR(" X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS])); + SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(delta_tower_angle_trim[B_AXIS])); + SERIAL_ECHOPAIR(" Z", 0.00); + SERIAL_EOL; #elif ENABLED(Z_DUAL_ENDSTOPS) if (!forReplay) { CONFIG_ECHO_START; diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h index 28217571c..9b6adff67 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h @@ -1,4 +1,4 @@ -/** +/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * @@ -459,40 +459,40 @@ //#define DELTA_CARRIAGE_OFFSET 22.0 // mm // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 100.59 //mm // get this value from auto calibrate + #define DELTA_RADIUS 100.90 //mm // get this value from auto calibrate // height from z=0.00 to home position - #define DELTA_HEIGHT 298.95 // get this value from auto calibrate + #define DELTA_HEIGHT 296.38 // get this value from auto calibrate // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 90.0 + #define DELTA_PRINTABLE_RADIUS 85.0 // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 #define DELTA_CALIBRATION_MENU + // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (1-4) - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 15) // set the radius for the calibration probe points + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) #endif // After homing move down to a height where XY movement is unconstrained #define DELTA_HOME_TO_SAFE_ZONE - #define DELTA_ENDSTOP_ADJ { -0.05, -0.00, -0.02 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate // Trim adjustments for individual towers - #define DELTA_RADIUS_TRIM_TOWER_1 0.0 - #define DELTA_RADIUS_TRIM_TOWER_2 0.0 - #define DELTA_RADIUS_TRIM_TOWER_3 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 - #define DELTA_TOWER_ANGLE_TRIM_1 0.0 - #define DELTA_TOWER_ANGLE_TRIM_2 0.0 - #define DELTA_TOWER_ANGLE_TRIM_3 0.0 + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + + // delta radius and diaginal rod adjustments measured in mm + //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} #endif diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h index 09dd6c43e..c88d3d1dc 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h @@ -472,28 +472,28 @@ // See http://minow.blogspot.com/index.html#4918805519571907051 //#define DELTA_CALIBRATION_MENU + // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - //#define DELTA_AUTO_CALIBRATION + #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (1-4) - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 15) // set the radius for the calibration probe points + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) #endif // After homing move down to a height where XY movement is unconstrained - //#define DELTA_HOME_TO_SAFE_ZONE + #define DELTA_HOME_TO_SAFE_ZONE - //#define DELTA_ENDSTOP_ADJ { 0, 0, 0 } + #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate // Trim adjustments for individual towers - #define DELTA_RADIUS_TRIM_TOWER_1 0.0 - #define DELTA_RADIUS_TRIM_TOWER_2 0.0 - #define DELTA_RADIUS_TRIM_TOWER_3 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 - #define DELTA_TOWER_ANGLE_TRIM_1 0.0 - #define DELTA_TOWER_ANGLE_TRIM_2 0.0 - #define DELTA_TOWER_ANGLE_TRIM_3 0.0 + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + + // delta radius and diaginal rod adjustments measured in mm + //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} #endif diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index c3e888cd6..744362c94 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -461,28 +461,30 @@ // See http://minow.blogspot.com/index.html#4918805519571907051 //#define DELTA_CALIBRATION_MENU + + + // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - //#define DELTA_AUTO_CALIBRATION + #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (1-4) - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 15) // set the radius for the calibration probe points + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) #endif // After homing move down to a height where XY movement is unconstrained #define DELTA_HOME_TO_SAFE_ZONE - //#define DELTA_ENDSTOP_ADJ { 0, 0, 0 } + #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate // Trim adjustments for individual towers - #define DELTA_RADIUS_TRIM_TOWER_1 0.0 - #define DELTA_RADIUS_TRIM_TOWER_2 0.0 - #define DELTA_RADIUS_TRIM_TOWER_3 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 - #define DELTA_TOWER_ANGLE_TRIM_1 0.0 - #define DELTA_TOWER_ANGLE_TRIM_2 0.0 - #define DELTA_TOWER_ANGLE_TRIM_3 0.0 + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + + // delta radius and diaginal rod adjustments measured in mm + //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} #endif diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 401f7b5cb..c4a91ee8a 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -461,28 +461,28 @@ // See http://minow.blogspot.com/index.html#4918805519571907051 //#define DELTA_CALIBRATION_MENU + // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - //#define DELTA_AUTO_CALIBRATION + #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (1-4) - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 15) // set the radius for the calibration probe points + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) #endif // After homing move down to a height where XY movement is unconstrained #define DELTA_HOME_TO_SAFE_ZONE - //#define DELTA_ENDSTOP_ADJ { 0, 0, 0 } + #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate // Trim adjustments for individual towers - #define DELTA_RADIUS_TRIM_TOWER_1 0.0 - #define DELTA_RADIUS_TRIM_TOWER_2 0.0 - #define DELTA_RADIUS_TRIM_TOWER_3 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 - #define DELTA_TOWER_ANGLE_TRIM_1 0.0 - #define DELTA_TOWER_ANGLE_TRIM_2 0.0 - #define DELTA_TOWER_ANGLE_TRIM_3 0.0 + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + + // delta radius and diaginal rod adjustments measured in mm + //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} #endif diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 419f47ca4..34b6d0215 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -448,28 +448,30 @@ // See http://minow.blogspot.com/index.html#4918805519571907051 //#define DELTA_CALIBRATION_MENU + + + // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - //#define DELTA_AUTO_CALIBRATION + #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (1-4) - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 15) // set the radius for the calibration probe points + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) #endif // After homing move down to a height where XY movement is unconstrained #define DELTA_HOME_TO_SAFE_ZONE - //#define DELTA_ENDSTOP_ADJ { 0, 0, 0 } + #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate // Trim adjustments for individual towers - #define DELTA_RADIUS_TRIM_TOWER_1 0.0 - #define DELTA_RADIUS_TRIM_TOWER_2 0.0 - #define DELTA_RADIUS_TRIM_TOWER_3 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 - #define DELTA_TOWER_ANGLE_TRIM_1 0.0 - #define DELTA_TOWER_ANGLE_TRIM_2 0.0 - #define DELTA_TOWER_ANGLE_TRIM_3 0.0 + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + + // delta radius and diaginal rod adjustments measured in mm + //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} #endif diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 320e19bb1..b93620313 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -466,28 +466,28 @@ // See http://minow.blogspot.com/index.html#4918805519571907051 //#define DELTA_CALIBRATION_MENU + // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - //#define DELTA_AUTO_CALIBRATION + #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (1-4) - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 15) // set the radius for the calibration probe points + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) #endif // After homing move down to a height where XY movement is unconstrained #define DELTA_HOME_TO_SAFE_ZONE - //#define DELTA_ENDSTOP_ADJ { 0, 0, 0 } + #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate // Trim adjustments for individual towers - #define DELTA_RADIUS_TRIM_TOWER_1 0.0 - #define DELTA_RADIUS_TRIM_TOWER_2 0.0 - #define DELTA_RADIUS_TRIM_TOWER_3 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0 - #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 - #define DELTA_TOWER_ANGLE_TRIM_1 0.0 - #define DELTA_TOWER_ANGLE_TRIM_2 0.0 - #define DELTA_TOWER_ANGLE_TRIM_3 0.0 + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + + // delta radius and diaginal rod adjustments measured in mm + //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} #endif diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index bca731ddb..50c6fb580 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1805,20 +1805,14 @@ void kill_screen(const char* lcd_msg) { lcd_goto_screen(_lcd_calibrate_homing); } - #if ENABLED(DELTA_AUTO_CALIBRATION) - #define _DELTA_TOWER_MOVE_RADIUS DELTA_CALIBRATION_RADIUS - #else - #define _DELTA_TOWER_MOVE_RADIUS DELTA_PRINTABLE_RADIUS - #endif - // Move directly to the tower position with uninterpolated moves // If we used interpolated moves it would cause this to become re-entrant void _goto_tower_pos(const float &a) { current_position[Z_AXIS] = max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5; line_to_current(Z_AXIS); - current_position[X_AXIS] = a < 0 ? LOGICAL_X_POSITION(X_HOME_POS) : sin(a) * -(_DELTA_TOWER_MOVE_RADIUS); - current_position[Y_AXIS] = a < 0 ? LOGICAL_Y_POSITION(Y_HOME_POS) : cos(a) * (_DELTA_TOWER_MOVE_RADIUS); + current_position[X_AXIS] = a < 0 ? LOGICAL_X_POSITION(X_HOME_POS) : sin(a) * -(delta_calibration_radius); + current_position[Y_AXIS] = a < 0 ? LOGICAL_Y_POSITION(Y_HOME_POS) : cos(a) * (delta_calibration_radius); line_to_current(Z_AXIS); current_position[Z_AXIS] = 4.0; From d4f593d200971103963f0a8ae6c58b9a12c5b224 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Tue, 18 Apr 2017 14:44:26 +0200 Subject: [PATCH 02/18] Delete 'expert level' and getting rid off verbose level 3 and configuration_adv settings --- Marlin/Marlin_main.cpp | 145 +++++------------- .../FLSUN/auto_calibrate/Configuration_adv.h | 19 --- .../FLSUN/kossel_mini/Configuration_adv.h | 21 +-- .../delta/generic/Configuration_adv.h | 21 +-- .../delta/kossel_mini/Configuration_adv.h | 21 +-- .../delta/kossel_pro/Configuration_adv.h | 22 +-- .../delta/kossel_xl/Configuration_adv.h | 19 --- 7 files changed, 39 insertions(+), 229 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 2e28f4603..abeeefc59 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -61,7 +61,7 @@ * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location) * G31 - Dock sled (Z_PROBE_SLED only) * G32 - Undock sled (Z_PROBE_SLED only) - * G33 - Delta '4-point' auto calibration iteration + * G33 - Delta '4-7-point' auto calibration : "G33 C V" (Requires DELTA) * G38 - Probe target - similar to G28 except it uses the Z_MIN_PROBE for all three axes * G90 - Use Absolute Coordinates * G91 - Use Relative Coordinates @@ -4982,32 +4982,23 @@ inline void gcode_G28() { #if ENABLED(DELTA_AUTO_CALIBRATION) /** - * G33: Delta '4-point' auto calibration iteration - * - * Usage: G33 - * - * C (default) = Calibrate endstops, height and delta radius - * - * -2, 1-4: n x n probe points, default 3 x 3 - * - * 1: probe center - * set height only - useful when z_offset is changed - * 2: probe center and towers - * solve one '4 point' calibration - * -2: probe center and opposite the towers - * solve one '4 point' calibration - * 3: probe 3 center points, towers and opposite-towers - * averages between 2 '4 point' calibrations - * 4: probe 4 center points, towers, opposite-towers and itermediate points - * averages between 4 '4 point' calibrations - * - * V Verbose level (0-3, default 1) - * - * 0: Dry-run mode: no calibration - * 1: Settings - * 2: Setting + probe results - * 3: Expert mode: setting + iteration factors (see Configuration_adv.h) - * This prematurely stops the iteration process when factors are found + * G33 - Delta '4-7-point' auto calibration (Requires DELTA) + * + * Usage: + * G33 + * + * Cn = (default) = calibrates height ('1 point'), endstops, and delta radius with '4 point' + * and calibrates tower angles with '7+ point' + * n= -2, 1-7 : n*n probe points + * n=1 probes center - sets height only - usefull when z_offset is changed + * n=2 probes center and towers + * n=-2 probes center and opposite towers + * n=3 probes all points: center, towers and opposite towers + * n>3 probes all points multiple times and averages + * Vn = verbose level (n=0-3 default 1) + * n=0 dry-run mode: no calibration + * n=1 settings + * n=2 setting + probe results */ inline void gcode_G33() { @@ -5022,16 +5013,7 @@ inline void gcode_G28() { int8_t verbose_level = code_seen('V') ? code_value_byte() : 1; - #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) - #define _MAX_M33_V 3 - if (verbose_level == 3 && probe_points == 1) verbose_level--; // needs at least 4 points - #else - #define _MAX_M33_V 2 - if (verbose_level > 2) - SERIAL_PROTOCOLLNPGM("Enable DELTA_CALIBRATE_EXPERT_MODE in Configuration_adv.h"); - #endif - - if (!WITHIN(verbose_level, 0, _MAX_M33_V)) verbose_level = 1; + if (!WITHIN(verbose_level, 0, 2)) verbose_level = 1; float zero_std_dev = verbose_level ? 999.0 : 0.0; // 0.0 in dry-run mode : forced end @@ -5041,20 +5023,12 @@ inline void gcode_G28() { dr_old = delta_radius, zh_old = home_offset[Z_AXIS]; COPY(e_old,endstop_adj); - #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) - // expert variables - float h_f_old = 1.00, r_f_old = 0.00, - h_diff_min = 1.00, r_diff_max = 0.10; - #endif // print settings SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate"); SERIAL_PROTOCOLPGM("Checking... AC"); if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)"); - #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) - if (verbose_level == 3) SERIAL_PROTOCOLPGM(" (EXPERT)"); - #endif SERIAL_EOL; LCD_MESSAGEPGM("Checking... AC"); @@ -5084,16 +5058,8 @@ inline void gcode_G28() { setup_for_endstop_or_probe_move(); - test_precision = - #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) - // Expert mode : forced end at std_dev < 0.1 - (verbose_level == 3 && zero_std_dev < 0.1) ? 0.0 : - #endif - zero_std_dev - ; - + test_precision = zero_std_dev; float z_at_pt[13] = { 0 }; - iterations++; // probe the points @@ -5149,21 +5115,19 @@ inline void gcode_G28() { zh_old = home_offset[Z_AXIS]; float e_delta[XYZ] = { 0.0 }, r_delta = 0.0; - - #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) - float h_f_new = 0.0, r_f_new = 0.0 , t_f_new = 0.0, - h_diff = 0.00, r_diff = 0.00; - #endif + const float r_diff = delta_radius - delta_calibration_radius, + h_factor = 1.00 + r_diff * 0.001, + r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)); //2.25 for r_diff = 20mm #define ZP(N,I) ((N) * z_at_pt[I]) #define Z1000(I) ZP(1.00, I) - #define Z1050(I) ZP(H_FACTOR, I) - #define Z0700(I) ZP((H_FACTOR) * 2.0 / 3.00, I) - #define Z0350(I) ZP((H_FACTOR) / 3.00, I) - #define Z0175(I) ZP((H_FACTOR) / 6.00, I) - #define Z2250(I) ZP(R_FACTOR, I) - #define Z0750(I) ZP((R_FACTOR) / 3.00, I) - #define Z0375(I) ZP((R_FACTOR) / 6.00, I) + #define Z1050(I) ZP(h_factor, I) + #define Z0700(I) ZP(h_factor * 2.0 / 3.00, I) + #define Z0350(I) ZP(h_factor / 3.00, I) + #define Z0175(I) ZP(h_factor / 6.00, I) + #define Z2250(I) ZP(r_factor, I) + #define Z0750(I) ZP(r_factor / 3.00, I) + #define Z0375(I) ZP(r_factor / 6.00, I) switch (probe_points) { case 1: @@ -5193,28 +5157,7 @@ inline void gcode_G28() { break; } - #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) - // Calculate h & r factors - if (verbose_level == 3) { - LOOP_XYZ(axis) h_f_new += e_delta[axis] / 3; - r_f_new = r_delta; - h_diff = (1.0 / H_FACTOR) * (h_f_old - h_f_new) / h_f_old; - if (h_diff < h_diff_min && h_diff > 0.9) h_diff_min = h_diff; - if (r_f_old != 0) - r_diff = ( 0.0301 * sq(R_FACTOR) * R_FACTOR - + 0.311 * sq(R_FACTOR) - + 1.1493 * R_FACTOR - + 1.7952 - ) * (r_f_old - r_f_new) / r_f_old; - if (r_diff > r_diff_max && r_diff < 0.4444) r_diff_max = r_diff; - SERIAL_EOL; - - h_f_old = h_f_new; - r_f_old = r_f_new; - } - #endif // DELTA_CALIBRATE_EXPERT_MODE - - // Adjust delta_height and endstops by the max amount + // adjust delta_height and endstops by the max amount LOOP_XYZ(axis) endstop_adj[axis] += e_delta[axis]; delta_radius += r_delta; @@ -5235,17 +5178,6 @@ inline void gcode_G28() { // print report - #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) - if (verbose_level == 3) { - const float r_factor = 22.902 * sq(r_diff_max) * r_diff_max - - 44.988 * sq(r_diff_max) - + 31.697 * r_diff_max - - 9.4439; - SERIAL_PROTOCOLPAIR("h_factor:", 1.0 / h_diff_min); - SERIAL_PROTOCOLPAIR(" r_factor:", r_factor); - SERIAL_EOL; - } - #endif if (verbose_level == 2) { SERIAL_PROTOCOLPGM(". c:"); if (z_at_pt[0] > 0) SERIAL_CHAR('+'); @@ -5277,7 +5209,7 @@ inline void gcode_G28() { } } if (test_precision != 0.0) { // !forced end - if (zero_std_dev >= test_precision) { + if (zero_std_dev >= test_precision) { // end iterations SERIAL_PROTOCOLPGM("Calibration OK"); SERIAL_PROTOCOLLNPGM(" rolling back 1"); LCD_MESSAGEPGM("Calibration OK"); @@ -5311,16 +5243,9 @@ inline void gcode_G28() { SERIAL_PROTOCOLLNPGM("save with M500 and/or copy to configuration.h"); } else { // forced end - #if ENABLED(DELTA_CALIBRATE_EXPERT_MODE) - if (verbose_level == 3) - SERIAL_PROTOCOLLNPGM("Copy to Configuration_adv.h"); - else - #endif - { - SERIAL_PROTOCOLPGM("End DRY-RUN std dev:"); - SERIAL_PROTOCOL_F(zero_std_dev, 3); - SERIAL_EOL; - } + SERIAL_PROTOCOLPGM("End DRY-RUN std dev:"); + SERIAL_PROTOCOL_F(zero_std_dev, 3); + SERIAL_EOL; } clean_up_after_endstop_or_probe_move(); diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h index 220bfa471..166c4b626 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -431,25 +431,6 @@ // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} // AZTEEG_X3_PRO -//=========================================================================== -//============================== Delta Settings ============================= -//=========================================================================== - -#if ENABLED(DELTA_AUTO_CALIBRATION) - /** - * Set the height short (H-10) with M665 Hx.xx. - * Set the delta_radius offset (R-5, R-10, R+5, R+10) with M665 Rx.xx. - * Run G33 Cx V3 (C2, C-2) with different values for C and R - * Take the average for R_FACTOR and maximum for H_FACTOR. - * Run the tests with default values!!! - */ - //#define DELTA_CALIBRATE_EXPERT_MODE - - // Remove the comments of the folling 2 lines to overide default values - #define H_FACTOR 1.02 // 1.0 < H_FACTOR < 1.11, default 1.00 - #define R_FACTOR -3.95 // -6.7 < R_FACTOR < -2.25, default -2.25 -#endif - //=========================================================================== //=============================Additional Features=========================== //=========================================================================== diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h index eed1171b9..b28d8e0d4 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -1,4 +1,4 @@ -/** +/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * @@ -431,25 +431,6 @@ // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} // AZTEEG_X3_PRO -//=========================================================================== -//============================== Delta Settings ============================= -//=========================================================================== - -#if ENABLED(DELTA_AUTO_CALIBRATION) - /** - * Set the height short (H-10) with M665 Hx.xx. - * Set the delta_radius offset (R-5, R-10, R+5, R+10) with M665 Rx.xx. - * Run G33 Cx V3 (C2, C-2) with different values for C and R - * Take the average for R_FACTOR and maximum for H_FACTOR. - * Run the tests with default values!!! - */ - //#define DELTA_CALIBRATE_EXPERT_MODE - - // Remove the comments of the folling 2 lines to overide default values - #define H_FACTOR 1.02 // 1.0 < H_FACTOR < 1.11, default 1.00 - #define R_FACTOR -3.95 // -6.7 < R_FACTOR < -2.25, default -2.25 -#endif - //=========================================================================== //=============================Additional Features=========================== //=========================================================================== diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 7de00f080..d1ebc9a38 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -1,4 +1,4 @@ -/** +/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * @@ -431,25 +431,6 @@ // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} // AZTEEG_X3_PRO -//=========================================================================== -//============================== Delta Settings ============================= -//=========================================================================== - -#if ENABLED(DELTA_AUTO_CALIBRATION) - /** - * Set the height short (H-10) with M665 Hx.xx. - * Set the delta_radius offset (R-5, R-10, R+5, R+10) with M665 Rx.xx. - * Run G33 Cx V3 (C2, C-2) with different values for C and R - * Take the average for R_FACTOR and maximum for H_FACTOR. - * Run the tests with default values!!! - */ - //#define DELTA_CALIBRATE_EXPERT_MODE - - // Remove the comments of the folling 2 lines to overide default values - //#define H_FACTOR 1.02 // 1.0 < H_FACTOR < 1.11, default 1.00 - //#define R_FACTOR -3.95 // -6.7 < R_FACTOR < -2.25, default -2.25 -#endif - //=========================================================================== //=============================Additional Features=========================== //=========================================================================== diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 7de00f080..d1ebc9a38 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -1,4 +1,4 @@ -/** +/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * @@ -431,25 +431,6 @@ // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} // AZTEEG_X3_PRO -//=========================================================================== -//============================== Delta Settings ============================= -//=========================================================================== - -#if ENABLED(DELTA_AUTO_CALIBRATION) - /** - * Set the height short (H-10) with M665 Hx.xx. - * Set the delta_radius offset (R-5, R-10, R+5, R+10) with M665 Rx.xx. - * Run G33 Cx V3 (C2, C-2) with different values for C and R - * Take the average for R_FACTOR and maximum for H_FACTOR. - * Run the tests with default values!!! - */ - //#define DELTA_CALIBRATE_EXPERT_MODE - - // Remove the comments of the folling 2 lines to overide default values - //#define H_FACTOR 1.02 // 1.0 < H_FACTOR < 1.11, default 1.00 - //#define R_FACTOR -3.95 // -6.7 < R_FACTOR < -2.25, default -2.25 -#endif - //=========================================================================== //=============================Additional Features=========================== //=========================================================================== diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 40e7259ed..3e3ce52d6 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -1,4 +1,4 @@ -/** +/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * @@ -436,26 +436,6 @@ // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} // AZTEEG_X3_PRO -//=========================================================================== -//============================== Delta Settings ============================= -//=========================================================================== - -#if ENABLED(DELTA_AUTO_CALIBRATION) - /** - * Set the height short (H-10) with M665 Hx.xx. - * Set the delta_radius offset (R-5, R-10, R+5, R+10) with M665 Rx.xx. - * Run G33 Cx V3 (C2, C-2) with different values for C and R - * Take the average for R_FACTOR and maximum for H_FACTOR. - * Run the tests with default values!!! - */ - //#define DELTA_CALIBRATE_EXPERT_MODE - - // Remove the comments of the folling 2 lines to overide default values - //#define H_FACTOR 1.02 // 1.0 < H_FACTOR < 1.11, default 1.00 - //#define R_FACTOR -3.95 // -6.7 < R_FACTOR < -2.25, default -2.25 -#endif - - //=========================================================================== //=============================Additional Features=========================== //=========================================================================== diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 8268e4293..e4e613d33 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -431,25 +431,6 @@ // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} // AZTEEG_X3_PRO -//=========================================================================== -//============================== Delta Settings ============================= -//=========================================================================== - -#if ENABLED(DELTA_AUTO_CALIBRATION) - /** - * Set the height short (H-10) with M665 Hx.xx. - * Set the delta_radius offset (R-5, R-10, R+5, R+10) with M665 Rx.xx. - * Run G33 Cx V3 (C2, C-2) with different values for C and R - * Take the average for R_FACTOR and maximum for H_FACTOR. - * Run the tests with default values!!! - */ - //#define DELTA_CALIBRATE_EXPERT_MODE - - // Remove the comments of the folling 2 lines to overide default values - //#define H_FACTOR 1.02 // 1.0 < H_FACTOR < 1.11, default 1.00 - //#define R_FACTOR -3.95 // -6.7 < R_FACTOR < -2.25, default -2.25 -#endif - //=========================================================================== //=============================Additional Features=========================== //=========================================================================== From 76ec7a0f80d3af356eca04140243842fdb62c37e Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Tue, 18 Apr 2017 16:03:39 +0200 Subject: [PATCH 03/18] Adding upto 7*7 probe grids - adding Cn 5, 6 and 7 --- Marlin/Marlin_main.cpp | 44 +++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index abeeefc59..98a5e9f10 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5009,7 +5009,7 @@ inline void gcode_G28() { #endif const int8_t pp = code_seen('C') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS, - probe_points = (WITHIN(pp, 1, 4) || pp == -2) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS; + probe_points = (WITHIN(pp, 1, 7) || pp == -2) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS; int8_t verbose_level = code_seen('V') ? code_value_byte() : 1; @@ -5066,39 +5066,47 @@ inline void gcode_G28() { int16_t center_points = 0; - if (probe_points != 3) { + if (probe_points != 3 && probe_points != 6) { // probe centre z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1); center_points = 1; } - int16_t step_axis = 4; - if (probe_points >= 3) { - for (int8_t axis = 9; axis > 0; axis -= step_axis) { // uint8_t starts endless loop + int16_t step_axis = (probe_points > 4) ? 2 : 4; + if (probe_points >= 3) { // probe extra 3 or 6 centre points + for (int8_t axis = (probe_points > 4) ? 11 : 9; axis > 0; axis -= step_axis) { z_at_pt[0] += probe_pt( - 0.1 * cos(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), - 0.1 * sin(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), true, 1); + cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), + sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1); } - center_points += 3; + center_points += (probe_points > 4) ? 6 : 3; // average centre points z_at_pt[0] /= center_points; } float S1 = z_at_pt[0], S2 = sq(S1); int16_t N = 1, start = (probe_points == -2) ? 3 : 1; - step_axis = (abs(probe_points) == 2) ? 4 : (probe_points == 3) ? 2 : 1; + step_axis = (abs(probe_points) == 2) ? 4 : (probe_points == 4 || probe_points > 5) ? 1 : 2; + float start_circles = (probe_points > 6) ? -1.5 : (probe_points > 4) ? -1 : 0, // one or multi radius points + end_circles = (probe_points > 6) ? 1.5 : (probe_points > 4) ? 1 : 0; // one or multi radius points + int8_t zig_zag = 1; if (probe_points != 1) { - for (uint8_t axis = start; axis < 13; axis += step_axis) - z_at_pt[axis] += probe_pt( - cos(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), - sin(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), true, 1 - ); - - if (probe_points == 4) step_axis = 2; + for (uint8_t axis = start; axis < 13; axis += step_axis) { // probes 3, 6 or 12 points on the calibration radius + for (float circles = start_circles ; circles <= end_circles; circles++) // one or multi radius points + z_at_pt[axis] += probe_pt( + cos(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * zig_zag) * delta_calibration_radius), + sin(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * zig_zag) * delta_calibration_radius), true, 1); + + if (probe_points > 5) start_circles += (zig_zag == 1) ? +0.5 : -0.5; // opposite one radius point less + if (probe_points > 5) end_circles += (zig_zag == 1) ? -0.5 : +0.5; + zig_zag = -zig_zag; + if (probe_points > 4) z_at_pt[axis] /= (zig_zag == 1) ? 3.0 : 2.0; // average between radius points + } } + if (probe_points == 4 || probe_points > 5) step_axis = 2; - for (uint8_t axis = start; axis < 13; axis += step_axis) { - if (probe_points == 4) + for (uint8_t axis = start; axis < 13; axis += step_axis) { // average half intermediates to tower and opposite + if (probe_points == 4 || probe_points > 5) z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0; S1 += z_at_pt[axis]; From 004928148cafbb924e37898a1e8e58aedb9068f5 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Tue, 18 Apr 2017 16:49:33 +0200 Subject: [PATCH 04/18] Tower angles Adding '7-point' tower angle correction calibration --- Marlin/Marlin_main.cpp | 57 +++++++++++++++++++++++++++------- Marlin/configuration_store.cpp | 2 +- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 98a5e9f10..75c472ea8 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5021,7 +5021,9 @@ inline void gcode_G28() { float e_old[XYZ], dr_old = delta_radius, - zh_old = home_offset[Z_AXIS]; + zh_old = home_offset[Z_AXIS], + alpha_old = delta_tower_angle_trim[A_AXIS], + beta_old = delta_tower_angle_trim[B_AXIS]; COPY(e_old,endstop_adj); // print settings @@ -5032,7 +5034,7 @@ inline void gcode_G28() { SERIAL_EOL; LCD_MESSAGEPGM("Checking... AC"); - SERIAL_PROTOCOLPAIR("Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); + SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); if (abs(probe_points) > 1) { SERIAL_PROTOCOLPGM(" Ex:"); if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); @@ -5046,6 +5048,16 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } SERIAL_EOL; + if (probe_points > 2) { + SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); + if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); + SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); + SERIAL_PROTOCOLPGM(" Ty:"); + if (delta_tower_angle_trim[B_AXIS] >= 0) SERIAL_CHAR('+'); + SERIAL_PROTOCOL_F(delta_tower_angle_trim[B_AXIS], 2); + SERIAL_PROTOCOLPGM(" Tz:+0.00"); + SERIAL_EOL; + } #if ENABLED(Z_PROBE_SLED) DEPLOY_PROBE(); @@ -5121,11 +5133,15 @@ inline void gcode_G28() { COPY(e_old, endstop_adj); dr_old = delta_radius; zh_old = home_offset[Z_AXIS]; + alpha_old = delta_tower_angle_trim[A_AXIS]; + beta_old = delta_tower_angle_trim[B_AXIS]; - float e_delta[XYZ] = { 0.0 }, r_delta = 0.0; + float e_delta[XYZ] = { 0.0 }, r_delta = 0.0, + t_alpha = 0.0, t_beta = 0.0; const float r_diff = delta_radius - delta_calibration_radius, h_factor = 1.00 + r_diff * 0.001, - r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)); //2.25 for r_diff = 20mm + r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)), //2.25 for r_diff = 20mm + a_factor = 100.0 / delta_calibration_radius; #define ZP(N,I) ((N) * z_at_pt[I]) #define Z1000(I) ZP(1.00, I) @@ -5136,6 +5152,8 @@ inline void gcode_G28() { #define Z2250(I) ZP(r_factor, I) #define Z0750(I) ZP(r_factor / 3.00, I) #define Z0375(I) ZP(r_factor / 6.00, I) + #define Z0444(I) ZP(a_factor * 4.0 / 9.0, I) + #define Z0888(I) ZP(a_factor * 8.0 / 9.0, I) switch (probe_points) { case 1: @@ -5151,10 +5169,10 @@ inline void gcode_G28() { break; case -2: - e_delta[X_AXIS] = Z1050(0) - Z0700(7) + Z0350(11) + Z0350(3); - e_delta[Y_AXIS] = Z1050(0) + Z0350(7) - Z0700(11) + Z0350(3); - e_delta[Z_AXIS] = Z1050(0) + Z0350(7) + Z0350(11) - Z0700(3); - r_delta = Z2250(0) - Z0750(7) - Z0750(11) - Z0750(3); + e_delta[X_AXIS] = Z1050(0) - Z0700(7) + Z0350(11) + Z0350(3); + e_delta[Y_AXIS] = Z1050(0) + Z0350(7) - Z0700(11) + Z0350(3); + e_delta[Z_AXIS] = Z1050(0) + Z0350(7) + Z0350(11) - Z0700(3); + r_delta = Z2250(0) - Z0750(7) - Z0750(11) - Z0750(3); break; default: @@ -5162,6 +5180,8 @@ inline void gcode_G28() { e_delta[Y_AXIS] = Z1050(0) - Z0175(1) + Z0350(5) - Z0175(9) + Z0175(7) - Z0350(11) + Z0175(3); e_delta[Z_AXIS] = Z1050(0) - Z0175(1) - Z0175(5) + Z0350(9) + Z0175(7) + Z0175(11) - Z0350(3); r_delta = Z2250(0) - Z0375(1) - Z0375(5) - Z0375(9) - Z0375(7) - Z0375(11) - Z0375(3); + t_alpha = + Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3); + t_beta = - Z0888(1) + Z0444(5) + Z0444(9) - Z0888(7) + Z0444(11) + Z0444(3); break; } @@ -5173,6 +5193,9 @@ inline void gcode_G28() { home_offset[Z_AXIS] -= z_temp; LOOP_XYZ(i) endstop_adj[i] -= z_temp; + delta_tower_angle_trim[A_AXIS] += t_alpha; + delta_tower_angle_trim[B_AXIS] -= t_beta; + recalc_delta_settings(delta_radius, delta_diagonal_rod); } else { // !iterate @@ -5180,6 +5203,8 @@ inline void gcode_G28() { COPY(endstop_adj, e_old); delta_radius = dr_old; home_offset[Z_AXIS] = zh_old; + delta_tower_angle_trim[A_AXIS] = alpha_old; + delta_tower_angle_trim[B_AXIS] = beta_old; recalc_delta_settings(delta_radius, delta_diagonal_rod); } @@ -5219,7 +5244,7 @@ inline void gcode_G28() { if (test_precision != 0.0) { // !forced end if (zero_std_dev >= test_precision) { // end iterations SERIAL_PROTOCOLPGM("Calibration OK"); - SERIAL_PROTOCOLLNPGM(" rolling back 1"); + SERIAL_PROTOCOLLNPGM(" rolling back."); LCD_MESSAGEPGM("Calibration OK"); SERIAL_EOL; } @@ -5228,12 +5253,12 @@ inline void gcode_G28() { if (iterations < 31) sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations); SERIAL_PROTOCOL(mess); - SERIAL_PROTOCOLPGM(" std dev:"); + SERIAL_PROTOCOLPGM(" std dev:"); SERIAL_PROTOCOL_F(zero_std_dev, 3); SERIAL_EOL; lcd_setstatus(mess); } - SERIAL_PROTOCOLPAIR("Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); + SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); if (abs(probe_points) > 1) { SERIAL_PROTOCOLPGM(" Ex:"); if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); @@ -5247,6 +5272,16 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } SERIAL_EOL; + if (probe_points > 2) { + SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); + if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); + SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); + SERIAL_PROTOCOLPGM(" Ty:"); + if (delta_tower_angle_trim[B_AXIS] >= 0) SERIAL_CHAR('+'); + SERIAL_PROTOCOL_F(delta_tower_angle_trim[B_AXIS], 2); + SERIAL_PROTOCOLPGM(" Tz:+0.00"); + SERIAL_EOL; + } if (zero_std_dev >= test_precision) SERIAL_PROTOCOLLNPGM("save with M500 and/or copy to configuration.h"); } diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index c0c3b8d7e..6a88ef480 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -1477,7 +1477,7 @@ void MarlinSettings::reset() { SERIAL_ECHOPAIR(" R", LINEAR_UNIT(delta_radius)); SERIAL_ECHOPAIR(" H", LINEAR_UNIT(DELTA_HEIGHT + home_offset[Z_AXIS])); SERIAL_ECHOPAIR(" S", delta_segments_per_second); - SERIAL_ECHOPAIR(" B", LINEAR_UNIT(delta_calibration_radius); + SERIAL_ECHOPAIR(" B", LINEAR_UNIT(delta_calibration_radius)); SERIAL_ECHOPAIR(" X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS])); SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(delta_tower_angle_trim[B_AXIS])); SERIAL_ECHOPAIR(" Z", 0.00); From 244f67590ee9ebf6e6a7e6abaafaa2cd233e0c1d Mon Sep 17 00:00:00 2001 From: teemuatlut Date: Sat, 22 Apr 2017 02:23:56 +0300 Subject: [PATCH 05/18] Delta probe height bug solved --- Marlin/Marlin_main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 75c472ea8..18cb090d1 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1828,6 +1828,9 @@ static void clean_up_after_endstop_or_probe_move() { float z_dest = LOGICAL_Z_POSITION(z_raise); if (zprobe_zoffset < 0) z_dest -= zprobe_zoffset; + #if ENABLED(DELTA) + z_dest -= home_offset[Z_AXIS]; + #endif if (z_dest > current_position[Z_AXIS]) do_blocking_move_to_z(z_dest); @@ -2254,6 +2257,9 @@ static void clean_up_after_endstop_or_probe_move() { // move down quickly before doing the slow probe float z = LOGICAL_Z_POSITION(Z_CLEARANCE_BETWEEN_PROBES); if (zprobe_zoffset < 0) z -= zprobe_zoffset; + #if ENABLED(DELTA) + z -= home_offset[Z_AXIS]; + #endif if (z < current_position[Z_AXIS]) do_blocking_move_to_z(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); From dcf30a69d6604c887a412249f70e0f94e4dd87f3 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Sat, 22 Apr 2017 10:39:48 +0200 Subject: [PATCH 06/18] Allowing #define DELTA_TOWER_ANGLE_TRIM[C_AXIS] More consistent with M665 where C-value is allowed as well, then normalized --- Marlin/Conditionals_post.h | 2 +- Marlin/Marlin_main.cpp | 4 ++-- Marlin/configuration_store.cpp | 5 +++-- .../delta/FLSUN/auto_calibrate/Configuration.h | 2 +- .../delta/FLSUN/kossel_mini/Configuration.h | 2 +- Marlin/example_configurations/delta/generic/Configuration.h | 2 +- .../example_configurations/delta/kossel_mini/Configuration.h | 2 +- .../example_configurations/delta/kossel_pro/Configuration.h | 2 +- .../example_configurations/delta/kossel_xl/Configuration.h | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 617384bd5..4b4dc4d94 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -698,7 +698,7 @@ #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } #endif #ifndef DELTA_TOWER_ANGLE_TRIM - #define DELTA_TOWER_ANGLE_TRIM {0.0, 0.0} + #define DELTA_TOWER_ANGLE_TRIM {0.0, 0.0, 0.0} #endif #ifndef DELTA_RADIUS_TRIM_TOWER #define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 18cb090d1..08b25e233 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -7524,8 +7524,8 @@ inline void gcode_M205() { if (code_seen('X')) delta_tower_angle_trim[A_AXIS] = code_value_linear_units(); if (code_seen('Y')) delta_tower_angle_trim[B_AXIS] = code_value_linear_units(); if (code_seen('Z')) { // rotate all 3 axis for Z = 0 - delta_tower_angle_trim[A_AXIS] += code_value_linear_units(); - delta_tower_angle_trim[B_AXIS] = code_value_linear_units(); + delta_tower_angle_trim[A_AXIS] -= code_value_linear_units(); + delta_tower_angle_trim[B_AXIS] -= code_value_linear_units(); } recalc_delta_settings(delta_radius, delta_diagonal_rod); } diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index 6a88ef480..eff32dc8d 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -1066,13 +1066,14 @@ void MarlinSettings::reset() { #if ENABLED(DELTA) const float adj[ABC] = DELTA_ENDSTOP_ADJ, - dta[2] = DELTA_TOWER_ANGLE_TRIM; + dta[3] = DELTA_TOWER_ANGLE_TRIM; COPY(endstop_adj, adj); delta_radius = DELTA_RADIUS; delta_diagonal_rod = DELTA_DIAGONAL_ROD; delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND; delta_calibration_radius = DELTA_CALIBRATION_RADIUS; - COPY(delta_tower_angle_trim, dta); + delta_tower_angle_trim[A_AXIS] = dta[A_AXIS] - dta[C_AXIS]; + delta_tower_angle_trim[B_AXIS] = dta[B_AXIS] - dta[C_AXIS]; home_offset[Z_AXIS] = 0; #elif ENABLED(Z_DUAL_ENDSTOPS) diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h index 9b6adff67..bb53080d8 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h @@ -488,7 +488,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h index c88d3d1dc..dbcc9441e 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h @@ -489,7 +489,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 744362c94..3fb5cf748 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -480,7 +480,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index c4a91ee8a..98acaa0de 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -478,7 +478,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 34b6d0215..a086c70a3 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -467,7 +467,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index b93620313..c5e56355f 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -483,7 +483,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { -0.00, -0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} From a9bc1d30cc0e5c9105a0aa3729f45d34ab2c764b Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Wed, 26 Apr 2017 20:30:58 +0200 Subject: [PATCH 07/18] z_offset change Avoids to have to recalibrate the delta_height after a z_offset change --- Marlin/Marlin_main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 08b25e233..44d77a796 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8488,6 +8488,10 @@ inline void gcode_M503() { #else UNUSED(no_babystep); #endif + + #if ENABLED(DELTA) // correct the delta_height + home_offset[Z_AXIS] -= diff; + #endif } last_zoffset = zprobe_zoffset; From d8102aeca83e090e1c7618c8eeb40b50ed6d9e95 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Thu, 27 Apr 2017 18:41:26 +0200 Subject: [PATCH 08/18] Cn negative : no tower angle calibration Giving a negative number of probe points disables the tower angle correction calibration ('4point' instead of '7point' solution) EEPROM version updated --- Marlin/Marlin_main.cpp | 112 +++++++++++++++++++++++------------------ Marlin/ultralcd.cpp | 2 +- 2 files changed, 65 insertions(+), 49 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 44d77a796..5a0cf5233 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4993,15 +4993,18 @@ inline void gcode_G28() { * Usage: * G33 * - * Cn = (default) = calibrates height ('1 point'), endstops, and delta radius with '4 point' - * and calibrates tower angles with '7+ point' - * n= -2, 1-7 : n*n probe points - * n=1 probes center - sets height only - usefull when z_offset is changed - * n=2 probes center and towers - * n=-2 probes center and opposite towers - * n=3 probes all points: center, towers and opposite towers - * n>3 probes all points multiple times and averages - * Vn = verbose level (n=0-3 default 1) + * Cn = n=-7 -> +7 : n*n probe points + * calibrates height ('1 point'), endstops, and delta radius ('4 points') + * and calibrates tower angles with n >= 3 ('7+ points') + * n=0 + * n=1 probes center / sets height only + * n=-1 same but 1 iteration only + * n=2 probes center and towers / sets height, endstops and delta radius + * n=-2 same but opposite towers + * n=3 probes all points: center, towers and opposite towers / sets all + * n>3 probes all points multiple times and averages + * n<=3 same but tower angle calibration disabled + * Vn = verbose level (n=0-2 default 1) * n=0 dry-run mode: no calibration * n=1 settings * n=2 setting + probe results @@ -5015,13 +5018,13 @@ inline void gcode_G28() { #endif const int8_t pp = code_seen('C') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS, - probe_points = (WITHIN(pp, 1, 7) || pp == -2) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS; + probe_points = (WITHIN(pp, -7, -1) || WITHIN(pp, 1, 7)) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS; int8_t verbose_level = code_seen('V') ? code_value_byte() : 1; if (!WITHIN(verbose_level, 0, 2)) verbose_level = 1; - float zero_std_dev = verbose_level ? 999.0 : 0.0; // 0.0 in dry-run mode : forced end + float zero_std_dev = verbose_level ? 999.0 : 0.0; // 0.0 in dry-run mode : forced end gcode_G28(); @@ -5084,54 +5087,54 @@ inline void gcode_G28() { int16_t center_points = 0; - if (probe_points != 3 && probe_points != 6) { // probe centre + if (abs(probe_points) != 3 && abs(probe_points != 6)) { // probe centre z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1); center_points = 1; } - int16_t step_axis = (probe_points > 4) ? 2 : 4; - if (probe_points >= 3) { // probe extra 3 or 6 centre points - for (int8_t axis = (probe_points > 4) ? 11 : 9; axis > 0; axis -= step_axis) { + int16_t step_axis = (abs(probe_points) > 4) ? 2 : 4; + if (abs(probe_points) >= 3) { // probe extra 3 or 6 centre points + for (int8_t axis = (abs(probe_points) > 4) ? 11 : 9; axis > 0; axis -= step_axis) { z_at_pt[0] += probe_pt( cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1); } - center_points += (probe_points > 4) ? 6 : 3; // average centre points + center_points += (abs(probe_points) > 4) ? 6 : 3; // average centre points z_at_pt[0] /= center_points; } float S1 = z_at_pt[0], S2 = sq(S1); int16_t N = 1, start = (probe_points == -2) ? 3 : 1; - step_axis = (abs(probe_points) == 2) ? 4 : (probe_points == 4 || probe_points > 5) ? 1 : 2; - float start_circles = (probe_points > 6) ? -1.5 : (probe_points > 4) ? -1 : 0, // one or multi radius points - end_circles = (probe_points > 6) ? 1.5 : (probe_points > 4) ? 1 : 0; // one or multi radius points + step_axis = (abs(probe_points) == 2) ? 4 : (abs(probe_points) == 4 || abs(probe_points) > 5) ? 1 : 2; + float start_circles = (abs(probe_points) > 6) ? -1.5 : (abs(probe_points) > 4) ? -1 : 0, // one or multi radius points + end_circles = (abs(probe_points) > 6) ? 1.5 : (abs(probe_points) > 4) ? 1 : 0; // one or multi radius points int8_t zig_zag = 1; - if (probe_points != 1) { - for (uint8_t axis = start; axis < 13; axis += step_axis) { // probes 3, 6 or 12 points on the calibration radius - for (float circles = start_circles ; circles <= end_circles; circles++) // one or multi radius points + if (abs(probe_points) > 1) { + for (uint8_t axis = start; axis < 13; axis += step_axis) { // probes 3, 6 or 12 points on the calibration radius + for (float circles = start_circles ; circles <= end_circles; circles++) // one or multi radius points z_at_pt[axis] += probe_pt( cos(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * zig_zag) * delta_calibration_radius), sin(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * zig_zag) * delta_calibration_radius), true, 1); - if (probe_points > 5) start_circles += (zig_zag == 1) ? +0.5 : -0.5; // opposite one radius point less - if (probe_points > 5) end_circles += (zig_zag == 1) ? -0.5 : +0.5; + if (abs(probe_points) > 5) start_circles += (zig_zag == 1) ? +0.5 : -0.5; // opposites: one radius point less + if (abs(probe_points) > 5) end_circles += (zig_zag == 1) ? -0.5 : +0.5; zig_zag = -zig_zag; - if (probe_points > 4) z_at_pt[axis] /= (zig_zag == 1) ? 3.0 : 2.0; // average between radius points + if (abs(probe_points) > 4) z_at_pt[axis] /= (zig_zag == 1) ? 3.0 : 2.0; // average between radius points } } - if (probe_points == 4 || probe_points > 5) step_axis = 2; + if (abs(probe_points) == 4 || abs(probe_points) > 5) step_axis = 2; - for (uint8_t axis = start; axis < 13; axis += step_axis) { // average half intermediates to tower and opposite - if (probe_points == 4 || probe_points > 5) + for (uint8_t axis = start; axis < 13; axis += step_axis) { // average half intermediates to towers and opposites + if (abs(probe_points) == 4 || abs(probe_points) > 5) z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0; S1 += z_at_pt[axis]; S2 += sq(z_at_pt[axis]); N++; } - zero_std_dev = round(sqrt(S2 / N) * 1000.0) / 1000.0 + 0.00001; // deviation from zero plane + zero_std_dev = round(sqrt(S2 / N) * 1000.0) / 1000.0 + 0.00001; // deviation from zero plane // Solve matrices @@ -5145,9 +5148,9 @@ inline void gcode_G28() { float e_delta[XYZ] = { 0.0 }, r_delta = 0.0, t_alpha = 0.0, t_beta = 0.0; const float r_diff = delta_radius - delta_calibration_radius, - h_factor = 1.00 + r_diff * 0.001, - r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)), //2.25 for r_diff = 20mm - a_factor = 100.0 / delta_calibration_radius; + h_factor = 1.00 + r_diff * 0.001, //1.02 for r_diff = 20mm + r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)), //2.25 for r_diff = 20mm + a_factor = 100.0 / delta_calibration_radius; //1.25 for cal_rd = 80mm #define ZP(N,I) ((N) * z_at_pt[I]) #define Z1000(I) ZP(1.00, I) @@ -5162,9 +5165,10 @@ inline void gcode_G28() { #define Z0888(I) ZP(a_factor * 8.0 / 9.0, I) switch (probe_points) { + case -1: + test_precision = 0.00; case 1: LOOP_XYZ(i) e_delta[i] = Z1000(0); - r_delta = 0.00; break; case 2: @@ -5186,8 +5190,11 @@ inline void gcode_G28() { e_delta[Y_AXIS] = Z1050(0) - Z0175(1) + Z0350(5) - Z0175(9) + Z0175(7) - Z0350(11) + Z0175(3); e_delta[Z_AXIS] = Z1050(0) - Z0175(1) - Z0175(5) + Z0350(9) + Z0175(7) + Z0175(11) - Z0350(3); r_delta = Z2250(0) - Z0375(1) - Z0375(5) - Z0375(9) - Z0375(7) - Z0375(11) - Z0375(3); - t_alpha = + Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3); - t_beta = - Z0888(1) + Z0444(5) + Z0444(9) - Z0888(7) + Z0444(11) + Z0444(3); + + if (probe_points > 0) { //probe points negative disables tower angles + t_alpha = + Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3); + t_beta = - Z0888(1) + Z0444(5) + Z0444(9) - Z0888(7) + Z0444(11) + Z0444(3); + } break; } @@ -5221,7 +5228,7 @@ inline void gcode_G28() { SERIAL_PROTOCOLPGM(". c:"); if (z_at_pt[0] > 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[0], 2); - if (probe_points > 1) { + if (abs(probe_points) > 2 || probe_points == 2) { SERIAL_PROTOCOLPGM(" x:"); if (z_at_pt[1] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[1], 2); @@ -5232,9 +5239,9 @@ inline void gcode_G28() { if (z_at_pt[9] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[9], 2); } - if (probe_points > 0) SERIAL_EOL; - if (probe_points > 2 || probe_points == -2) { - if (probe_points > 2) SERIAL_PROTOCOLPGM(". "); + if (probe_points != -2) SERIAL_EOL; + if (abs(probe_points) > 2 || probe_points == -2) { + if (abs(probe_points) > 2) SERIAL_PROTOCOLPGM(". "); SERIAL_PROTOCOLPGM(" yz:"); if (z_at_pt[7] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[7], 2); @@ -5247,14 +5254,14 @@ inline void gcode_G28() { SERIAL_EOL; } } - if (test_precision != 0.0) { // !forced end - if (zero_std_dev >= test_precision) { // end iterations + if (test_precision != 0.0) { // !forced end + if (zero_std_dev >= test_precision) { // end iterations SERIAL_PROTOCOLPGM("Calibration OK"); - SERIAL_PROTOCOLLNPGM(" rolling back."); - LCD_MESSAGEPGM("Calibration OK"); + SERIAL_PROTOCOLPGM(" rolling back."); SERIAL_EOL; + LCD_MESSAGEPGM("Calibration OK"); } - else { // !end iterations + else { // !end iterations char mess[15] = "No convergence"; if (iterations < 31) sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations); @@ -5291,10 +5298,19 @@ inline void gcode_G28() { if (zero_std_dev >= test_precision) SERIAL_PROTOCOLLNPGM("save with M500 and/or copy to configuration.h"); } - else { // forced end - SERIAL_PROTOCOLPGM("End DRY-RUN std dev:"); - SERIAL_PROTOCOL_F(zero_std_dev, 3); - SERIAL_EOL; + else { // forced end + if (verbose_level == 0) { + SERIAL_PROTOCOLPGM("End DRY-RUN std dev:"); + SERIAL_PROTOCOL_F(zero_std_dev, 3); + SERIAL_EOL; + } + else { + SERIAL_PROTOCOLLNPGM("Calibration OK"); + LCD_MESSAGEPGM("Calibration OK"); + SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); + SERIAL_EOL; + SERIAL_PROTOCOLLNPGM("save with M500 and/or copy to configuration.h"); + } } clean_up_after_endstop_or_probe_move(); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 50c6fb580..11f127c89 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1834,7 +1834,7 @@ void kill_screen(const char* lcd_msg) { MENU_BACK(MSG_MAIN); #if ENABLED(DELTA_AUTO_CALIBRATION) MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33 C")); - MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 C1")); + MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 C-1")); #endif MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home); if (axis_homed[Z_AXIS]) { From 7a6a1ef5835f3dfcb331c8ffb261c4f0870c1b48 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Thu, 27 Apr 2017 23:24:08 +0200 Subject: [PATCH 09/18] M666 normalize positive values to <=0 M666 + tower radians absolute value --- Marlin/Marlin_main.cpp | 14 +++++++++----- Marlin/ultralcd.cpp | 10 +++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5a0cf5233..cb32ef59e 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5202,7 +5202,7 @@ inline void gcode_G28() { LOOP_XYZ(axis) endstop_adj[axis] += e_delta[axis]; delta_radius += r_delta; - const float z_temp = MAX3(endstop_adj[0], endstop_adj[1], endstop_adj[2]); + const float z_temp = MAX3(endstop_adj[A_AXIS], endstop_adj[B_AXIS], endstop_adj[C_AXIS]); home_offset[Z_AXIS] -= z_temp; LOOP_XYZ(i) endstop_adj[i] -= z_temp; @@ -7570,6 +7570,10 @@ inline void gcode_M205() { SERIAL_ECHOLNPGM("<<< gcode_M666"); } #endif + // normalize endstops so all are <=0; set the residue to delta height + const float z_temp = MAX3(endstop_adj[A_AXIS], endstop_adj[B_AXIS], endstop_adj[C_AXIS]); + home_offset[Z_AXIS] -= z_temp; + LOOP_XYZ(i) endstop_adj[i] -= z_temp; } #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS) @@ -10552,10 +10556,10 @@ void ok_to_send() { void recalc_delta_settings(float radius, float diagonal_rod) { const float trt[ABC] = DELTA_RADIUS_TRIM_TOWER, drt[ABC] = DELTA_DIAGONAL_ROD_TRIM_TOWER; - delta_tower[A_AXIS][X_AXIS] = -cos(RADIANS(30 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); // front left tower - delta_tower[A_AXIS][Y_AXIS] = -sin(RADIANS(30 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); - delta_tower[B_AXIS][X_AXIS] = cos(RADIANS(30 - delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); // front right tower - delta_tower[B_AXIS][Y_AXIS] = -sin(RADIANS(30 - delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); + delta_tower[A_AXIS][X_AXIS] = cos(RADIANS(210 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); // front left tower + delta_tower[A_AXIS][Y_AXIS] = sin(RADIANS(210 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); + delta_tower[B_AXIS][X_AXIS] = cos(RADIANS(330 + delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); // front right tower + delta_tower[B_AXIS][Y_AXIS] = sin(RADIANS(330 + delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); delta_tower[C_AXIS][X_AXIS] = 0.0; // back middle tower delta_tower[C_AXIS][Y_AXIS] = (radius + trt[C_AXIS]); delta_diagonal_rod_2_tower[A_AXIS] = sq(diagonal_rod + drt[A_AXIS]); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 11f127c89..1a32d3ef7 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1811,8 +1811,8 @@ void kill_screen(const char* lcd_msg) { current_position[Z_AXIS] = max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5; line_to_current(Z_AXIS); - current_position[X_AXIS] = a < 0 ? LOGICAL_X_POSITION(X_HOME_POS) : sin(a) * -(delta_calibration_radius); - current_position[Y_AXIS] = a < 0 ? LOGICAL_Y_POSITION(Y_HOME_POS) : cos(a) * (delta_calibration_radius); + current_position[X_AXIS] = a < 0 ? LOGICAL_X_POSITION(X_HOME_POS) : cos(RADIANS(a)) * delta_calibration_radius; + current_position[Y_AXIS] = a < 0 ? LOGICAL_Y_POSITION(Y_HOME_POS) : sin(RADIANS(a)) * delta_calibration_radius; line_to_current(Z_AXIS); current_position[Z_AXIS] = 4.0; @@ -1824,9 +1824,9 @@ void kill_screen(const char* lcd_msg) { lcd_goto_screen(lcd_move_z); } - void _goto_tower_x() { _goto_tower_pos(RADIANS(120)); } - void _goto_tower_y() { _goto_tower_pos(RADIANS(240)); } - void _goto_tower_z() { _goto_tower_pos(0); } + void _goto_tower_x() { _goto_tower_pos(210); } + void _goto_tower_y() { _goto_tower_pos(330); } + void _goto_tower_z() { _goto_tower_pos(90); } void _goto_center() { _goto_tower_pos(-1); } void lcd_delta_calibrate_menu() { From ed6b361e27d3e606ee2c4f37f6de3c99c2a1c022 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Fri, 28 Apr 2017 10:07:17 +0200 Subject: [PATCH 10/18] cleanup ready to squash --- Marlin/configuration_store.cpp | 2 +- .../FLSUN/auto_calibrate/Configuration.h | 59 ++++++++++--------- .../delta/FLSUN/kossel_mini/Configuration.h | 12 ++-- .../delta/generic/Configuration.h | 18 +++--- .../delta/kossel_mini/Configuration.h | 14 ++--- .../delta/kossel_pro/Configuration.h | 16 +++-- .../delta/kossel_xl/Configuration.h | 14 ++--- 7 files changed, 65 insertions(+), 70 deletions(-) diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index eff32dc8d..57a5e068a 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -1066,7 +1066,7 @@ void MarlinSettings::reset() { #if ENABLED(DELTA) const float adj[ABC] = DELTA_ENDSTOP_ADJ, - dta[3] = DELTA_TOWER_ANGLE_TRIM; + dta[ABC] = DELTA_TOWER_ANGLE_TRIM; COPY(endstop_adj, adj); delta_radius = DELTA_RADIUS; delta_diagonal_rod = DELTA_DIAGONAL_ROD; diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h index bb53080d8..ccd039df8 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h @@ -446,28 +446,31 @@ // and processor overload (too many expensive sqrt calls). #define DELTA_SEGMENTS_PER_SECOND 160 + // NOTE NB all values for DELTA_* values MUST be floating point, so always have a decimal point in them + // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 218.0 // mm - +/* // Horizontal offset from middle of printer to smooth rod center. - //#define DELTA_SMOOTH_ROD_OFFSET 150.0 // mm + #define DELTA_SMOOTH_ROD_OFFSET 150.0 // mm // Horizontal offset of the universal joints on the end effector. - //#define DELTA_EFFECTOR_OFFSET 24.0 // mm + #define DELTA_EFFECTOR_OFFSET 24.0 // mm // Horizontal offset of the universal joints on the carriages. - //#define DELTA_CARRIAGE_OFFSET 22.0 // mm - + #define DELTA_CARRIAGE_OFFSET 22.0 // mm +*/ // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 100.90 //mm // get this value from auto calibrate + #define DELTA_RADIUS 100.00 //mm // get this value from auto calibrate // height from z=0.00 to home position - #define DELTA_HEIGHT 296.38 // get this value from auto calibrate + #define DELTA_HEIGHT 295.00 // get this value from auto calibrate - use G33 C-1 at 1st time calibration // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). #define DELTA_PRINTABLE_RADIUS 85.0 // Delta calibration menu + // uncomment to add three points calibration menu option. // See http://minow.blogspot.com/index.html#4918805519571907051 #define DELTA_CALIBRATION_MENU @@ -477,7 +480,7 @@ // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 4 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained @@ -529,7 +532,7 @@ // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). #define X_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Y_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. -#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. @@ -601,7 +604,7 @@ #define DEFAULT_XJERK 20.0 #define DEFAULT_YJERK DEFAULT_XJERK #define DEFAULT_ZJERK DEFAULT_YJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#define DEFAULT_EJERK 5.0 /** @@ -667,9 +670,6 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ -// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) -//#define SOLENOID_PROBE - // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. @@ -694,8 +694,8 @@ * (0,0) */ #define X_PROBE_OFFSET_FROM_EXTRUDER 0 // X offset: -left +right [of the nozzle] -#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front +behind [the nozzle] -#define Z_PROBE_OFFSET_FROM_EXTRUDER 0.25 // Z offset: -below +above [the nozzle] +#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front +behind [the nozzle] +#define Z_PROBE_OFFSET_FROM_EXTRUDER 0.10 // Z offset: -below +above [the nozzle] // X and Y axis travel speed (mm/m) between probes #define XY_PROBE_SPEED 5000 @@ -704,7 +704,7 @@ #define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z // Speed for the "accurate" probe of each point -#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 4) +#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 6) // Use double touch for probing //#define PROBE_DOUBLE_TOUCH @@ -728,7 +728,7 @@ #define Z_PROBE_ALLEN_KEY_DEPLOY_2_X 0.0 #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Y DELTA_PRINTABLE_RADIUS #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0 - #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED)/10 + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED/10) #define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75 #define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75 @@ -834,8 +834,8 @@ * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. */ -#define Z_CLEARANCE_DEPLOY_PROBE 10 // Z Clearance for Deploy/Stow -#define Z_CLEARANCE_BETWEEN_PROBES 3 // Z Clearance between probe points +#define Z_CLEARANCE_DEPLOY_PROBE 5 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 2 // Z Clearance between probe points // For M851 give a range for adjusting the Z probe offset #define Z_PROBE_OFFSET_RANGE_MIN -20 @@ -864,11 +864,11 @@ // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR true +#define INVERT_X_DIR true // DELTA does not invert #define INVERT_Y_DIR true #define INVERT_Z_DIR true -// Enable this option for Toshiba stepper drivers +// Enable this option for Toshiba steppers //#define CONFIG_STEPPERS_TOSHIBA // @section extruder @@ -966,7 +966,7 @@ */ //#define AUTO_BED_LEVELING_3POINT //#define AUTO_BED_LEVELING_LINEAR -#define AUTO_BED_LEVELING_BILINEAR +//#define AUTO_BED_LEVELING_BILINEAR //#define AUTO_BED_LEVELING_UBL //#define MESH_BED_LEVELING @@ -987,8 +987,7 @@ #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. - // Works best with 5 or more points in each dimension. - #define GRID_MAX_POINTS_X 9 + #define GRID_MAX_POINTS_X 7 #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X // Set the boundaries for probing (where the probe can reach). @@ -999,12 +998,13 @@ #define BACK_PROBE_BED_POSITION DELTA_PROBEABLE_RADIUS // The Z probe minimum outer margin (to validate G29 parameters). - #define MIN_PROBE_EDGE 10 + #define MIN_PROBE_EDGE 20 // Probe along the Y axis, advancing X after each column //#define PROBE_Y_FIRST #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + // // Experimental Subdivision of the grid by Catmull-Rom method. // Synthesizes intermediate points to produce a more detailed mesh. @@ -1154,8 +1154,8 @@ // @section temperature // Preheat Constants -#define PREHEAT_1_TEMP_HOTEND 185 -#define PREHEAT_1_TEMP_BED 70 +#define PREHEAT_1_TEMP_HOTEND 195 +#define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_2_TEMP_HOTEND 240 @@ -1401,6 +1401,7 @@ // // Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. // +// INDIVIDUAL_AXIS_HOMING_MENU is incompatible with DELTA kinematics. //#define INDIVIDUAL_AXIS_HOMING_MENU // @@ -1729,8 +1730,8 @@ #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor (0,1,2,3) #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - #define MEASURED_UPPER_LIMIT 3.30 // (mm) Upper limit used to validate sensor reading - #define MEASURED_LOWER_LIMIT 1.90 // (mm) Lower limit used to validate sensor reading + #define MEASURED_UPPER_LIMIT 1.95 // (mm) Upper limit used to validate sensor reading + #define MEASURED_LOWER_LIMIT 1.20 // (mm) Lower limit used to validate sensor reading #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h index dbcc9441e..72721737b 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h @@ -448,7 +448,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 218.0 // mm - +/* // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 150.0 // mm @@ -457,12 +457,12 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 22.0 // mm - +*/ // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-(DELTA_EFFECTOR_OFFSET)-(DELTA_CARRIAGE_OFFSET)) + #define DELTA_RADIUS 104 //mm // get this value from auto calibrate // height from z=0.00 to home position - #define DELTA_HEIGHT 280 // get this value from auto calibrate + #define DELTA_HEIGHT 280 // get this value from auto calibrate - use G33 C-1 at 1st time calibration // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). #define DELTA_PRINTABLE_RADIUS 85.0 @@ -470,7 +470,7 @@ // Delta calibration menu // uncomment to add three points calibration menu option. // See http://minow.blogspot.com/index.html#4918805519571907051 - //#define DELTA_CALIBRATION_MENU + #define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm @@ -478,7 +478,7 @@ // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 3fb5cf748..d9c3750da 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -438,7 +438,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 250.0 // mm - +/* // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 175.0 // mm @@ -447,29 +447,25 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 18.0 // mm - +*/ // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-(DELTA_EFFECTOR_OFFSET)-(DELTA_CARRIAGE_OFFSET)) - - // height from z=0.00 to home position - #define DELTA_HEIGHT 250 // get this value from auto calibrate + #define DELTA_RADIUS 125 //mm // get this value from auto calibrate // height from z=0.00 to home position + #define DELTA_HEIGHT 250 // get this value from auto calibrate - use G33 C-1 at 1st time calibration // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). #define DELTA_PRINTABLE_RADIUS 140.0 // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 - //#define DELTA_CALIBRATION_MENU - - + #define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 28) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 98acaa0de..21f69f539 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -438,7 +438,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 215.0 // mm - +/* // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 145.0 // mm @@ -447,27 +447,27 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 19.5 // mm - +*/ // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-(DELTA_EFFECTOR_OFFSET)-(DELTA_CARRIAGE_OFFSET)) + #define DELTA_RADIUS 105 //mm // get this value from auto calibrate // height from z=0.00 to home position - #define DELTA_HEIGHT 250 // get this value from auto calibrate + #define DELTA_HEIGHT 250 // get this value from auto calibrate - use G33 C-1 at 1st time calibration // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). #define DELTA_PRINTABLE_RADIUS 90.0 // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 - //#define DELTA_CALIBRATION_MENU + #define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 18) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index a086c70a3..40231832c 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -425,7 +425,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 301.0 // mm - +/* // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 212.357 // mm @@ -434,29 +434,27 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 30.0 // mm - +*/ // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-(DELTA_EFFECTOR_OFFSET)-(DELTA_CARRIAGE_OFFSET)) + #define DELTA_RADIUS 150 //mm // get this value from auto calibrate // height from z=0.00 to home position - #define DELTA_HEIGHT 277 // get this value from auto calibrate + #define DELTA_HEIGHT 277 // get this value from auto calibrate - use G33 C-1 at 1st time calibration // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). #define DELTA_PRINTABLE_RADIUS 127.0 // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 - //#define DELTA_CALIBRATION_MENU - - + #define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 25.4) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index c5e56355f..70b10e433 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -443,7 +443,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 317.3 + 2.5 // mm - +/* // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 220.1 // mm @@ -452,27 +452,27 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 22.0 // mm - +*/ // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-(DELTA_EFFECTOR_OFFSET)-(DELTA_CARRIAGE_OFFSET) + 1) + #define DELTA_RADIUS 175 //mm // get this value from auto calibrate // height from z=0.00 to home position - #define DELTA_HEIGHT 380 // get this value from auto calibrate + #define DELTA_HEIGHT 380 // get this value from auto calibrate - use G33 C-1 at 1st time calibration // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). #define DELTA_PRINTABLE_RADIUS 140.0 // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 - //#define DELTA_CALIBRATION_MENU + #define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 28) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) #define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) - #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-2,1-7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained From 4ea8d0f89b1dfb7f3399c979d792fe676b96c013 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Fri, 28 Apr 2017 18:47:23 +0200 Subject: [PATCH 11/18] Solved "The Travis CI build failed " --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index cb32ef59e..403000004 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8486,7 +8486,7 @@ inline void gcode_M503() { if (!isnan(last_zoffset)) { - #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(BABYSTEP_ZPROBE_OFFSET) + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(BABYSTEP_ZPROBE_OFFSET) || ENABLED(DELTA) const float diff = zprobe_zoffset - last_zoffset; #endif From baf3b914601b5b24cf82402289fd6a8cb8c64e59 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 16:05:39 -0500 Subject: [PATCH 12/18] DELTA_TOWER_ANGLE_TRIM only needs AB --- Marlin/Conditionals_post.h | 6 +++--- Marlin/configuration_store.cpp | 2 +- .../delta/FLSUN/auto_calibrate/Configuration.h | 2 +- .../delta/FLSUN/kossel_mini/Configuration.h | 2 +- Marlin/example_configurations/delta/generic/Configuration.h | 2 +- .../delta/kossel_mini/Configuration.h | 2 +- .../example_configurations/delta/kossel_pro/Configuration.h | 2 +- .../example_configurations/delta/kossel_xl/Configuration.h | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 4b4dc4d94..6252ac5d3 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -698,13 +698,13 @@ #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } #endif #ifndef DELTA_TOWER_ANGLE_TRIM - #define DELTA_TOWER_ANGLE_TRIM {0.0, 0.0, 0.0} + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0 } // C always 0.0 #endif #ifndef DELTA_RADIUS_TRIM_TOWER - #define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} + #define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } #endif #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER - #define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} + #define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } #endif #endif diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index 57a5e068a..3d2ca2bb4 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -1066,7 +1066,7 @@ void MarlinSettings::reset() { #if ENABLED(DELTA) const float adj[ABC] = DELTA_ENDSTOP_ADJ, - dta[ABC] = DELTA_TOWER_ANGLE_TRIM; + dta[2] = DELTA_TOWER_ANGLE_TRIM; COPY(endstop_adj, adj); delta_radius = DELTA_RADIUS; delta_diagonal_rod = DELTA_DIAGONAL_ROD; diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h index ccd039df8..186161b87 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h @@ -491,7 +491,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h index 72721737b..167deb36a 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h @@ -489,7 +489,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index d9c3750da..310498f21 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -476,7 +476,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 21f69f539..77f49f314 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -478,7 +478,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 40231832c..d70817975 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -465,7 +465,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 70b10e433..b71e8bf73 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -483,7 +483,7 @@ // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} From 42f4c532543cb94f85ced97764996a9c17a7a415 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 16:06:08 -0500 Subject: [PATCH 13/18] Starting on G33 rewrite --- Marlin/Marlin_main.cpp | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 403000004..318baea49 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4988,26 +4988,24 @@ inline void gcode_G28() { #if ENABLED(DELTA_AUTO_CALIBRATION) /** - * G33 - Delta '4-7-point' auto calibration (Requires DELTA) - * - * Usage: - * G33 - * - * Cn = n=-7 -> +7 : n*n probe points - * calibrates height ('1 point'), endstops, and delta radius ('4 points') - * and calibrates tower angles with n >= 3 ('7+ points') - * n=0 - * n=1 probes center / sets height only - * n=-1 same but 1 iteration only - * n=2 probes center and towers / sets height, endstops and delta radius - * n=-2 same but opposite towers - * n=3 probes all points: center, towers and opposite towers / sets all - * n>3 probes all points multiple times and averages - * n<=3 same but tower angle calibration disabled - * Vn = verbose level (n=0-2 default 1) - * n=0 dry-run mode: no calibration - * n=1 settings - * n=2 setting + probe results + * G33 - Delta Auto Calibration + * Utility to calibrate height, endstop offsets, delta radius, and tower angles. + * + * Parameters: + * + * C0 Calibrate height + * C1 Probe the center to set the Z height + * C-1 same but 1 iteration only + * C2 probes center and towers / sets height, endstops and delta radius + * C-2 same but opposite towers + * C3 probes all points: center, towers and opposite towers / sets all + * C0-C3 same but tower angle calibration disabled + * C4-C7 probes all points multiple times and averages + * + * V Verbose level (0-2, default 1) + * V0 dry-run mode. no calibration + * V1 settings + * V2 setting and probe results */ inline void gcode_G33() { From 12ce051b552d301cd76bb7269011a50ef548ed6e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 17:15:39 -0500 Subject: [PATCH 14/18] Add a function to output spaces to serial --- Marlin/serial.cpp | 2 ++ Marlin/serial.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Marlin/serial.cpp b/Marlin/serial.cpp index 9b5ae139e..797c6107a 100644 --- a/Marlin/serial.cpp +++ b/Marlin/serial.cpp @@ -32,3 +32,5 @@ void serial_echopair_P(const char* s_P, long v) { serialprintPGM(s_P); void serial_echopair_P(const char* s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } + +void serial_spaces(uint8_t count) { while (count--) MYSERIAL.write(' '); } diff --git a/Marlin/serial.h b/Marlin/serial.h index b6e7add43..62e06c989 100644 --- a/Marlin/serial.h +++ b/Marlin/serial.h @@ -84,6 +84,11 @@ FORCE_INLINE void serial_echopair_P(const char* s_P, uint16_t v) { serial_echopa FORCE_INLINE void serial_echopair_P(const char* s_P, bool v) { serial_echopair_P(s_P, (int)v); } FORCE_INLINE void serial_echopair_P(const char* s_P, void *v) { serial_echopair_P(s_P, (unsigned long)v); } +void serial_spaces(uint8_t count); +#define SERIAL_ECHO_SP(C) serial_spaces(C) +#define SERIAL_ERROR_SP(C) serial_spaces(C) +#define SERIAL_PROTOCOL_SP(C) serial_spaces(C) + // // Functions for serial printing from PROGMEM. (Saves loads of SRAM.) // From 29fa24161714a6f119422ea21337c5e06a9a2f9e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 28 Apr 2017 17:17:01 -0500 Subject: [PATCH 15/18] Initial patches to G33 --- Marlin/Marlin_main.cpp | 161 ++++++++++++++++++++++++----------------- Marlin/ultralcd.cpp | 2 +- 2 files changed, 94 insertions(+), 69 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 318baea49..dfb64a94d 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1838,7 +1838,8 @@ static void clean_up_after_endstop_or_probe_move() { #endif //HAS_BED_PROBE -#if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) +#if HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION) + bool axis_unhomed_error(const bool x, const bool y, const bool z) { const bool xx = x && !axis_homed[X_AXIS], yy = y && !axis_homed[Y_AXIS], @@ -1858,6 +1859,7 @@ static void clean_up_after_endstop_or_probe_move() { } return false; } + #endif #if ENABLED(Z_PROBE_SLED) @@ -4941,11 +4943,12 @@ inline void gcode_G28() { /** * G30: Do a single Z probe at the current XY - * Usage: - * G30 - * X = Probe X position (default=current probe position) - * Y = Probe Y position (default=current probe position) - * S = Stows the probe if 1 (default=1) + * + * Parameters: + * + * X Probe X position (default current X) + * Y Probe Y position (default current Y) + * S0 Leave the probe deployed */ inline void gcode_G30() { const float xpos = code_seen('X') ? code_value_linear_units() : current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER, @@ -4996,42 +4999,56 @@ inline void gcode_G28() { * C0 Calibrate height * C1 Probe the center to set the Z height * C-1 same but 1 iteration only - * C2 probes center and towers / sets height, endstops and delta radius + * C2 probe center and towers, set height, endstops, and delta radius * C-2 same but opposite towers - * C3 probes all points: center, towers and opposite towers / sets all + * + * C3 probe all points: center, towers and opposite towers / sets all + * + * C4-C7 probe all points multiple times and average * C0-C3 same but tower angle calibration disabled - * C4-C7 probes all points multiple times and averages * - * V Verbose level (0-2, default 1) - * V0 dry-run mode. no calibration - * V1 settings - * V2 setting and probe results + * V0 Dry-run mode + * V1 Output settings + * V2 Output setting and probe results */ inline void gcode_G33() { + if (axis_unhomed_error(true, true, true)) return; + + const int8_t c_value = code_seen('C') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS; + if (!WITHIN(c_value, -7, 7)) { + SERIAL_PROTOCOLLNPGM("?C parameter is implausible (-7 to 7)."); + return; + } + + const int8_t verbose_level = code_seen('V') ? code_value_byte() : 1; + if (!WITHIN(verbose_level, 0, 2)) { + SERIAL_PROTOCOLLNPGM("?(V)erbose Level is implausible (0-2)."); + return; + } + stepper.synchronize(); #if PLANNER_LEVELING set_bed_leveling_enabled(false); #endif - const int8_t pp = code_seen('C') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS, - probe_points = (WITHIN(pp, -7, -1) || WITHIN(pp, 1, 7)) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS; - - int8_t verbose_level = code_seen('V') ? code_value_byte() : 1; + const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h"; - if (!WITHIN(verbose_level, 0, 2)) verbose_level = 1; + const uint8_t probe_points = abs(c_value); - float zero_std_dev = verbose_level ? 999.0 : 0.0; // 0.0 in dry-run mode : forced end - - gcode_G28(); + const bool neg = c_value < 0, + equals4 = probe_points == 4, + over4 = probe_points > 4, + over5 = probe_points > 5; float e_old[XYZ], dr_old = delta_radius, zh_old = home_offset[Z_AXIS], alpha_old = delta_tower_angle_trim[A_AXIS], beta_old = delta_tower_angle_trim[B_AXIS]; - COPY(e_old,endstop_adj); + + COPY(e_old, endstop_adj); // print settings @@ -5042,7 +5059,7 @@ inline void gcode_G28() { LCD_MESSAGEPGM("Checking... AC"); SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); - if (abs(probe_points) > 1) { + if (probe_points > 1) { SERIAL_PROTOCOLPGM(" Ex:"); if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2); @@ -5055,7 +5072,7 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } SERIAL_EOL; - if (probe_points > 2) { + if (c_value > 2) { SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); @@ -5070,10 +5087,10 @@ inline void gcode_G28() { DEPLOY_PROBE(); #endif - float test_precision; + float zero_std_dev = verbose_level ? 999.0 : 0.0, // 0.0 in dry-run mode : forced end + test_precision; int8_t iterations = 0; - - do { // start iterations + do { setup_for_endstop_or_probe_move(); @@ -5085,57 +5102,58 @@ inline void gcode_G28() { int16_t center_points = 0; - if (abs(probe_points) != 3 && abs(probe_points != 6)) { // probe centre + if (probe_points != 3 && probe_points != 6) { // probe center z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1); center_points = 1; } - int16_t step_axis = (abs(probe_points) > 4) ? 2 : 4; - if (abs(probe_points) >= 3) { // probe extra 3 or 6 centre points - for (int8_t axis = (abs(probe_points) > 4) ? 11 : 9; axis > 0; axis -= step_axis) { + int16_t step_axis = over4 ? 2 : 4; + if (probe_points >= 3) { // probe extra 3 or 6 center points + for (int8_t axis = over4 ? 11 : 9; axis > 0; axis -= step_axis) { z_at_pt[0] += probe_pt( cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1); } - center_points += (abs(probe_points) > 4) ? 6 : 3; // average centre points + center_points += over4 ? 6 : 3; // average center points z_at_pt[0] /= center_points; } float S1 = z_at_pt[0], S2 = sq(S1); - int16_t N = 1, start = (probe_points == -2) ? 3 : 1; - step_axis = (abs(probe_points) == 2) ? 4 : (abs(probe_points) == 4 || abs(probe_points) > 5) ? 1 : 2; - float start_circles = (abs(probe_points) > 6) ? -1.5 : (abs(probe_points) > 4) ? -1 : 0, // one or multi radius points - end_circles = (abs(probe_points) > 6) ? 1.5 : (abs(probe_points) > 4) ? 1 : 0; // one or multi radius points - int8_t zig_zag = 1; + int16_t N = 1, start = (c_value == -2) ? 3 : 1; + step_axis = (probe_points == 2) ? 4 : (equals4 || over5) ? 1 : 2; - if (abs(probe_points) > 1) { + if (probe_points > 1) { + float start_circles = (probe_points > 6) ? -1.5 : over4 ? -1 : 0, // one or multi radius points + end_circles = -start_circles; + bool zig_zag = true; for (uint8_t axis = start; axis < 13; axis += step_axis) { // probes 3, 6 or 12 points on the calibration radius for (float circles = start_circles ; circles <= end_circles; circles++) // one or multi radius points z_at_pt[axis] += probe_pt( - cos(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * zig_zag) * delta_calibration_radius), - sin(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * zig_zag) * delta_calibration_radius), true, 1); + cos(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * (zig_zag ? 1 : -1)) * delta_calibration_radius), + sin(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * (zig_zag ? 1 : -1)) * delta_calibration_radius), true, 1); - if (abs(probe_points) > 5) start_circles += (zig_zag == 1) ? +0.5 : -0.5; // opposites: one radius point less - if (abs(probe_points) > 5) end_circles += (zig_zag == 1) ? -0.5 : +0.5; - zig_zag = -zig_zag; - if (abs(probe_points) > 4) z_at_pt[axis] /= (zig_zag == 1) ? 3.0 : 2.0; // average between radius points + if (over5) start_circles += zig_zag ? +0.5 : -0.5; // opposites: one radius point less + if (over5) end_circles += zig_zag ? -0.5 : +0.5; + zig_zag = !zig_zag; + if (over4) z_at_pt[axis] /= (zig_zag ? 3.0 : 2.0); // average between radius points } } - if (abs(probe_points) == 4 || abs(probe_points) > 5) step_axis = 2; + if (equals4 || over5) step_axis = 2; for (uint8_t axis = start; axis < 13; axis += step_axis) { // average half intermediates to towers and opposites - if (abs(probe_points) == 4 || abs(probe_points) > 5) + if (equals4 || over5) z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0; S1 += z_at_pt[axis]; S2 += sq(z_at_pt[axis]); N++; } - zero_std_dev = round(sqrt(S2 / N) * 1000.0) / 1000.0 + 0.00001; // deviation from zero plane // Solve matrices + zero_std_dev = round(sqrt(S2 / N) * 1000.0) / 1000.0 + 0.00001; // deviation from zero plane + if (zero_std_dev < test_precision) { COPY(e_old, endstop_adj); dr_old = delta_radius; @@ -5145,6 +5163,7 @@ inline void gcode_G28() { float e_delta[XYZ] = { 0.0 }, r_delta = 0.0, t_alpha = 0.0, t_beta = 0.0; + const float r_diff = delta_radius - delta_calibration_radius, h_factor = 1.00 + r_diff * 0.001, //1.02 for r_diff = 20mm r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)), //2.25 for r_diff = 20mm @@ -5162,7 +5181,7 @@ inline void gcode_G28() { #define Z0444(I) ZP(a_factor * 4.0 / 9.0, I) #define Z0888(I) ZP(a_factor * 8.0 / 9.0, I) - switch (probe_points) { + switch (c_value) { case -1: test_precision = 0.00; case 1: @@ -5177,10 +5196,10 @@ inline void gcode_G28() { break; case -2: - e_delta[X_AXIS] = Z1050(0) - Z0700(7) + Z0350(11) + Z0350(3); - e_delta[Y_AXIS] = Z1050(0) + Z0350(7) - Z0700(11) + Z0350(3); - e_delta[Z_AXIS] = Z1050(0) + Z0350(7) + Z0350(11) - Z0700(3); - r_delta = Z2250(0) - Z0750(7) - Z0750(11) - Z0750(3); + e_delta[X_AXIS] = Z1050(0) - Z0700(7) + Z0350(11) + Z0350(3); + e_delta[Y_AXIS] = Z1050(0) + Z0350(7) - Z0700(11) + Z0350(3); + e_delta[Z_AXIS] = Z1050(0) + Z0350(7) + Z0350(11) - Z0700(3); + r_delta = Z2250(0) - Z0750(7) - Z0750(11) - Z0750(3); break; default: @@ -5188,10 +5207,10 @@ inline void gcode_G28() { e_delta[Y_AXIS] = Z1050(0) - Z0175(1) + Z0350(5) - Z0175(9) + Z0175(7) - Z0350(11) + Z0175(3); e_delta[Z_AXIS] = Z1050(0) - Z0175(1) - Z0175(5) + Z0350(9) + Z0175(7) + Z0175(11) - Z0350(3); r_delta = Z2250(0) - Z0375(1) - Z0375(5) - Z0375(9) - Z0375(7) - Z0375(11) - Z0375(3); - - if (probe_points > 0) { //probe points negative disables tower angles - t_alpha = + Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3); - t_beta = - Z0888(1) + Z0444(5) + Z0444(9) - Z0888(7) + Z0444(11) + Z0444(3); + + if (c_value > 0) { //probe points negative disables tower angles + t_alpha = + Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3); + t_beta = - Z0888(1) + Z0444(5) + Z0444(9) - Z0888(7) + Z0444(11) + Z0444(3); } break; } @@ -5216,7 +5235,6 @@ inline void gcode_G28() { home_offset[Z_AXIS] = zh_old; delta_tower_angle_trim[A_AXIS] = alpha_old; delta_tower_angle_trim[B_AXIS] = beta_old; - recalc_delta_settings(delta_radius, delta_diagonal_rod); } @@ -5226,7 +5244,7 @@ inline void gcode_G28() { SERIAL_PROTOCOLPGM(". c:"); if (z_at_pt[0] > 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[0], 2); - if (abs(probe_points) > 2 || probe_points == 2) { + if (probe_points > 2 || c_value == 2) { SERIAL_PROTOCOLPGM(" x:"); if (z_at_pt[1] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[1], 2); @@ -5237,9 +5255,12 @@ inline void gcode_G28() { if (z_at_pt[9] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[9], 2); } - if (probe_points != -2) SERIAL_EOL; - if (abs(probe_points) > 2 || probe_points == -2) { - if (abs(probe_points) > 2) SERIAL_PROTOCOLPGM(". "); + if (c_value != -2) SERIAL_EOL; + if (probe_points > 2 || c_value == -2) { + if (probe_points > 2) { + SERIAL_CHAR('.'); + SERIAL_PROTOCOL_SP(12); + } SERIAL_PROTOCOLPGM(" yz:"); if (z_at_pt[7] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[7], 2); @@ -5255,7 +5276,8 @@ inline void gcode_G28() { if (test_precision != 0.0) { // !forced end if (zero_std_dev >= test_precision) { // end iterations SERIAL_PROTOCOLPGM("Calibration OK"); - SERIAL_PROTOCOLPGM(" rolling back."); + SERIAL_PROTOCOL_SP(36); + SERIAL_PROTOCOLPGM("rolling back."); SERIAL_EOL; LCD_MESSAGEPGM("Calibration OK"); } @@ -5264,13 +5286,14 @@ inline void gcode_G28() { if (iterations < 31) sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations); SERIAL_PROTOCOL(mess); - SERIAL_PROTOCOLPGM(" std dev:"); + SERIAL_PROTOCOL_SP(36); + SERIAL_PROTOCOLPGM("std dev:"); SERIAL_PROTOCOL_F(zero_std_dev, 3); SERIAL_EOL; lcd_setstatus(mess); } SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); - if (abs(probe_points) > 1) { + if (probe_points > 1) { SERIAL_PROTOCOLPGM(" Ex:"); if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2); @@ -5283,7 +5306,7 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } SERIAL_EOL; - if (probe_points > 2) { + if (c_value > 2) { SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); @@ -5294,11 +5317,13 @@ inline void gcode_G28() { SERIAL_EOL; } if (zero_std_dev >= test_precision) - SERIAL_PROTOCOLLNPGM("save with M500 and/or copy to configuration.h"); + serialprintPGM(save_message); } else { // forced end if (verbose_level == 0) { - SERIAL_PROTOCOLPGM("End DRY-RUN std dev:"); + SERIAL_PROTOCOLPGM("End DRY-RUN"); + SERIAL_PROTOCOL_SP(39); + SERIAL_PROTOCOLPGM("std dev:"); SERIAL_PROTOCOL_F(zero_std_dev, 3); SERIAL_EOL; } @@ -5307,7 +5332,7 @@ inline void gcode_G28() { LCD_MESSAGEPGM("Calibration OK"); SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); SERIAL_EOL; - SERIAL_PROTOCOLLNPGM("save with M500 and/or copy to configuration.h"); + serialprintPGM(save_message); } } diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 1a32d3ef7..d524ad9dd 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1833,7 +1833,7 @@ void kill_screen(const char* lcd_msg) { START_MENU(); MENU_BACK(MSG_MAIN); #if ENABLED(DELTA_AUTO_CALIBRATION) - MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33 C")); + MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33")); MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 C-1")); #endif MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home); From 585c00a7287d431837ca305685a874e225d7d11d Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Sat, 29 Apr 2017 16:36:33 +0200 Subject: [PATCH 16/18] Proposed changes This is what I did yesterday: - basicly gave the tests more comprehensive names; put all the declarations at the top; got rid of the magic negative C-value (renamed to P + A, O, T) - "cos(RADIANS(180 + 30 * axis)) * (1 + circles * 0.1 * ((zig_zag) ? 1 : -1)) * delta_calibration_radius" compiles wrong is zig_zag statement is without brackets - DELTA_TOWER_ANGLE_TRIM reset to 3 values (the calcs use the 3th value to normalize will not compile otherwise) -Wrote 3 dummies to keep EEPROM lenght the same -Reset the configs to the 'original' with autocal + menu disabled (but can be enabled of course) --- Marlin/Conditionals_post.h | 8 +- Marlin/Marlin_main.cpp | 172 +++++++++--------- Marlin/configuration_store.cpp | 12 +- .../FLSUN/auto_calibrate/Configuration.h | 32 ++-- .../delta/FLSUN/kossel_mini/Configuration.h | 20 +- .../delta/generic/Configuration.h | 22 ++- .../delta/kossel_mini/Configuration.h | 20 +- .../delta/kossel_pro/Configuration.h | 20 +- .../delta/kossel_xl/Configuration.h | 20 +- Marlin/ultralcd.cpp | 2 +- 10 files changed, 169 insertions(+), 159 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 6252ac5d3..07a0d0079 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -695,16 +695,16 @@ #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - 10 #endif #ifndef DELTA_ENDSTOP_ADJ - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } + #define DELTA_ENDSTOP_ADJ { 0, 0, 0 } #endif #ifndef DELTA_TOWER_ANGLE_TRIM - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0 } // C always 0.0 + #define DELTA_TOWER_ANGLE_TRIM {0, 0, 0} #endif #ifndef DELTA_RADIUS_TRIM_TOWER - #define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } + #define DELTA_RADIUS_TRIM_TOWER {0, 0, 0} #endif #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER - #define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } + #define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0} #endif #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index dfb64a94d..5d533ea73 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -61,7 +61,7 @@ * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location) * G31 - Dock sled (Z_PROBE_SLED only) * G32 - Undock sled (Z_PROBE_SLED only) - * G33 - Delta '4-7-point' auto calibration : "G33 C V" (Requires DELTA) + * G33 - Delta '1-4-7-point' auto calibration : "G33 P V" (Requires DELTA) * G38 - Probe target - similar to G28 except it uses the Z_MIN_PROBE for all three axes * G90 - Use Absolute Coordinates * G91 - Use Relative Coordinates @@ -4991,65 +4991,67 @@ inline void gcode_G28() { #if ENABLED(DELTA_AUTO_CALIBRATION) /** - * G33 - Delta Auto Calibration - * Utility to calibrate height, endstop offsets, delta radius, and tower angles. - * - * Parameters: - * - * C0 Calibrate height - * C1 Probe the center to set the Z height - * C-1 same but 1 iteration only - * C2 probe center and towers, set height, endstops, and delta radius - * C-2 same but opposite towers - * - * C3 probe all points: center, towers and opposite towers / sets all - * - * C4-C7 probe all points multiple times and average - * C0-C3 same but tower angle calibration disabled - * - * V0 Dry-run mode - * V1 Output settings - * V2 Output setting and probe results + * G33 - Delta '1-4-7-point' auto calibration (Requires DELTA) + * + * Usage: + * G33 + * + * Pn = n=-7 -> +7 : n*n probe points + * calibrates height ('1 point'), endstops, and delta radius ('4 points') + * and tower angles with n > 2 ('7+ points') + * n=1 probes center / sets height only + * n=2 probes center and towers / sets height, endstops and delta radius + * n=3 probes all points: center, towers and opposite towers / sets all + * n>3 probes all points multiple times and averages + * A = abort 1 point delta height calibration after 1 probe + * O = use oposite tower points instead of tower points with 4 point calibration + * T = do not calibrate tower angles with 7+ point calibration + * Vn = verbose level (n=0-2 default 1) + * n=0 dry-run mode: no calibration + * n=1 settings + * n=2 setting + probe results */ inline void gcode_G33() { - if (axis_unhomed_error(true, true, true)) return; - - const int8_t c_value = code_seen('C') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS; - if (!WITHIN(c_value, -7, 7)) { - SERIAL_PROTOCOLLNPGM("?C parameter is implausible (-7 to 7)."); - return; - } - - const int8_t verbose_level = code_seen('V') ? code_value_byte() : 1; - if (!WITHIN(verbose_level, 0, 2)) { - SERIAL_PROTOCOLLNPGM("?(V)erbose Level is implausible (0-2)."); - return; - } - stepper.synchronize(); #if PLANNER_LEVELING set_bed_leveling_enabled(false); #endif - const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h"; + int8_t pp = code_seen('P') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS, + probe_mode = (WITHIN(pp, 1, 7)) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS; + + probe_mode = (code_seen('A') && probe_mode == 1) ? -probe_mode : probe_mode; + probe_mode = (code_seen('O') && probe_mode == 2) ? -probe_mode : probe_mode; + probe_mode = (code_seen('T') && probe_mode > 2) ? -probe_mode : probe_mode; + + int8_t verbose_level = code_seen('V') ? code_value_byte() : 1; - const uint8_t probe_points = abs(c_value); + if (!WITHIN(verbose_level, 0, 2)) verbose_level = 1; - const bool neg = c_value < 0, - equals4 = probe_points == 4, - over4 = probe_points > 4, - over5 = probe_points > 5; + gcode_G28(); - float e_old[XYZ], + const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h"; + float test_precision, + zero_std_dev = verbose_level ? 999.0 : 0.0, // 0.0 in dry-run mode : forced end + e_old[XYZ] = { + endstop_adj[A_AXIS], + endstop_adj[B_AXIS], + endstop_adj[C_AXIS] + }, dr_old = delta_radius, zh_old = home_offset[Z_AXIS], alpha_old = delta_tower_angle_trim[A_AXIS], - beta_old = delta_tower_angle_trim[B_AXIS]; - - COPY(e_old, endstop_adj); - + beta_old = delta_tower_angle_trim[B_AXIS]; + int8_t iterations = 0, + probe_points = abs(probe_mode); + bool _1_point = (probe_points <= 1), + _7_point = (probe_mode > 2), + o_mode = (probe_mode == -2), + towers = (probe_points > 2 || probe_mode == 2), + opposites = (probe_points > 2 || o_mode); + // print settings SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate"); @@ -5059,7 +5061,7 @@ inline void gcode_G28() { LCD_MESSAGEPGM("Checking... AC"); SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); - if (probe_points > 1) { + if (!_1_point) { SERIAL_PROTOCOLPGM(" Ex:"); if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2); @@ -5072,7 +5074,7 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } SERIAL_EOL; - if (c_value > 2) { + if (_7_point) { SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); @@ -5087,62 +5089,70 @@ inline void gcode_G28() { DEPLOY_PROBE(); #endif - float zero_std_dev = verbose_level ? 999.0 : 0.0, // 0.0 in dry-run mode : forced end - test_precision; - int8_t iterations = 0; do { - setup_for_endstop_or_probe_move(); + float z_at_pt[13] = { 0 }, + S1 = z_at_pt[0], + S2 = sq(S1); + int16_t N = 1; + bool _4_probe = (probe_points == 2), + _7_probe = (probe_points > 2), + center_probe = (probe_points != 3 && probe_points != 6), + multi_circle = (probe_points > 4), + diff_circle = (probe_points > 5), + max_circle = (probe_points > 6), + intermediates = (probe_points == 4 || diff_circle); + setup_for_endstop_or_probe_move(); test_precision = zero_std_dev; - float z_at_pt[13] = { 0 }; iterations++; // probe the points int16_t center_points = 0; - if (probe_points != 3 && probe_points != 6) { // probe center + if (center_probe) { // probe centre z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1); center_points = 1; } - int16_t step_axis = over4 ? 2 : 4; - if (probe_points >= 3) { // probe extra 3 or 6 center points - for (int8_t axis = over4 ? 11 : 9; axis > 0; axis -= step_axis) { + int16_t step_axis = (multi_circle) ? 2 : 4, + start = (multi_circle) ? 11 : 9; + if (_7_probe) { // probe extra 3 or 6 centre points + for (int8_t axis = start; axis > 0; axis -= step_axis) { z_at_pt[0] += probe_pt( cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1); } - center_points += over4 ? 6 : 3; // average center points + center_points += (multi_circle) ? 6 : 3; // average centre points z_at_pt[0] /= center_points; } - float S1 = z_at_pt[0], S2 = sq(S1); + start = (o_mode) ? 3 : 1; + step_axis = (_4_probe) ? 4 : (intermediates) ? 1 : 2; - int16_t N = 1, start = (c_value == -2) ? 3 : 1; - step_axis = (probe_points == 2) ? 4 : (equals4 || over5) ? 1 : 2; - - if (probe_points > 1) { - float start_circles = (probe_points > 6) ? -1.5 : over4 ? -1 : 0, // one or multi radius points - end_circles = -start_circles; + if (!_1_point) { + float start_circles = (max_circle) ? -1.5 : (multi_circle) ? -1 : 0, // one or multi radius points + end_circles = -start_circles; bool zig_zag = true; for (uint8_t axis = start; axis < 13; axis += step_axis) { // probes 3, 6 or 12 points on the calibration radius for (float circles = start_circles ; circles <= end_circles; circles++) // one or multi radius points z_at_pt[axis] += probe_pt( - cos(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * (zig_zag ? 1 : -1)) * delta_calibration_radius), - sin(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * (zig_zag ? 1 : -1)) * delta_calibration_radius), true, 1); + cos(RADIANS(180 + 30 * axis)) * (1 + circles * 0.1 * ((zig_zag) ? 1 : -1)) * delta_calibration_radius, + sin(RADIANS(180 + 30 * axis)) * (1 + circles * 0.1 * ((zig_zag) ? 1 : -1)) * delta_calibration_radius, true, 1); - if (over5) start_circles += zig_zag ? +0.5 : -0.5; // opposites: one radius point less - if (over5) end_circles += zig_zag ? -0.5 : +0.5; + if (diff_circle) { + start_circles += (zig_zag) ? 0.5 : -0.5; // opposites: one radius point less + end_circles = -start_circles; + } zig_zag = !zig_zag; - if (over4) z_at_pt[axis] /= (zig_zag ? 3.0 : 2.0); // average between radius points + if (multi_circle) z_at_pt[axis] /= (zig_zag) ? 3.0 : 2.0; // average between radius points } } + if (intermediates) step_axis = 2; - if (equals4 || over5) step_axis = 2; for (uint8_t axis = start; axis < 13; axis += step_axis) { // average half intermediates to towers and opposites - if (equals4 || over5) + if (intermediates) z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0; S1 += z_at_pt[axis]; @@ -5181,7 +5191,7 @@ inline void gcode_G28() { #define Z0444(I) ZP(a_factor * 4.0 / 9.0, I) #define Z0888(I) ZP(a_factor * 8.0 / 9.0, I) - switch (c_value) { + switch (probe_mode) { case -1: test_precision = 0.00; case 1: @@ -5207,8 +5217,8 @@ inline void gcode_G28() { e_delta[Y_AXIS] = Z1050(0) - Z0175(1) + Z0350(5) - Z0175(9) + Z0175(7) - Z0350(11) + Z0175(3); e_delta[Z_AXIS] = Z1050(0) - Z0175(1) - Z0175(5) + Z0350(9) + Z0175(7) + Z0175(11) - Z0350(3); r_delta = Z2250(0) - Z0375(1) - Z0375(5) - Z0375(9) - Z0375(7) - Z0375(11) - Z0375(3); - - if (c_value > 0) { //probe points negative disables tower angles + + if (probe_mode > 0) { //probe points negative disables tower angles t_alpha = + Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3); t_beta = - Z0888(1) + Z0444(5) + Z0444(9) - Z0888(7) + Z0444(11) + Z0444(3); } @@ -5241,10 +5251,10 @@ inline void gcode_G28() { // print report if (verbose_level == 2) { - SERIAL_PROTOCOLPGM(". c:"); + SERIAL_PROTOCOLPGM(". c:"); if (z_at_pt[0] > 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[0], 2); - if (probe_points > 2 || c_value == 2) { + if (towers) { SERIAL_PROTOCOLPGM(" x:"); if (z_at_pt[1] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[1], 2); @@ -5255,9 +5265,9 @@ inline void gcode_G28() { if (z_at_pt[9] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[9], 2); } - if (c_value != -2) SERIAL_EOL; - if (probe_points > 2 || c_value == -2) { - if (probe_points > 2) { + if (!o_mode) SERIAL_EOL; + if (opposites) { + if (_7_probe) { SERIAL_CHAR('.'); SERIAL_PROTOCOL_SP(12); } @@ -5293,7 +5303,7 @@ inline void gcode_G28() { lcd_setstatus(mess); } SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); - if (probe_points > 1) { + if (!_1_point) { SERIAL_PROTOCOLPGM(" Ex:"); if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2); @@ -5306,7 +5316,7 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } SERIAL_EOL; - if (c_value > 2) { + if (_7_point) { SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index 3d2ca2bb4..41460bc2f 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -42,7 +42,7 @@ #define EEPROM_OFFSET 100 /** - * V33 EEPROM Layout: + * V35 EEPROM Layout: * * 100 Version (char x4) * 104 EEPROM Checksum (uint16_t) @@ -410,8 +410,10 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(delta_radius); // 1 float EEPROM_WRITE(delta_diagonal_rod); // 1 float EEPROM_WRITE(delta_segments_per_second); // 1 float - EEPROM_WRITE(delta_calibration_radius); // 1 floats + EEPROM_WRITE(delta_calibration_radius); // 1 float EEPROM_WRITE(delta_tower_angle_trim); // 2 floats + dummy = 0.0f; + for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); #elif ENABLED(Z_DUAL_ENDSTOPS) EEPROM_WRITE(z_endstop_adj); // 1 float dummy = 0.0f; @@ -778,8 +780,10 @@ void MarlinSettings::postprocess() { EEPROM_READ(delta_radius); // 1 float EEPROM_READ(delta_diagonal_rod); // 1 float EEPROM_READ(delta_segments_per_second); // 1 float - EEPROM_READ(delta_calibration_radius); // 1 floats + EEPROM_READ(delta_calibration_radius); // 1 float EEPROM_READ(delta_tower_angle_trim); // 2 floats + dummy = 0.0f; + for (uint8_t q=3; q--;) EEPROM_READ(dummy); #elif ENABLED(Z_DUAL_ENDSTOPS) EEPROM_READ(z_endstop_adj); dummy = 0.0f; @@ -1066,7 +1070,7 @@ void MarlinSettings::reset() { #if ENABLED(DELTA) const float adj[ABC] = DELTA_ENDSTOP_ADJ, - dta[2] = DELTA_TOWER_ANGLE_TRIM; + dta[ABC] = DELTA_TOWER_ANGLE_TRIM; COPY(endstop_adj, adj); delta_radius = DELTA_RADIUS; delta_diagonal_rod = DELTA_DIAGONAL_ROD; diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h index 186161b87..df845e487 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h @@ -450,21 +450,12 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 218.0 // mm -/* - // Horizontal offset from middle of printer to smooth rod center. - #define DELTA_SMOOTH_ROD_OFFSET 150.0 // mm - // Horizontal offset of the universal joints on the end effector. - #define DELTA_EFFECTOR_OFFSET 24.0 // mm - - // Horizontal offset of the universal joints on the carriages. - #define DELTA_CARRIAGE_OFFSET 22.0 // mm -*/ // Horizontal distance bridged by diagonal push rods when effector is centered. #define DELTA_RADIUS 100.00 //mm // get this value from auto calibrate - // height from z=0.00 to home position - #define DELTA_HEIGHT 295.00 // get this value from auto calibrate - use G33 C-1 at 1st time calibration + // height from z=0 to home position + #define DELTA_HEIGHT 295.00 // get this value from auto calibrate - use G33 P1 A at 1st time calibration // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). #define DELTA_PRINTABLE_RADIUS 85.0 @@ -486,16 +477,16 @@ // After homing move down to a height where XY movement is unconstrained #define DELTA_HOME_TO_SAFE_ZONE - #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0, 0, 0 } // get these from auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0, 0, 0 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm - //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} - //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_RADIUS_TRIM_TOWER {0, 0, 0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0} #endif @@ -604,7 +595,7 @@ #define DEFAULT_XJERK 20.0 #define DEFAULT_YJERK DEFAULT_XJERK #define DEFAULT_ZJERK DEFAULT_YJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#define DEFAULT_EJERK 5.0 /** @@ -670,6 +661,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. @@ -704,7 +698,7 @@ #define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z // Speed for the "accurate" probe of each point -#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 6) +#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST) / 6 // Use double touch for probing //#define PROBE_DOUBLE_TOUCH @@ -728,7 +722,7 @@ #define Z_PROBE_ALLEN_KEY_DEPLOY_2_X 0.0 #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Y DELTA_PRINTABLE_RADIUS #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0 - #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED/10) + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED)/10 #define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75 #define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75 @@ -868,7 +862,7 @@ #define INVERT_Y_DIR true #define INVERT_Z_DIR true -// Enable this option for Toshiba steppers +// Enable this option for Toshiba steppers drivers //#define CONFIG_STEPPERS_TOSHIBA // @section extruder diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h index 167deb36a..bca6a13cc 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h @@ -448,7 +448,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 218.0 // mm -/* + // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 150.0 // mm @@ -457,9 +457,9 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 22.0 // mm -*/ + // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 104 //mm // get this value from auto calibrate + #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET - DELTA_EFFECTOR_OFFSET - DELTA_CARRIAGE_OFFSET) //mm // get this value from auto calibrate // height from z=0.00 to home position #define DELTA_HEIGHT 280 // get this value from auto calibrate - use G33 C-1 at 1st time calibration @@ -470,30 +470,30 @@ // Delta calibration menu // uncomment to add three points calibration menu option. // See http://minow.blogspot.com/index.html#4918805519571907051 - #define DELTA_CALIBRATION_MENU + //#define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 17) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - #define DELTA_AUTO_CALIBRATION + //#define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained - #define DELTA_HOME_TO_SAFE_ZONE + //#define DELTA_HOME_TO_SAFE_ZONE - #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0, 0, 0 } // get these from auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0, 0, 0 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm - //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} - //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_RADIUS_TRIM_TOWER {0, 0, 0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0} #endif diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 310498f21..2ec624fbb 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -438,7 +438,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 250.0 // mm -/* + // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 175.0 // mm @@ -447,9 +447,11 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 18.0 // mm -*/ + // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 125 //mm // get this value from auto calibrate // height from z=0.00 to home position + #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET - DELTA_EFFECTOR_OFFSET - DELTA_CARRIAGE_OFFSET) //mm // get this value from auto calibrate // height from z=0.00 to home position + + // height from z=0.00 to home position #define DELTA_HEIGHT 250 // get this value from auto calibrate - use G33 C-1 at 1st time calibration // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). @@ -457,30 +459,30 @@ // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 - #define DELTA_CALIBRATION_MENU + //#define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 28) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - #define DELTA_AUTO_CALIBRATION + //#define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained - #define DELTA_HOME_TO_SAFE_ZONE + //#define DELTA_HOME_TO_SAFE_ZONE - #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0, 0, 0 } // get these from auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0, 0, 0 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm - //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} - //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_RADIUS_TRIM_TOWER {0, 0, 0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0} #endif diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 77f49f314..54eb2f00a 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -438,7 +438,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 215.0 // mm -/* + // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 145.0 // mm @@ -447,9 +447,9 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 19.5 // mm -*/ + // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 105 //mm // get this value from auto calibrate + #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET - DELTA_EFFECTOR_OFFSET - DELTA_CARRIAGE_OFFSET) //mm // get this value from auto calibrate // height from z=0.00 to home position #define DELTA_HEIGHT 250 // get this value from auto calibrate - use G33 C-1 at 1st time calibration @@ -459,30 +459,30 @@ // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 - #define DELTA_CALIBRATION_MENU + //#define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 18) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - #define DELTA_AUTO_CALIBRATION + //#define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained - #define DELTA_HOME_TO_SAFE_ZONE + //#define DELTA_HOME_TO_SAFE_ZONE - #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0, 0, 0 } // get these from auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0, 0, 0 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm - //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} - //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_RADIUS_TRIM_TOWER {0, 0, 0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0} #endif diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index d70817975..ca41cd4e6 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -425,7 +425,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 301.0 // mm -/* + // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 212.357 // mm @@ -434,9 +434,9 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 30.0 // mm -*/ + // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 150 //mm // get this value from auto calibrate + #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET - DELTA_EFFECTOR_OFFSET - DELTA_CARRIAGE_OFFSET) //mm // get this value from auto calibrate // height from z=0.00 to home position #define DELTA_HEIGHT 277 // get this value from auto calibrate - use G33 C-1 at 1st time calibration @@ -446,30 +446,30 @@ // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 - #define DELTA_CALIBRATION_MENU + //#define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 25.4) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - #define DELTA_AUTO_CALIBRATION + //#define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained - #define DELTA_HOME_TO_SAFE_ZONE + //#define DELTA_HOME_TO_SAFE_ZONE - #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0, 0, 0 } // get these from auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0, 0, 0 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm - //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} - //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_RADIUS_TRIM_TOWER {0, 0, 0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0} #endif diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index b71e8bf73..d632c207b 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -443,7 +443,7 @@ // Center-to-center distance of the holes in the diagonal push rods. #define DELTA_DIAGONAL_ROD 317.3 + 2.5 // mm -/* + // Horizontal offset from middle of printer to smooth rod center. #define DELTA_SMOOTH_ROD_OFFSET 220.1 // mm @@ -452,9 +452,9 @@ // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 22.0 // mm -*/ + // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 175 //mm // get this value from auto calibrate + #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET - DELTA_EFFECTOR_OFFSET - DELTA_CARRIAGE_OFFSET) //mm // get this value from auto calibrate // height from z=0.00 to home position #define DELTA_HEIGHT 380 // get this value from auto calibrate - use G33 C-1 at 1st time calibration @@ -464,30 +464,30 @@ // Delta calibration menu // See http://minow.blogspot.com/index.html#4918805519571907051 - #define DELTA_CALIBRATION_MENU + //#define DELTA_CALIBRATION_MENU // set the radius for the calibration probe points - max 0.8 * DELTA_PRINTABLE_RADIUS if DELTA_AUTO_CALIBRATION enabled #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - 28) // mm // G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) - #define DELTA_AUTO_CALIBRATION + //#define DELTA_AUTO_CALIBRATION #if ENABLED(DELTA_AUTO_CALIBRATION) #define DELTA_CALIBRATION_DEFAULT_POINTS 3 // set the default number of probe points : n*n (-7 -> +7) #endif // After homing move down to a height where XY movement is unconstrained - #define DELTA_HOME_TO_SAFE_ZONE + //#define DELTA_HOME_TO_SAFE_ZONE - #define DELTA_ENDSTOP_ADJ { -0.00, -0.00, -0.00 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0, 0, 0 } // get these from auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.00, 0.00 } // get these from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0, 0, 0 } // get these from auto calibrate // delta radius and diaginal rod adjustments measured in mm - //#define DELTA_RADIUS_TRIM_TOWER {0.0, 0.0, 0.0} - //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0.0, 0.0, 0.0} + //#define DELTA_RADIUS_TRIM_TOWER {0, 0, 0} + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0} #endif diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index d524ad9dd..9ec06275f 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1834,7 +1834,7 @@ void kill_screen(const char* lcd_msg) { MENU_BACK(MSG_MAIN); #if ENABLED(DELTA_AUTO_CALIBRATION) MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33")); - MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 C-1")); + MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 P1 A")); #endif MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home); if (axis_homed[Z_AXIS]) { From 471a321624899b9f4d5fc358b176306192aa6c83 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Sun, 30 Apr 2017 17:19:18 +0200 Subject: [PATCH 17/18] leaner code for probe routine --- Marlin/Marlin_main.cpp | 184 ++++++++++++++++++++--------------------- 1 file changed, 90 insertions(+), 94 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5d533ea73..de969700b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -61,7 +61,7 @@ * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location) * G31 - Dock sled (Z_PROBE_SLED only) * G32 - Undock sled (Z_PROBE_SLED only) - * G33 - Delta '1-4-7-point' auto calibration : "G33 P V" (Requires DELTA) + * G33 - Delta '1-4-7-point' auto calibration : "G33 V P " (Requires DELTA) * G38 - Probe target - similar to G28 except it uses the Z_MIN_PROBE for all three axes * G90 - Use Absolute Coordinates * G91 - Use Relative Coordinates @@ -4994,8 +4994,12 @@ inline void gcode_G28() { * G33 - Delta '1-4-7-point' auto calibration (Requires DELTA) * * Usage: - * G33 + * G33 * + * Vn = verbose level (n=0-2 default 1) + * n=0 dry-run mode: setting + probe results / no calibration + * n=1 settings + * n=2 setting + probe results * Pn = n=-7 -> +7 : n*n probe points * calibrates height ('1 point'), endstops, and delta radius ('4 points') * and tower angles with n > 2 ('7+ points') @@ -5006,10 +5010,6 @@ inline void gcode_G28() { * A = abort 1 point delta height calibration after 1 probe * O = use oposite tower points instead of tower points with 4 point calibration * T = do not calibrate tower angles with 7+ point calibration - * Vn = verbose level (n=0-2 default 1) - * n=0 dry-run mode: no calibration - * n=1 settings - * n=2 setting + probe results */ inline void gcode_G33() { @@ -5019,14 +5019,14 @@ inline void gcode_G28() { set_bed_leveling_enabled(false); #endif - int8_t pp = code_seen('P') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS, - probe_mode = (WITHIN(pp, 1, 7)) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS; + int8_t pp = (code_seen('P') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS), + probe_mode = (WITHIN(pp, 1, 7) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS); - probe_mode = (code_seen('A') && probe_mode == 1) ? -probe_mode : probe_mode; - probe_mode = (code_seen('O') && probe_mode == 2) ? -probe_mode : probe_mode; - probe_mode = (code_seen('T') && probe_mode > 2) ? -probe_mode : probe_mode; + probe_mode = (code_seen('A') && probe_mode == 1 ? -probe_mode : probe_mode); + probe_mode = (code_seen('O') && probe_mode == 2 ? -probe_mode : probe_mode); + probe_mode = (code_seen('T') && probe_mode > 2 ? -probe_mode : probe_mode); - int8_t verbose_level = code_seen('V') ? code_value_byte() : 1; + int8_t verbose_level = (code_seen('V') ? code_value_byte() : 1); if (!WITHIN(verbose_level, 0, 2)) verbose_level = 1; @@ -5034,7 +5034,7 @@ inline void gcode_G28() { const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h"; float test_precision, - zero_std_dev = verbose_level ? 999.0 : 0.0, // 0.0 in dry-run mode : forced end + zero_std_dev = (verbose_level ? 999.0 : 0.0), // 0.0 in dry-run mode : forced end e_old[XYZ] = { endstop_adj[A_AXIS], endstop_adj[B_AXIS], @@ -5046,11 +5046,17 @@ inline void gcode_G28() { beta_old = delta_tower_angle_trim[B_AXIS]; int8_t iterations = 0, probe_points = abs(probe_mode); - bool _1_point = (probe_points <= 1), - _7_point = (probe_mode > 2), - o_mode = (probe_mode == -2), - towers = (probe_points > 2 || probe_mode == 2), - opposites = (probe_points > 2 || o_mode); + const bool pp_equals_1 = (probe_points == 1), + pp_equals_2 = (probe_points == 2), + pp_equals_3 = (probe_points == 3), + pp_equals_4 = (probe_points == 4), + pp_equals_5 = (probe_points == 5), + pp_equals_6 = (probe_points == 6), + pp_equals_7 = (probe_points == 7), + pp_greather_2 = (probe_points > 2), + pp_greather_3 = (probe_points > 3), + pp_greather_4 = (probe_points > 4), + pp_greather_5 = (probe_points > 5); // print settings @@ -5061,7 +5067,7 @@ inline void gcode_G28() { LCD_MESSAGEPGM("Checking... AC"); SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); - if (!_1_point) { + if (!pp_equals_1) { SERIAL_PROTOCOLPGM(" Ex:"); if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2); @@ -5074,7 +5080,7 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } SERIAL_EOL; - if (_7_point) { + if (probe_mode > 2) { // negative disables tower angles SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); @@ -5092,78 +5098,69 @@ inline void gcode_G28() { do { float z_at_pt[13] = { 0 }, - S1 = z_at_pt[0], - S2 = sq(S1); - int16_t N = 1; - bool _4_probe = (probe_points == 2), - _7_probe = (probe_points > 2), - center_probe = (probe_points != 3 && probe_points != 6), - multi_circle = (probe_points > 4), - diff_circle = (probe_points > 5), - max_circle = (probe_points > 6), - intermediates = (probe_points == 4 || diff_circle); - - setup_for_endstop_or_probe_move(); + S1 = 0.0, + S2 = 0.0; + int16_t N = 0; + test_precision = zero_std_dev; iterations++; // probe the points - int16_t center_points = 0; - - if (center_probe) { // probe centre + if (!pp_equals_3 && !pp_equals_6) { // probe the centre + setup_for_endstop_or_probe_move(); z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1); - center_points = 1; + clean_up_after_endstop_or_probe_move(); } - - int16_t step_axis = (multi_circle) ? 2 : 4, - start = (multi_circle) ? 11 : 9; - if (_7_probe) { // probe extra 3 or 6 centre points - for (int8_t axis = start; axis > 0; axis -= step_axis) { + if (pp_greather_2) { // probe extra centre points + for (int8_t axis = (pp_greather_4 ? 11 : 9); axis > 0; axis -= (pp_greather_4 ? 2 : 4)) { + setup_for_endstop_or_probe_move(); z_at_pt[0] += probe_pt( cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1); + clean_up_after_endstop_or_probe_move(); } - center_points += (multi_circle) ? 6 : 3; // average centre points - z_at_pt[0] /= center_points; + z_at_pt[0] /= (pp_equals_5 ? 7 : probe_points); } - - start = (o_mode) ? 3 : 1; - step_axis = (_4_probe) ? 4 : (intermediates) ? 1 : 2; - - if (!_1_point) { - float start_circles = (max_circle) ? -1.5 : (multi_circle) ? -1 : 0, // one or multi radius points + if (!pp_equals_1) { // probe the radius + float start_circles = (pp_equals_7 ? -1.5 : pp_equals_6 || pp_equals_5 ? -1 : 0), end_circles = -start_circles; bool zig_zag = true; - for (uint8_t axis = start; axis < 13; axis += step_axis) { // probes 3, 6 or 12 points on the calibration radius - for (float circles = start_circles ; circles <= end_circles; circles++) // one or multi radius points + for (uint8_t axis = (probe_mode == -2 ? 3 : 1); axis < 13; + axis += (pp_equals_2 ? 4 : pp_equals_3 || pp_equals_5 ? 2 : 1)) { + for (float circles = start_circles ; circles <= end_circles; circles++) { + setup_for_endstop_or_probe_move(); z_at_pt[axis] += probe_pt( - cos(RADIANS(180 + 30 * axis)) * (1 + circles * 0.1 * ((zig_zag) ? 1 : -1)) * delta_calibration_radius, - sin(RADIANS(180 + 30 * axis)) * (1 + circles * 0.1 * ((zig_zag) ? 1 : -1)) * delta_calibration_radius, true, 1); - - if (diff_circle) { - start_circles += (zig_zag) ? 0.5 : -0.5; // opposites: one radius point less - end_circles = -start_circles; + cos(RADIANS(180 + 30 * axis)) * + (1 + circles * 0.1 * (zig_zag ? 1 : -1)) * delta_calibration_radius, + sin(RADIANS(180 + 30 * axis)) * + (1 + circles * 0.1 * (zig_zag ? 1 : -1)) * delta_calibration_radius, true, 1); + clean_up_after_endstop_or_probe_move(); } + start_circles += (pp_greather_5 ? (zig_zag ? 0.5 : -0.5) : 0); + end_circles = -start_circles; zig_zag = !zig_zag; - if (multi_circle) z_at_pt[axis] /= (zig_zag) ? 3.0 : 2.0; // average between radius points + z_at_pt[axis] /= (pp_equals_7 ? (zig_zag ? 4.0 : 3.0) : + pp_equals_6 ? (zig_zag ? 3.0 : 2.0) : pp_equals_5 ? 3 : 1); } } - if (intermediates) step_axis = 2; - - for (uint8_t axis = start; axis < 13; axis += step_axis) { // average half intermediates to towers and opposites - if (intermediates) + if (pp_greather_3 && !pp_equals_5) // average intermediates to tower and opposites + for (uint8_t axis = 1; axis < 13; axis += 2) z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0; - S1 += z_at_pt[axis]; - S2 += sq(z_at_pt[axis]); - N++; - } + S1 += z_at_pt[0]; + S2 += sq(z_at_pt[0]); + N++; + if (!pp_equals_1) // std dev from zero plane + for (uint8_t axis = 1; axis < 13; axis += (pp_equals_2 ? 4 : 2)) { + S1 += z_at_pt[axis]; + S2 += sq(z_at_pt[axis]); + N++; + } + zero_std_dev = round(sqrt(S2 / N) * 1000.0) / 1000.0 + 0.00001; // Solve matrices - zero_std_dev = round(sqrt(S2 / N) * 1000.0) / 1000.0 + 0.00001; // deviation from zero plane - if (zero_std_dev < test_precision) { COPY(e_old, endstop_adj); dr_old = delta_radius; @@ -5173,11 +5170,10 @@ inline void gcode_G28() { float e_delta[XYZ] = { 0.0 }, r_delta = 0.0, t_alpha = 0.0, t_beta = 0.0; - const float r_diff = delta_radius - delta_calibration_radius, - h_factor = 1.00 + r_diff * 0.001, //1.02 for r_diff = 20mm - r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)), //2.25 for r_diff = 20mm - a_factor = 100.0 / delta_calibration_radius; //1.25 for cal_rd = 80mm + h_factor = 1.00 + r_diff * 0.001, //1.02 for r_diff = 20mm + r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)), //2.25 for r_diff = 20mm + a_factor = 100.0 / delta_calibration_radius; //1.25 for cal_rd = 80mm #define ZP(N,I) ((N) * z_at_pt[I]) #define Z1000(I) ZP(1.00, I) @@ -5218,43 +5214,42 @@ inline void gcode_G28() { e_delta[Z_AXIS] = Z1050(0) - Z0175(1) - Z0175(5) + Z0350(9) + Z0175(7) + Z0175(11) - Z0350(3); r_delta = Z2250(0) - Z0375(1) - Z0375(5) - Z0375(9) - Z0375(7) - Z0375(11) - Z0375(3); - if (probe_mode > 0) { //probe points negative disables tower angles + if (probe_mode > 0) { // negative disables tower angles t_alpha = + Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3); t_beta = - Z0888(1) + Z0444(5) + Z0444(9) - Z0888(7) + Z0444(11) + Z0444(3); } break; } - // adjust delta_height and endstops by the max amount LOOP_XYZ(axis) endstop_adj[axis] += e_delta[axis]; delta_radius += r_delta; + delta_tower_angle_trim[A_AXIS] += t_alpha; + delta_tower_angle_trim[B_AXIS] -= t_beta; + // adjust delta_height and endstops by the max amount const float z_temp = MAX3(endstop_adj[A_AXIS], endstop_adj[B_AXIS], endstop_adj[C_AXIS]); home_offset[Z_AXIS] -= z_temp; LOOP_XYZ(i) endstop_adj[i] -= z_temp; - delta_tower_angle_trim[A_AXIS] += t_alpha; - delta_tower_angle_trim[B_AXIS] -= t_beta; - recalc_delta_settings(delta_radius, delta_diagonal_rod); } - else { // !iterate - // step one back + else { // step one back COPY(endstop_adj, e_old); delta_radius = dr_old; home_offset[Z_AXIS] = zh_old; delta_tower_angle_trim[A_AXIS] = alpha_old; delta_tower_angle_trim[B_AXIS] = beta_old; + recalc_delta_settings(delta_radius, delta_diagonal_rod); } - // print report + // print report - if (verbose_level == 2) { + if (verbose_level != 1) { SERIAL_PROTOCOLPGM(". c:"); if (z_at_pt[0] > 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[0], 2); - if (towers) { + if (probe_mode == 2 || pp_greather_2) { SERIAL_PROTOCOLPGM(" x:"); if (z_at_pt[1] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[1], 2); @@ -5265,11 +5260,11 @@ inline void gcode_G28() { if (z_at_pt[9] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(z_at_pt[9], 2); } - if (!o_mode) SERIAL_EOL; - if (opposites) { - if (_7_probe) { + if (probe_mode != -2) SERIAL_EOL; + if (probe_mode == -2 || pp_greather_2) { + if (pp_greather_2) { SERIAL_CHAR('.'); - SERIAL_PROTOCOL_SP(12); + SERIAL_PROTOCOL_SP(13); } SERIAL_PROTOCOLPGM(" yz:"); if (z_at_pt[7] >= 0) SERIAL_CHAR('+'); @@ -5283,15 +5278,15 @@ inline void gcode_G28() { SERIAL_EOL; } } - if (test_precision != 0.0) { // !forced end - if (zero_std_dev >= test_precision) { // end iterations + if (test_precision != 0.0) { // !forced end + if (zero_std_dev >= test_precision) { // end iterations SERIAL_PROTOCOLPGM("Calibration OK"); SERIAL_PROTOCOL_SP(36); SERIAL_PROTOCOLPGM("rolling back."); SERIAL_EOL; LCD_MESSAGEPGM("Calibration OK"); } - else { // !end iterations + else { // !end iterations char mess[15] = "No convergence"; if (iterations < 31) sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations); @@ -5303,7 +5298,7 @@ inline void gcode_G28() { lcd_setstatus(mess); } SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); - if (!_1_point) { + if (!pp_equals_1) { SERIAL_PROTOCOLPGM(" Ex:"); if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2); @@ -5316,7 +5311,7 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } SERIAL_EOL; - if (_7_point) { + if (probe_mode > 2) { // negative disables tower angles SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); @@ -5328,8 +5323,9 @@ inline void gcode_G28() { } if (zero_std_dev >= test_precision) serialprintPGM(save_message); - } - else { // forced end + SERIAL_EOL; + } + else { // forced end if (verbose_level == 0) { SERIAL_PROTOCOLPGM("End DRY-RUN"); SERIAL_PROTOCOL_SP(39); @@ -5343,10 +5339,10 @@ inline void gcode_G28() { SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); SERIAL_EOL; serialprintPGM(save_message); + SERIAL_EOL; } } - clean_up_after_endstop_or_probe_move(); stepper.synchronize(); gcode_G28(); From cafc48dff8bf4953d4b0e335c7bc936cd0d5e917 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Sun, 30 Apr 2017 20:59:49 +0200 Subject: [PATCH 18/18] little oops --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index de969700b..4994f23d6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5152,7 +5152,7 @@ inline void gcode_G28() { S2 += sq(z_at_pt[0]); N++; if (!pp_equals_1) // std dev from zero plane - for (uint8_t axis = 1; axis < 13; axis += (pp_equals_2 ? 4 : 2)) { + for (uint8_t axis = (probe_mode == -2 ? 3 : 1); axis < 13; axis += (pp_equals_2 ? 4 : 2)) { S1 += z_at_pt[axis]; S2 += sq(z_at_pt[axis]); N++; @@ -5324,7 +5324,7 @@ inline void gcode_G28() { if (zero_std_dev >= test_precision) serialprintPGM(save_message); SERIAL_EOL; - } + } else { // forced end if (verbose_level == 0) { SERIAL_PROTOCOLPGM("End DRY-RUN");