Adjustable delta_diagonal_rod_trim (#18423)

This commit is contained in:
Fabio Santos 2020-06-27 21:53:44 -07:00 committed by GitHub
parent 31349fd69a
commit 29753baeee
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 10 deletions

View file

@ -40,6 +40,9 @@
* X = Alpha (Tower 1) angle trim * X = Alpha (Tower 1) angle trim
* Y = Beta (Tower 2) angle trim * Y = Beta (Tower 2) angle trim
* Z = Gamma (Tower 3) angle trim * Z = Gamma (Tower 3) angle 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() { void GcodeSuite::M665() {
if (parser.seen('H')) delta_height = parser.value_linear_units(); 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('X')) delta_tower_angle_trim.a = parser.value_float();
if (parser.seen('Y')) delta_tower_angle_trim.b = 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('Z')) delta_tower_angle_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(); recalc_delta_settings();
} }

View file

@ -261,7 +261,8 @@ typedef struct SettingsDataStruct {
float delta_radius, // M665 R float delta_radius, // M665 R
delta_diagonal_rod, // M665 L delta_diagonal_rod, // M665 L
delta_segments_per_second; // M665 S delta_segments_per_second; // M665 S
abc_float_t delta_tower_angle_trim; // M665 XYZ abc_float_t delta_tower_angle_trim, // M665 X Y Z
delta_diagonal_rod_trim; // M665 A B C
#elif HAS_EXTRA_ENDSTOPS #elif HAS_EXTRA_ENDSTOPS
float x2_endstop_adj, // M666 X float x2_endstop_adj, // M666 X
y2_endstop_adj, // M666 Y y2_endstop_adj, // M666 Y
@ -775,6 +776,7 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(delta_diagonal_rod); // 1 float EEPROM_WRITE(delta_diagonal_rod); // 1 float
EEPROM_WRITE(delta_segments_per_second); // 1 float EEPROM_WRITE(delta_segments_per_second); // 1 float
EEPROM_WRITE(delta_tower_angle_trim); // 3 floats EEPROM_WRITE(delta_tower_angle_trim); // 3 floats
EEPROM_WRITE(delta_diagonal_rod_trim); // 3 floats
#elif HAS_EXTRA_ENDSTOPS #elif HAS_EXTRA_ENDSTOPS
@ -1638,6 +1640,7 @@ void MarlinSettings::postprocess() {
EEPROM_READ(delta_diagonal_rod); // 1 float EEPROM_READ(delta_diagonal_rod); // 1 float
EEPROM_READ(delta_segments_per_second); // 1 float EEPROM_READ(delta_segments_per_second); // 1 float
EEPROM_READ(delta_tower_angle_trim); // 3 floats EEPROM_READ(delta_tower_angle_trim); // 3 floats
EEPROM_READ(delta_diagonal_rod_trim); // 3 floats
#elif HAS_EXTRA_ENDSTOPS #elif HAS_EXTRA_ENDSTOPS
@ -2510,13 +2513,14 @@ void MarlinSettings::reset() {
// //
#if ENABLED(DELTA) #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_height = DELTA_HEIGHT;
delta_endstop_adj = adj; delta_endstop_adj = adj;
delta_radius = DELTA_RADIUS; delta_radius = DELTA_RADIUS;
delta_diagonal_rod = DELTA_DIAGONAL_ROD; delta_diagonal_rod = DELTA_DIAGONAL_ROD;
delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND; delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
delta_tower_angle_trim = dta; delta_tower_angle_trim = dta;
delta_diagonal_rod_trim = ddr;
#endif #endif
#if ENABLED(X_DUAL_ENDSTOPS) #if ENABLED(X_DUAL_ENDSTOPS)
@ -3065,7 +3069,7 @@ void MarlinSettings::reset() {
, SP_Z_STR, LINEAR_UNIT(delta_endstop_adj.c) , SP_Z_STR, LINEAR_UNIT(delta_endstop_adj.c)
); );
CONFIG_ECHO_HEADING("Delta settings: L<diagonal_rod> R<radius> H<height> S<segments_per_s> XYZ<tower angle corrections>"); CONFIG_ECHO_HEADING("Delta settings: L<diagonal rod> R<radius> H<height> S<segments per sec> XYZ<tower angle trim> ABC<rod trim>");
CONFIG_ECHO_START(); CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P( SERIAL_ECHOLNPAIR_P(
PSTR(" M665 L"), LINEAR_UNIT(delta_diagonal_rod) PSTR(" M665 L"), LINEAR_UNIT(delta_diagonal_rod)
@ -3075,6 +3079,9 @@ void MarlinSettings::reset() {
, SP_X_STR, LINEAR_UNIT(delta_tower_angle_trim.a) , SP_X_STR, LINEAR_UNIT(delta_tower_angle_trim.a)
, SP_Y_STR, LINEAR_UNIT(delta_tower_angle_trim.b) , SP_Y_STR, LINEAR_UNIT(delta_tower_angle_trim.b)
, SP_Z_STR, LINEAR_UNIT(delta_tower_angle_trim.c) , SP_Z_STR, LINEAR_UNIT(delta_tower_angle_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 #elif HAS_EXTRA_ENDSTOPS

View file

@ -59,6 +59,7 @@ abc_float_t delta_tower_angle_trim;
xy_float_t delta_tower[ABC]; xy_float_t delta_tower[ABC];
abc_float_t delta_diagonal_rod_2_tower; abc_float_t delta_diagonal_rod_2_tower;
float delta_clip_start_height = Z_MAX_POS; float delta_clip_start_height = Z_MAX_POS;
abc_float_t delta_diagonal_rod_trim;
float delta_safe_distance_from_top(); float delta_safe_distance_from_top();
@ -67,17 +68,16 @@ float delta_safe_distance_from_top();
* settings have been changed (e.g., by M665). * settings have been changed (e.g., by M665).
*/ */
void recalc_delta_settings() { void recalc_delta_settings() {
constexpr abc_float_t trt = DELTA_RADIUS_TRIM_TOWER, constexpr abc_float_t trt = DELTA_RADIUS_TRIM_TOWER;
drt = DELTA_DIAGONAL_ROD_TRIM_TOWER;
delta_tower[A_AXIS].set(cos(RADIANS(210 + delta_tower_angle_trim.a)) * (delta_radius + trt.a), // front left 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)); 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 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)); 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 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)); sin(RADIANS( 90 + delta_tower_angle_trim.c)) * (delta_radius + trt.c));
delta_diagonal_rod_2_tower.set(sq(delta_diagonal_rod + drt.a), delta_diagonal_rod_2_tower.set(sq(delta_diagonal_rod + delta_diagonal_rod_trim.a),
sq(delta_diagonal_rod + drt.b), sq(delta_diagonal_rod + delta_diagonal_rod_trim.b),
sq(delta_diagonal_rod + drt.c)); sq(delta_diagonal_rod + delta_diagonal_rod_trim.c));
update_software_endstops(Z_AXIS); update_software_endstops(Z_AXIS);
set_all_unhomed(); set_all_unhomed();
} }

View file

@ -37,6 +37,7 @@ extern abc_float_t delta_tower_angle_trim;
extern xy_float_t delta_tower[ABC]; extern xy_float_t delta_tower[ABC];
extern abc_float_t delta_diagonal_rod_2_tower; extern abc_float_t delta_diagonal_rod_2_tower;
extern float delta_clip_start_height; extern float delta_clip_start_height;
extern abc_float_t delta_diagonal_rod_trim;
/** /**
* Recalculate factors used for delta kinematics whenever * Recalculate factors used for delta kinematics whenever