Browse Source

set_current_position_from_planner() after stepper.quick_stop()

Scott Lahteine 9 years ago
parent
commit
6277395e1e
4 changed files with 22 additions and 1 deletions
  1. 1
    0
      Marlin/Marlin.h
  2. 19
    1
      Marlin/Marlin_main.cpp
  3. 1
    0
      Marlin/endstops.cpp
  4. 1
    0
      Marlin/ultralcd.cpp

+ 1
- 0
Marlin/Marlin.h View File

225
 
225
 
226
 void reset_bed_level();
226
 void reset_bed_level();
227
 void prepare_move();
227
 void prepare_move();
228
+void set_current_position_from_planner();
228
 void kill(const char*);
229
 void kill(const char*);
229
 
230
 
230
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
231
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)

+ 19
- 1
Marlin/Marlin_main.cpp View File

5889
 
5889
 
5890
 #endif // FILAMENT_WIDTH_SENSOR
5890
 #endif // FILAMENT_WIDTH_SENSOR
5891
 
5891
 
5892
+void set_current_position_from_planner() {
5893
+  stepper.synchronize();
5894
+  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
5895
+    vector_3 pos = planner.adjusted_position(); // values directly from steppers...
5896
+    current_position[X_AXIS] = pos.x;
5897
+    current_position[Y_AXIS] = pos.y;
5898
+    current_position[Z_AXIS] = pos.z;
5899
+  #else
5900
+    current_position[X_AXIS] = stepper.get_axis_position_mm(X_AXIS);
5901
+    current_position[Y_AXIS] = stepper.get_axis_position_mm(Y_AXIS);
5902
+    current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
5903
+  #endif
5904
+  sync_plan_position();                       // ...re-apply to planner position
5905
+}
5906
+
5892
 /**
5907
 /**
5893
  * M410: Quickstop - Abort all planned moves
5908
  * M410: Quickstop - Abort all planned moves
5894
  *
5909
  *
5895
  * This will stop the carriages mid-move, so most likely they
5910
  * This will stop the carriages mid-move, so most likely they
5896
  * will be out of sync with the stepper position after this.
5911
  * will be out of sync with the stepper position after this.
5897
  */
5912
  */
5898
-inline void gcode_M410() { stepper.quick_stop(); }
5913
+inline void gcode_M410() {
5914
+  stepper.quick_stop();
5915
+  set_current_position_from_planner();
5916
+}
5899
 
5917
 
5900
 
5918
 
5901
 #if ENABLED(MESH_BED_LEVELING)
5919
 #if ENABLED(MESH_BED_LEVELING)

+ 1
- 0
Marlin/endstops.cpp View File

187
         card.sdprinting = false;
187
         card.sdprinting = false;
188
         card.closefile();
188
         card.closefile();
189
         stepper.quick_stop();
189
         stepper.quick_stop();
190
+        set_current_position_from_planner();
190
         thermalManager.disable_all_heaters(); // switch off all heaters.
191
         thermalManager.disable_all_heaters(); // switch off all heaters.
191
       }
192
       }
192
     #endif
193
     #endif

+ 1
- 0
Marlin/ultralcd.cpp View File

482
 
482
 
483
   static void lcd_sdcard_stop() {
483
   static void lcd_sdcard_stop() {
484
     stepper.quick_stop();
484
     stepper.quick_stop();
485
+    set_current_position_from_planner();
485
     card.sdprinting = false;
486
     card.sdprinting = false;
486
     card.closefile();
487
     card.closefile();
487
     print_job_timer.stop();
488
     print_job_timer.stop();

Loading…
Cancel
Save