From a36a168af2bcceccd9b6b17d07ad7196688b81f9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 9 Aug 2016 23:09:12 -0700 Subject: [PATCH 1/3] Use the truly configured middle on Delta --- Marlin/Conditionals_post.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 2945ee16ad..de2e6e2af9 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -79,7 +79,7 @@ #endif #else #if ENABLED(DELTA) - #define X_HOME_POS ((X_MAX_LENGTH) * 0.5) + #define X_HOME_POS (X_MIN_POS + (X_MAX_LENGTH) * 0.5) #else #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS) #endif @@ -95,7 +95,7 @@ #endif #else #if ENABLED(DELTA) - #define Y_HOME_POS ((Y_MAX_LENGTH) * 0.5) + #define Y_HOME_POS (Y_MIN_POS + (Y_MAX_LENGTH) * 0.5) #else #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS) #endif From cd496dd9bdb6c738feebc0cb2dcfaafec2c85f8d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 10 Aug 2016 00:03:04 -0700 Subject: [PATCH 2/3] do_blocking_move_to can't be 'inline', takes const ref args --- Marlin/Marlin.h | 8 ++++---- Marlin/Marlin_main.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index c9242e7838..bf9f373ba8 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -389,9 +389,9 @@ void calculate_volumetric_multipliers(); /** * Blocking movement and shorthand functions */ -inline void do_blocking_move_to(float x, float y, float z, float fr_mm_s=0.0); -inline void do_blocking_move_to_x(float x, float fr_mm_s=0.0); -inline void do_blocking_move_to_z(float z, float fr_mm_s=0.0); -inline void do_blocking_move_to_xy(float x, float y, float fr_mm_s=0.0); +void do_blocking_move_to(const float &x, const float &y, const float &z, const float &fr_mm_s=0.0); +void do_blocking_move_to_x(const float &x, const float &fr_mm_s=0.0); +void do_blocking_move_to_z(const float &z, const float &fr_mm_s=0.0); +void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s=0.0); #endif //MARLIN_H diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 995f6d803b..6230200926 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1661,7 +1661,7 @@ inline void set_destination_to_current() { memcpy(destination, current_position, * Plan a move to (X, Y, Z) and set the current_position * The final current_position may not be the one that was requested */ -void do_blocking_move_to(float x, float y, float z, float fr_mm_s /*=0.0*/) { +void do_blocking_move_to(const float &x, const float &y, const float &z, const float &fr_mm_s /*=0.0*/) { float old_feedrate_mm_s = feedrate_mm_s; #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -1753,13 +1753,13 @@ void do_blocking_move_to(float x, float y, float z, float fr_mm_s /*=0.0*/) { feedrate_mm_s = old_feedrate_mm_s; } -void do_blocking_move_to_x(float x, float fr_mm_s/*=0.0*/) { +void do_blocking_move_to_x(const float &x, const float &fr_mm_s/*=0.0*/) { do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s); } -void do_blocking_move_to_z(float z, float fr_mm_s/*=0.0*/) { +void do_blocking_move_to_z(const float &z, const float &fr_mm_s/*=0.0*/) { do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, fr_mm_s); } -void do_blocking_move_to_xy(float x, float y, float fr_mm_s/*=0.0*/) { +void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s/*=0.0*/) { do_blocking_move_to(x, y, current_position[Z_AXIS], fr_mm_s); } From 432e9a1f5017cead7d52ae0eb8e8bd51a912b78f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 9 Aug 2016 23:24:51 -0700 Subject: [PATCH 3/3] Use configured feedrates, center for DELTA_CALIBRATION_MENU --- Marlin/ultralcd.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 4eaab20729..77935e961e 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1261,15 +1261,17 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(DELTA_CALIBRATION_MENU) static void _goto_tower_pos(const float &a) { - char cmd[26]; - sprintf_P(cmd, PSTR("G1 F4000 X%i Y%i"), int(-(DELTA_PRINTABLE_RADIUS) * sin(a)), int((DELTA_PRINTABLE_RADIUS) * cos(a))); - enqueue_and_echo_commands_P(PSTR("G1 F8000 Z4")); - enqueue_and_echo_command(cmd); + do_blocking_move_to( + a < 0 ? X_HOME_POS : sin(a) * -(DELTA_PRINTABLE_RADIUS), + a < 0 ? Y_HOME_POS : cos(a) * (DELTA_PRINTABLE_RADIUS), + 4 + ); } static void _goto_tower_x() { _goto_tower_pos(RADIANS(120)); } static void _goto_tower_y() { _goto_tower_pos(RADIANS(240)); } static void _goto_tower_z() { _goto_tower_pos(0); } + static void _goto_center() { _goto_tower_pos(-1); } static void lcd_delta_calibrate_menu() { START_MENU(); @@ -1278,7 +1280,7 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM(function, MSG_DELTA_CALIBRATE_X, _goto_tower_x); MENU_ITEM(function, MSG_DELTA_CALIBRATE_Y, _goto_tower_y); MENU_ITEM(function, MSG_DELTA_CALIBRATE_Z, _goto_tower_z); - MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G1 F8000 Z4\nG1 F4000 X0 Y0")); + MENU_ITEM(function, MSG_DELTA_CALIBRATE_CENTER, _goto_center); END_MENU(); }