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 diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 94e5b8a134..9579d3daa7 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -390,9 +390,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 ac4019322a..9d4e1e0c65 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1673,7 +1673,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) @@ -1765,13 +1765,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); } 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(); }