Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustable delta_diagonal_rod_trim #18423

Merged
merged 6 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Marlin/src/gcode/calibrate/M665.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +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
* 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();
Expand All @@ -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('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();
}

Expand Down
15 changes: 11 additions & 4 deletions Marlin/src/module/configuration_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +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_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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -1638,6 +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

#elif HAS_EXTRA_ENDSTOPS

Expand Down Expand Up @@ -2510,13 +2513,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)
Expand Down Expand Up @@ -3065,7 +3069,7 @@ void MarlinSettings::reset() {
, 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();
SERIAL_ECHOLNPAIR_P(
PSTR(" M665 L"), LINEAR_UNIT(delta_diagonal_rod)
Expand All @@ -3075,6 +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(" 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
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/module/delta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/module/delta.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down