Add quickstop_stepper to update current position with stepper.quick_stop()
This commit is contained in:
		@@ -230,9 +230,7 @@ void ok_to_send();
 | 
				
			|||||||
void reset_bed_level();
 | 
					void reset_bed_level();
 | 
				
			||||||
void kill(const char*);
 | 
					void kill(const char*);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if DISABLED(DELTA) && DISABLED(SCARA)
 | 
					void quickstop_stepper();
 | 
				
			||||||
  void set_current_position_from_planner();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
 | 
					#if ENABLED(FILAMENT_RUNOUT_SENSOR)
 | 
				
			||||||
  void handle_filament_runout();
 | 
					  void handle_filament_runout();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -450,7 +450,8 @@ MarlinSerial customizedSerial;
 | 
				
			|||||||
      case state_M41:
 | 
					      case state_M41:
 | 
				
			||||||
        switch (c) {
 | 
					        switch (c) {
 | 
				
			||||||
          case '0':
 | 
					          case '0':
 | 
				
			||||||
            { state = state_RESET; stepper.quick_stop(); }
 | 
					            state = state_RESET;
 | 
				
			||||||
 | 
					            quickstop_stepper();
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
          case ';':
 | 
					          case ';':
 | 
				
			||||||
            state = state_IGNORE;
 | 
					            state = state_IGNORE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1109,7 +1109,7 @@ inline void get_serial_commands() {
 | 
				
			|||||||
        // If command was e-stop process now
 | 
					        // If command was e-stop process now
 | 
				
			||||||
        if (strcmp(command, "M108") == 0) wait_for_heatup = false;
 | 
					        if (strcmp(command, "M108") == 0) wait_for_heatup = false;
 | 
				
			||||||
        if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED));
 | 
					        if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED));
 | 
				
			||||||
        if (strcmp(command, "M410") == 0) stepper.quick_stop();
 | 
					        if (strcmp(command, "M410") == 0) { quickstop_stepper(); }
 | 
				
			||||||
      #endif
 | 
					      #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      #if defined(NO_TIMEOUTS) && NO_TIMEOUTS > 0
 | 
					      #if defined(NO_TIMEOUTS) && NO_TIMEOUTS > 0
 | 
				
			||||||
@@ -4556,12 +4556,7 @@ inline void gcode_M105() {
 | 
				
			|||||||
   * This will stop the carriages mid-move, so most likely they
 | 
					   * This will stop the carriages mid-move, so most likely they
 | 
				
			||||||
   * will be out of sync with the stepper position after this.
 | 
					   * will be out of sync with the stepper position after this.
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  inline void gcode_M410() {
 | 
					  inline void gcode_M410() { quickstop_stepper(); }
 | 
				
			||||||
    stepper.quick_stop();
 | 
					 | 
				
			||||||
    #if DISABLED(DELTA) && DISABLED(SCARA)
 | 
					 | 
				
			||||||
      set_current_position_from_planner();
 | 
					 | 
				
			||||||
    #endif
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -5990,8 +5985,9 @@ inline void gcode_M400() { stepper.synchronize(); }
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#endif // FILAMENT_WIDTH_SENSOR
 | 
					#endif // FILAMENT_WIDTH_SENSOR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if DISABLED(DELTA) && DISABLED(SCARA)
 | 
					void quickstop_stepper() {
 | 
				
			||||||
  void set_current_position_from_planner() {
 | 
					  stepper.quick_stop();
 | 
				
			||||||
 | 
					  #if DISABLED(DELTA) && DISABLED(SCARA)
 | 
				
			||||||
    stepper.synchronize();
 | 
					    stepper.synchronize();
 | 
				
			||||||
    #if ENABLED(AUTO_BED_LEVELING_FEATURE)
 | 
					    #if ENABLED(AUTO_BED_LEVELING_FEATURE)
 | 
				
			||||||
      vector_3 pos = planner.adjusted_position(); // values directly from steppers...
 | 
					      vector_3 pos = planner.adjusted_position(); // values directly from steppers...
 | 
				
			||||||
@@ -6004,8 +6000,8 @@ inline void gcode_M400() { stepper.synchronize(); }
 | 
				
			|||||||
      current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
 | 
					      current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
 | 
				
			||||||
    #endif
 | 
					    #endif
 | 
				
			||||||
    sync_plan_position();                       // ...re-apply to planner position
 | 
					    sync_plan_position();                       // ...re-apply to planner position
 | 
				
			||||||
  }
 | 
					  #endif
 | 
				
			||||||
#endif
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if ENABLED(MESH_BED_LEVELING)
 | 
					#if ENABLED(MESH_BED_LEVELING)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -186,10 +186,7 @@ void Endstops::report_state() {
 | 
				
			|||||||
      if (stepper.abort_on_endstop_hit) {
 | 
					      if (stepper.abort_on_endstop_hit) {
 | 
				
			||||||
        card.sdprinting = false;
 | 
					        card.sdprinting = false;
 | 
				
			||||||
        card.closefile();
 | 
					        card.closefile();
 | 
				
			||||||
        stepper.quick_stop();
 | 
					        quickstop_stepper();
 | 
				
			||||||
        #if DISABLED(DELTA) && DISABLED(SCARA)
 | 
					 | 
				
			||||||
          set_current_position_from_planner();
 | 
					 | 
				
			||||||
        #endif
 | 
					 | 
				
			||||||
        thermalManager.disable_all_heaters(); // switch off all heaters.
 | 
					        thermalManager.disable_all_heaters(); // switch off all heaters.
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    #endif
 | 
					    #endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -556,14 +556,11 @@ static void lcd_status_screen() {
 | 
				
			|||||||
    static void lcd_sdcard_stop() {
 | 
					    static void lcd_sdcard_stop() {
 | 
				
			||||||
      card.stopSDPrint();
 | 
					      card.stopSDPrint();
 | 
				
			||||||
      clear_command_queue();
 | 
					      clear_command_queue();
 | 
				
			||||||
      stepper.quick_stop();
 | 
					      quickstop_stepper();
 | 
				
			||||||
      print_job_timer.stop();
 | 
					      print_job_timer.stop();
 | 
				
			||||||
      thermalManager.autotempShutdown();
 | 
					      thermalManager.autotempShutdown();
 | 
				
			||||||
      wait_for_heatup = false;
 | 
					      wait_for_heatup = false;
 | 
				
			||||||
      lcd_setstatus(MSG_PRINT_ABORTED, true);
 | 
					      lcd_setstatus(MSG_PRINT_ABORTED, true);
 | 
				
			||||||
      #if DISABLED(DELTA) && DISABLED(SCARA)
 | 
					 | 
				
			||||||
        set_current_position_from_planner();
 | 
					 | 
				
			||||||
      #endif // !DELTA && !SCARA
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #endif //SDSUPPORT
 | 
					  #endif //SDSUPPORT
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user