From 7a6a1ef5835f3dfcb331c8ffb261c4f0870c1b48 Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Thu, 27 Apr 2017 23:24:08 +0200 Subject: [PATCH] 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() {