From f840c7de4dadb622e82b2f67f2aba42648fd71c5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 11 Apr 2016 18:25:39 -0700 Subject: [PATCH] Initialize stepper counts for Delta/SCARA --- Marlin/Marlin_main.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index d0cdf0a49..98b20f765 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -485,6 +485,16 @@ void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); void gcode_M114(); +#if ENABLED(DELTA) || ENABLED(SCARA) + inline void sync_plan_position_delta() { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position); + #endif + calculate_delta(current_position); + plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); + } +#endif + #if ENABLED(PREVENT_DANGEROUS_EXTRUDE) float extrude_min_temp = EXTRUDE_MINTEMP; #endif @@ -705,6 +715,11 @@ void servo_init() { */ void setup() { + #if ENABLED(DELTA) || ENABLED(SCARA) + // Vital to init kinematic equivalent for X0 Y0 Z0 + sync_plan_position_delta(); + #endif + #ifdef DISABLE_JTAG // Disable JTAG on AT90USB chips to free up pins for IO MCUCR = 0x80; @@ -1306,15 +1321,6 @@ inline void sync_plan_position() { #endif plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); } -#if ENABLED(DELTA) || ENABLED(SCARA) - inline void sync_plan_position_delta() { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position); - #endif - calculate_delta(current_position); - plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); - } -#endif inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); } inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }