set_current_position_from_planner() after stepper.quick_stop()
This commit is contained in:
		@@ -225,6 +225,7 @@ void ok_to_send();
 | 
			
		||||
 | 
			
		||||
void reset_bed_level();
 | 
			
		||||
void prepare_move();
 | 
			
		||||
void set_current_position_from_planner();
 | 
			
		||||
void kill(const char*);
 | 
			
		||||
 | 
			
		||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
 | 
			
		||||
 
 | 
			
		||||
@@ -5889,13 +5889,31 @@ 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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * M410: Quickstop - Abort all planned moves
 | 
			
		||||
 *
 | 
			
		||||
 * This will stop the carriages mid-move, so most likely they
 | 
			
		||||
 * will be out of sync with the stepper position after this.
 | 
			
		||||
 */
 | 
			
		||||
inline void gcode_M410() { stepper.quick_stop(); }
 | 
			
		||||
inline void gcode_M410() {
 | 
			
		||||
  stepper.quick_stop();
 | 
			
		||||
  set_current_position_from_planner();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if ENABLED(MESH_BED_LEVELING)
 | 
			
		||||
 
 | 
			
		||||
@@ -187,6 +187,7 @@ void Endstops::report_state() {
 | 
			
		||||
        card.sdprinting = false;
 | 
			
		||||
        card.closefile();
 | 
			
		||||
        stepper.quick_stop();
 | 
			
		||||
        set_current_position_from_planner();
 | 
			
		||||
        thermalManager.disable_all_heaters(); // switch off all heaters.
 | 
			
		||||
      }
 | 
			
		||||
    #endif
 | 
			
		||||
 
 | 
			
		||||
@@ -482,6 +482,7 @@ inline void line_to_current(AxisEnum axis) {
 | 
			
		||||
 | 
			
		||||
  static void lcd_sdcard_stop() {
 | 
			
		||||
    stepper.quick_stop();
 | 
			
		||||
    set_current_position_from_planner();
 | 
			
		||||
    card.sdprinting = false;
 | 
			
		||||
    card.closefile();
 | 
			
		||||
    print_job_timer.stop();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user