From cc4bd772af69a9c52a1fcf71f37af503ec0222ab Mon Sep 17 00:00:00 2001 From: FabioSan Date: Mon, 22 Jun 2020 17:33:12 -0700 Subject: [PATCH 1/5] Diagonal rod trim configs --- Marlin/src/gcode/calibrate/M665.cpp | 6 ++++++ Marlin/src/module/configuration_store.cpp | 11 +++++++++-- Marlin/src/module/delta.cpp | 10 +++++----- Marlin/src/module/delta.h | 1 + 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Marlin/src/gcode/calibrate/M665.cpp b/Marlin/src/gcode/calibrate/M665.cpp index 0436736b4a13..c4a5b7087c3a 100644 --- a/Marlin/src/gcode/calibrate/M665.cpp +++ b/Marlin/src/gcode/calibrate/M665.cpp @@ -40,6 +40,9 @@ * X = Alpha (Tower 1) angle trim * Y = Beta (Tower 2) angle trim * Z = Gamma (Tower 3) angle trim + * M = Alpha (Tower 1) digonal rod trim + * N = Beta (Tower 2) digonal rod trim + * O = Gamma (Tower 3) digonal rod trim */ void GcodeSuite::M665() { if (parser.seen('H')) delta_height = parser.value_linear_units(); @@ -49,6 +52,9 @@ if (parser.seen('X')) delta_tower_angle_trim.a = parser.value_float(); if (parser.seen('Y')) delta_tower_angle_trim.b = parser.value_float(); if (parser.seen('Z')) delta_tower_angle_trim.c = parser.value_float(); + if (parser.seen('M')) delta_rod_diagonal_trim.a = parser.value_float(); + if (parser.seen('N')) delta_rod_diagonal_trim.b = parser.value_float(); + if (parser.seen('O')) delta_rod_diagonal_trim.c = parser.value_float(); recalc_delta_settings(); } diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 77b807ec4ca2..01028ccb7088 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -37,7 +37,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V80" +#define EEPROM_VERSION "V81" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -262,6 +262,7 @@ typedef struct SettingsDataStruct { delta_diagonal_rod, // M665 L delta_segments_per_second; // M665 S abc_float_t delta_tower_angle_trim; // M665 XYZ + abc_float_t delta_diagonal_rod_trim; // M665 MNO #elif HAS_EXTRA_ENDSTOPS float x2_endstop_adj, // M666 X y2_endstop_adj, // M666 Y @@ -775,6 +776,7 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(delta_diagonal_rod); // 1 float EEPROM_WRITE(delta_segments_per_second); // 1 float EEPROM_WRITE(delta_tower_angle_trim); // 3 floats + EEPROM_WRITE(delta_diagonal_rod_trim); // 3 floats #elif HAS_EXTRA_ENDSTOPS @@ -1655,6 +1657,7 @@ void MarlinSettings::postprocess() { EEPROM_READ(delta_diagonal_rod); // 1 float EEPROM_READ(delta_segments_per_second); // 1 float EEPROM_READ(delta_tower_angle_trim); // 3 floats + EEPROM_READ(delta_diagonal_rod_trim); // 3 floats #elif HAS_EXTRA_ENDSTOPS @@ -2542,13 +2545,14 @@ void MarlinSettings::reset() { // #if ENABLED(DELTA) - const abc_float_t adj = DELTA_ENDSTOP_ADJ, dta = DELTA_TOWER_ANGLE_TRIM; + const abc_float_t adj = DELTA_ENDSTOP_ADJ, dta = DELTA_TOWER_ANGLE_TRIM, ddr = DELTA_DIAGONAL_ROD_TRIM_TOWER; delta_height = DELTA_HEIGHT; delta_endstop_adj = adj; delta_radius = DELTA_RADIUS; delta_diagonal_rod = DELTA_DIAGONAL_ROD; delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND; delta_tower_angle_trim = dta; + delta_diagonal_rod_trim = ddr; #endif #if ENABLED(X_DUAL_ENDSTOPS) @@ -3102,6 +3106,9 @@ void MarlinSettings::reset() { , SP_X_STR, LINEAR_UNIT(delta_tower_angle_trim.a) , SP_Y_STR, LINEAR_UNIT(delta_tower_angle_trim.b) , SP_Z_STR, LINEAR_UNIT(delta_tower_angle_trim.c) + , PSTR(" M"), LINEAR_UNIT(delta_diagonal_rod_trim.a) + , PSTR(" N"), LINEAR_UNIT(delta_diagonal_rod_trim.b) + , PSTR(" O"), LINEAR_UNIT(delta_diagonal_rod_trim.c) ); #elif HAS_EXTRA_ENDSTOPS diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index 56b9e0a11e19..84293936ea6b 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -59,6 +59,7 @@ abc_float_t delta_tower_angle_trim; xy_float_t delta_tower[ABC]; abc_float_t delta_diagonal_rod_2_tower; float delta_clip_start_height = Z_MAX_POS; +abc_float_t delta_diagonal_rod_trim; float delta_safe_distance_from_top(); @@ -67,17 +68,16 @@ float delta_safe_distance_from_top(); * settings have been changed (e.g., by M665). */ void recalc_delta_settings() { - constexpr abc_float_t trt = DELTA_RADIUS_TRIM_TOWER, - drt = DELTA_DIAGONAL_ROD_TRIM_TOWER; + constexpr abc_float_t trt = DELTA_RADIUS_TRIM_TOWER; delta_tower[A_AXIS].set(cos(RADIANS(210 + delta_tower_angle_trim.a)) * (delta_radius + trt.a), // front left tower sin(RADIANS(210 + delta_tower_angle_trim.a)) * (delta_radius + trt.a)); delta_tower[B_AXIS].set(cos(RADIANS(330 + delta_tower_angle_trim.b)) * (delta_radius + trt.b), // front right tower sin(RADIANS(330 + delta_tower_angle_trim.b)) * (delta_radius + trt.b)); delta_tower[C_AXIS].set(cos(RADIANS( 90 + delta_tower_angle_trim.c)) * (delta_radius + trt.c), // back middle tower sin(RADIANS( 90 + delta_tower_angle_trim.c)) * (delta_radius + trt.c)); - delta_diagonal_rod_2_tower.set(sq(delta_diagonal_rod + drt.a), - sq(delta_diagonal_rod + drt.b), - sq(delta_diagonal_rod + drt.c)); + delta_diagonal_rod_2_tower.set(sq(delta_diagonal_rod + delta_diagonal_rod_trim.a), + sq(delta_diagonal_rod + delta_diagonal_rod_trim.b), + sq(delta_diagonal_rod + delta_diagonal_rod_trim.c)); update_software_endstops(Z_AXIS); set_all_unhomed(); } diff --git a/Marlin/src/module/delta.h b/Marlin/src/module/delta.h index f263a28ddd31..ff18e74c71c5 100644 --- a/Marlin/src/module/delta.h +++ b/Marlin/src/module/delta.h @@ -37,6 +37,7 @@ extern abc_float_t delta_tower_angle_trim; extern xy_float_t delta_tower[ABC]; extern abc_float_t delta_diagonal_rod_2_tower; extern float delta_clip_start_height; +extern abc_float_t delta_diagonal_rod_trim; /** * Recalculate factors used for delta kinematics whenever From c0d5233f1a04a0f9c6898173eccf8c697bddcb25 Mon Sep 17 00:00:00 2001 From: FabioSan Date: Mon, 22 Jun 2020 17:49:58 -0700 Subject: [PATCH 2/5] typo --- Marlin/src/gcode/calibrate/M665.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/calibrate/M665.cpp b/Marlin/src/gcode/calibrate/M665.cpp index c4a5b7087c3a..3015885cafa7 100644 --- a/Marlin/src/gcode/calibrate/M665.cpp +++ b/Marlin/src/gcode/calibrate/M665.cpp @@ -52,9 +52,9 @@ if (parser.seen('X')) delta_tower_angle_trim.a = parser.value_float(); if (parser.seen('Y')) delta_tower_angle_trim.b = parser.value_float(); if (parser.seen('Z')) delta_tower_angle_trim.c = parser.value_float(); - if (parser.seen('M')) delta_rod_diagonal_trim.a = parser.value_float(); - if (parser.seen('N')) delta_rod_diagonal_trim.b = parser.value_float(); - if (parser.seen('O')) delta_rod_diagonal_trim.c = parser.value_float(); + if (parser.seen('M')) delta_diagonal_rod_trim.a = parser.value_float(); + if (parser.seen('N')) delta_diagonal_rod_trim.b = parser.value_float(); + if (parser.seen('O')) delta_diagonal_rod_trim.c = parser.value_float(); recalc_delta_settings(); } From 954c664d49c1d99482f0224811c4fd78f37413f7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 27 Jun 2020 23:13:33 -0500 Subject: [PATCH 3/5] Can't use 'N' --- Marlin/src/gcode/calibrate/M665.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/gcode/calibrate/M665.cpp b/Marlin/src/gcode/calibrate/M665.cpp index 3015885cafa7..8b2e7f99ed49 100644 --- a/Marlin/src/gcode/calibrate/M665.cpp +++ b/Marlin/src/gcode/calibrate/M665.cpp @@ -38,11 +38,11 @@ * R = delta radius * S = segments per second * X = Alpha (Tower 1) angle trim - * Y = Beta (Tower 2) angle trim + * Y = Beta (Tower 2) angle trim * Z = Gamma (Tower 3) angle trim - * M = Alpha (Tower 1) digonal rod trim - * N = Beta (Tower 2) digonal rod trim - * O = Gamma (Tower 3) digonal rod trim + * A = Alpha (Tower 1) digonal rod trim + * B = Beta (Tower 2) digonal rod trim + * C = Gamma (Tower 3) digonal rod trim */ void GcodeSuite::M665() { if (parser.seen('H')) delta_height = parser.value_linear_units(); @@ -52,9 +52,9 @@ if (parser.seen('X')) delta_tower_angle_trim.a = parser.value_float(); if (parser.seen('Y')) delta_tower_angle_trim.b = parser.value_float(); if (parser.seen('Z')) delta_tower_angle_trim.c = parser.value_float(); - if (parser.seen('M')) delta_diagonal_rod_trim.a = parser.value_float(); - if (parser.seen('N')) delta_diagonal_rod_trim.b = parser.value_float(); - if (parser.seen('O')) delta_diagonal_rod_trim.c = parser.value_float(); + if (parser.seen('A')) delta_diagonal_rod_trim.a = parser.value_float(); + if (parser.seen('B')) delta_diagonal_rod_trim.b = parser.value_float(); + if (parser.seen('C')) delta_diagonal_rod_trim.c = parser.value_float(); recalc_delta_settings(); } From a97f97f307c68a05429836cae6a9f4d27666946a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 27 Jun 2020 23:14:09 -0500 Subject: [PATCH 4/5] Update configuration_store.cpp --- Marlin/src/module/configuration_store.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 1fe0ca56973c..adc3a1185128 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -257,12 +257,12 @@ typedef struct SettingsDataStruct { // #if ENABLED(DELTA) float delta_height; // M666 H - abc_float_t delta_endstop_adj; // M666 XYZ + abc_float_t delta_endstop_adj; // M666 X Y Z float delta_radius, // M665 R delta_diagonal_rod, // M665 L delta_segments_per_second; // M665 S - abc_float_t delta_tower_angle_trim; // M665 XYZ - abc_float_t delta_diagonal_rod_trim; // M665 MNO + abc_float_t delta_tower_angle_trim; // M665 X Y Z + abc_float_t delta_diagonal_rod_trim; // M665 A B C #elif HAS_EXTRA_ENDSTOPS float x2_endstop_adj, // M666 X y2_endstop_adj, // M666 Y From c5975d0d5090d1df46917d20d26e5d090575871c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 27 Jun 2020 23:17:17 -0500 Subject: [PATCH 5/5] Update configuration_store.cpp --- Marlin/src/module/configuration_store.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index adc3a1185128..41ce618a0432 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -261,8 +261,8 @@ typedef struct SettingsDataStruct { float delta_radius, // M665 R delta_diagonal_rod, // M665 L delta_segments_per_second; // M665 S - abc_float_t delta_tower_angle_trim; // M665 X Y Z - abc_float_t delta_diagonal_rod_trim; // M665 A B C + abc_float_t delta_tower_angle_trim, // M665 X Y Z + delta_diagonal_rod_trim; // M665 A B C #elif HAS_EXTRA_ENDSTOPS float x2_endstop_adj, // M666 X y2_endstop_adj, // M666 Y @@ -1640,7 +1640,7 @@ void MarlinSettings::postprocess() { EEPROM_READ(delta_diagonal_rod); // 1 float EEPROM_READ(delta_segments_per_second); // 1 float EEPROM_READ(delta_tower_angle_trim); // 3 floats - EEPROM_READ(delta_diagonal_rod_trim); // 3 floats + EEPROM_READ(delta_diagonal_rod_trim); // 3 floats #elif HAS_EXTRA_ENDSTOPS @@ -3069,7 +3069,7 @@ void MarlinSettings::reset() { , SP_Z_STR, LINEAR_UNIT(delta_endstop_adj.c) ); - CONFIG_ECHO_HEADING("Delta settings: L R H S XYZ"); + CONFIG_ECHO_HEADING("Delta settings: L R H S XYZ ABC"); CONFIG_ECHO_START(); SERIAL_ECHOLNPAIR_P( PSTR(" M665 L"), LINEAR_UNIT(delta_diagonal_rod) @@ -3079,9 +3079,9 @@ void MarlinSettings::reset() { , SP_X_STR, LINEAR_UNIT(delta_tower_angle_trim.a) , SP_Y_STR, LINEAR_UNIT(delta_tower_angle_trim.b) , SP_Z_STR, LINEAR_UNIT(delta_tower_angle_trim.c) - , PSTR(" M"), LINEAR_UNIT(delta_diagonal_rod_trim.a) - , PSTR(" N"), LINEAR_UNIT(delta_diagonal_rod_trim.b) - , PSTR(" O"), LINEAR_UNIT(delta_diagonal_rod_trim.c) + , PSTR(" A"), LINEAR_UNIT(delta_diagonal_rod_trim.a) + , PSTR(" B"), LINEAR_UNIT(delta_diagonal_rod_trim.b) + , PSTR(" C"), LINEAR_UNIT(delta_diagonal_rod_trim.c) ); #elif HAS_EXTRA_ENDSTOPS