Added support for delta tower angle corrections.

This commit is contained in:
Jimmy Envall 2017-02-27 21:39:00 +02:00 committed by Scott Lahteine
parent 7c9e2e2a1a
commit 00b6b3da79
4 changed files with 48 additions and 15 deletions

View File

@ -630,7 +630,7 @@
#endif
/**
* Delta radius/rod trimmers
* Delta radius/rod trimmers/angle trimmers
*/
#if ENABLED(DELTA)
#ifndef DELTA_RADIUS_TRIM_TOWER_1
@ -651,6 +651,15 @@
#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
#endif
#ifndef DELTA_TOWER_ANGLE_TRIM_2
#define DELTA_TOWER_ANGLE_TRIM_2 0.0
#endif
#ifndef DELTA_TOWER_ANGLE_TRIM_3
#define DELTA_TOWER_ANGLE_TRIM_3 0.0
#endif
#endif
/**

View File

@ -335,6 +335,9 @@ float code_value_temp_diff();
delta_diagonal_rod_trim_tower_1,
delta_diagonal_rod_trim_tower_2,
delta_diagonal_rod_trim_tower_3,
delta_tower_angle_trim_1,
delta_tower_angle_trim_2,
delta_tower_angle_trim_3,
delta_clip_start_height;
void recalc_delta_settings(float radius, float diagonal_rod);
#elif IS_SCARA

30
Marlin/Marlin_main.cpp Executable file → Normal file
View File

@ -564,12 +564,15 @@ static uint8_t target_extruder;
// these are the default values, can be overriden with M665
float delta_radius = DELTA_RADIUS,
delta_tower1_x = -SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1), // front left tower
delta_tower1_y = -COS_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1),
delta_tower2_x = SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2), // front right tower
delta_tower2_y = -COS_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2),
delta_tower3_x = 0, // back middle tower
delta_tower3_y = (delta_radius + DELTA_RADIUS_TRIM_TOWER_3),
delta_tower_angle_trim_1 = DELTA_TOWER_ANGLE_TRIM_1,
delta_tower_angle_trim_2 = DELTA_TOWER_ANGLE_TRIM_2,
delta_tower_angle_trim_3 = DELTA_TOWER_ANGLE_TRIM_3,
delta_tower1_x = -sin( (60 - delta_tower_angle_trim_1) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1), // front left tower
delta_tower1_y = -cos( (60 - delta_tower_angle_trim_1) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1),
delta_tower2_x = sin( (60 + delta_tower_angle_trim_2) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2), // front right tower
delta_tower2_y = -cos( (60 + delta_tower_angle_trim_2) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2),
delta_tower3_x = -sin( ( delta_tower_angle_trim_3) * PI/180), // back middle tower
delta_tower3_y = cos( ( delta_tower_angle_trim_3) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_3),
delta_diagonal_rod = DELTA_DIAGONAL_ROD,
delta_diagonal_rod_trim_tower_1 = DELTA_DIAGONAL_ROD_TRIM_TOWER_1,
delta_diagonal_rod_trim_tower_2 = DELTA_DIAGONAL_ROD_TRIM_TOWER_2,
@ -6337,6 +6340,9 @@ inline void gcode_M205() {
if (code_seen('A')) delta_diagonal_rod_trim_tower_1 = code_value_linear_units();
if (code_seen('B')) delta_diagonal_rod_trim_tower_2 = code_value_linear_units();
if (code_seen('C')) delta_diagonal_rod_trim_tower_3 = code_value_linear_units();
if (code_seen('I')) delta_tower_angle_trim_1 = code_value_linear_units();
if (code_seen('J')) delta_tower_angle_trim_2 = code_value_linear_units();
if (code_seen('K')) delta_tower_angle_trim_3 = code_value_linear_units();
recalc_delta_settings(delta_radius, delta_diagonal_rod);
}
/**
@ -9140,12 +9146,12 @@ void ok_to_send() {
* settings have been changed (e.g., by M665).
*/
void recalc_delta_settings(float radius, float diagonal_rod) {
delta_tower1_x = -SIN_60 * (radius + DELTA_RADIUS_TRIM_TOWER_1); // front left tower
delta_tower1_y = -COS_60 * (radius + DELTA_RADIUS_TRIM_TOWER_1);
delta_tower2_x = SIN_60 * (radius + DELTA_RADIUS_TRIM_TOWER_2); // front right tower
delta_tower2_y = -COS_60 * (radius + DELTA_RADIUS_TRIM_TOWER_2);
delta_tower3_x = 0.0; // back middle tower
delta_tower3_y = (radius + DELTA_RADIUS_TRIM_TOWER_3);
delta_tower1_x = -sin( (60 - delta_tower_angle_trim_1) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1), // front left tower
delta_tower1_y = -cos( (60 - delta_tower_angle_trim_1) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1),
delta_tower2_x = sin( (60 + delta_tower_angle_trim_2) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2), // front right tower
delta_tower2_y = -cos( (60 + delta_tower_angle_trim_2) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_2),
delta_tower3_x = -sin( ( delta_tower_angle_trim_3) * PI/180), // back middle tower
delta_tower3_y = cos( ( delta_tower_angle_trim_3) * PI/180) * (delta_radius + DELTA_RADIUS_TRIM_TOWER_3),
delta_diagonal_rod_2_tower_1 = sq(diagonal_rod + delta_diagonal_rod_trim_tower_1);
delta_diagonal_rod_2_tower_2 = sq(diagonal_rod + delta_diagonal_rod_trim_tower_2);
delta_diagonal_rod_2_tower_3 = sq(diagonal_rod + delta_diagonal_rod_trim_tower_3);

View File

@ -84,7 +84,7 @@
* 308 G29 L F bilinear_start (int x2)
* 312 bed_level_grid[][] (float x9, up to float x256) +988
*
* DELTA (if deltabot): 36 bytes
* DELTA (if deltabot): 48 bytes
* 348 M666 XYZ endstop_adj (float x3)
* 360 M665 R delta_radius (float)
* 364 M665 L delta_diagonal_rod (float)
@ -92,6 +92,9 @@
* 372 M665 A delta_diagonal_rod_trim_tower_1 (float)
* 376 M665 B delta_diagonal_rod_trim_tower_2 (float)
* 380 M665 C delta_diagonal_rod_trim_tower_3 (float)
* 384 M665 I delta_tower_angle_trim_1 (float)
* 388 M665 J delta_tower_angle_trim_2 (float)
* 392 M665 K delta_tower_angle_trim_3 (float)
*
* Z_DUAL_ENDSTOPS: 4 bytes
* 384 M666 Z z_endstop_adj (float)
@ -356,6 +359,9 @@ void Config_Postprocess() {
EEPROM_WRITE(delta_diagonal_rod_trim_tower_1); // 1 float
EEPROM_WRITE(delta_diagonal_rod_trim_tower_2); // 1 float
EEPROM_WRITE(delta_diagonal_rod_trim_tower_3); // 1 float
EEPROM_WRITE(delta_tower_angle_trim_1); // 1 float
EEPROM_WRITE(delta_tower_angle_trim_2); // 1 float
EEPROM_WRITE(delta_tower_angle_trim_3); // 1 float
#elif ENABLED(Z_DUAL_ENDSTOPS)
EEPROM_WRITE(z_endstop_adj); // 1 float
dummy = 0.0f;
@ -681,6 +687,9 @@ void Config_Postprocess() {
EEPROM_READ(delta_diagonal_rod_trim_tower_1); // 1 float
EEPROM_READ(delta_diagonal_rod_trim_tower_2); // 1 float
EEPROM_READ(delta_diagonal_rod_trim_tower_3); // 1 float
EEPROM_READ(delta_tower_angle_trim_1); // 1 float
EEPROM_READ(delta_tower_angle_trim_2); // 1 float
EEPROM_READ(delta_tower_angle_trim_3); // 1 float
#elif ENABLED(Z_DUAL_ENDSTOPS)
EEPROM_READ(z_endstop_adj);
dummy = 0.0f;
@ -909,6 +918,9 @@ void Config_ResetDefault() {
delta_diagonal_rod_trim_tower_1 = DELTA_DIAGONAL_ROD_TRIM_TOWER_1;
delta_diagonal_rod_trim_tower_2 = DELTA_DIAGONAL_ROD_TRIM_TOWER_2;
delta_diagonal_rod_trim_tower_3 = DELTA_DIAGONAL_ROD_TRIM_TOWER_3;
delta_tower_angle_trim_1 = DELTA_TOWER_ANGLE_TRIM_1;
delta_tower_angle_trim_2 = DELTA_TOWER_ANGLE_TRIM_2;
delta_tower_angle_trim_3 = DELTA_TOWER_ANGLE_TRIM_3;
#elif ENABLED(Z_DUAL_ENDSTOPS)
z_endstop_adj = 0;
#endif
@ -1179,7 +1191,7 @@ void Config_ResetDefault() {
SERIAL_EOL;
CONFIG_ECHO_START;
if (!forReplay) {
SERIAL_ECHOLNPGM("Delta settings: L=diagonal_rod, R=radius, S=segments_per_second, ABC=diagonal_rod_trim_tower_[123]");
SERIAL_ECHOLNPGM("Delta settings: L=diagonal_rod, R=radius, S=segments_per_second, ABC=diagonal_rod_trim_tower_[123], IJK=tower_angle_trim[123]");
CONFIG_ECHO_START;
}
SERIAL_ECHOPAIR(" M665 L", delta_diagonal_rod);
@ -1188,6 +1200,9 @@ void Config_ResetDefault() {
SERIAL_ECHOPAIR(" A", delta_diagonal_rod_trim_tower_1);
SERIAL_ECHOPAIR(" B", delta_diagonal_rod_trim_tower_2);
SERIAL_ECHOPAIR(" C", delta_diagonal_rod_trim_tower_3);
SERIAL_ECHOPAIR(" I", delta_tower_angle_trim_1);
SERIAL_ECHOPAIR(" J", delta_tower_angle_trim_2);
SERIAL_ECHOPAIR(" K", delta_tower_angle_trim_3);
SERIAL_EOL;
#elif ENABLED(Z_DUAL_ENDSTOPS)
CONFIG_ECHO_START;