From 664b299a51cd3e544c9d557d1f057bdcfc74a7e0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 2 Jun 2016 17:11:54 -0700 Subject: [PATCH] This fix is not DELTA compatible --- Marlin/Marlin.h | 5 ++++- Marlin/Marlin_main.cpp | 34 +++++++++++++++++++--------------- Marlin/endstops.cpp | 4 +++- Marlin/ultralcd.cpp | 4 +++- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 837f1b5d8..ab85ab592 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -225,9 +225,12 @@ void ok_to_send(); void reset_bed_level(); void prepare_move(); -void set_current_position_from_planner(); void kill(const char*); +#if DISABLED(DELTA) && DISABLED(SCARA) + void set_current_position_from_planner(); +#endif + #if ENABLED(FILAMENT_RUNOUT_SENSOR) void handle_filament_runout(); #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1e98877be..1feb42d7a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5894,20 +5894,22 @@ inline void gcode_M400() { stepper.synchronize(); } #endif // FILAMENT_WIDTH_SENSOR -void set_current_position_from_planner() { - stepper.synchronize(); - #if ENABLED(AUTO_BED_LEVELING_FEATURE) - vector_3 pos = planner.adjusted_position(); // values directly from steppers... - current_position[X_AXIS] = pos.x; - current_position[Y_AXIS] = pos.y; - current_position[Z_AXIS] = pos.z; - #else - current_position[X_AXIS] = stepper.get_axis_position_mm(X_AXIS); - current_position[Y_AXIS] = stepper.get_axis_position_mm(Y_AXIS); - current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS); - #endif - sync_plan_position(); // ...re-apply to planner position -} +#if DISABLED(DELTA) && DISABLED(SCARA) + void set_current_position_from_planner() { + stepper.synchronize(); + #if ENABLED(AUTO_BED_LEVELING_FEATURE) + vector_3 pos = planner.adjusted_position(); // values directly from steppers... + current_position[X_AXIS] = pos.x; + current_position[Y_AXIS] = pos.y; + current_position[Z_AXIS] = pos.z; + #else + current_position[X_AXIS] = stepper.get_axis_position_mm(X_AXIS); + current_position[Y_AXIS] = stepper.get_axis_position_mm(Y_AXIS); + current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS); + #endif + sync_plan_position(); // ...re-apply to planner position + } +#endif /** * M410: Quickstop - Abort all planned moves @@ -5917,7 +5919,9 @@ void set_current_position_from_planner() { */ inline void gcode_M410() { stepper.quick_stop(); - set_current_position_from_planner(); + #if DISABLED(DELTA) && DISABLED(SCARA) + set_current_position_from_planner(); + #endif } diff --git a/Marlin/endstops.cpp b/Marlin/endstops.cpp index 91f6d3199..945b61577 100644 --- a/Marlin/endstops.cpp +++ b/Marlin/endstops.cpp @@ -187,7 +187,9 @@ void Endstops::report_state() { card.sdprinting = false; card.closefile(); stepper.quick_stop(); - set_current_position_from_planner(); + #if DISABLED(DELTA) && DISABLED(SCARA) + set_current_position_from_planner(); + #endif thermalManager.disable_all_heaters(); // switch off all heaters. } #endif diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index c1526e4a4..1a0071d1b 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -482,7 +482,9 @@ inline void line_to_current(AxisEnum axis) { static void lcd_sdcard_stop() { stepper.quick_stop(); - set_current_position_from_planner(); + #if DISABLED(DELTA) && DISABLED(SCARA) + set_current_position_from_planner(); + #endif clear_command_queue(); card.sdprinting = false; card.closefile();