Add quickstop_stepper to update current position with stepper.quick_stop()

This commit is contained in:
Scott Lahteine 2016-07-06 12:00:28 -07:00
parent ecffe92e20
commit 834ad14c8d
5 changed files with 12 additions and 23 deletions

View file

@ -230,9 +230,7 @@ void ok_to_send();
void reset_bed_level();
void kill(const char*);
#if DISABLED(DELTA) && DISABLED(SCARA)
void set_current_position_from_planner();
#endif
void quickstop_stepper();
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
void handle_filament_runout();

View file

@ -450,7 +450,8 @@ MarlinSerial customizedSerial;
case state_M41:
switch (c) {
case '0':
{ state = state_RESET; stepper.quick_stop(); }
state = state_RESET;
quickstop_stepper();
break;
case ';':
state = state_IGNORE;

View file

@ -1109,7 +1109,7 @@ inline void get_serial_commands() {
// If command was e-stop process now
if (strcmp(command, "M108") == 0) wait_for_heatup = false;
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
#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
* will be out of sync with the stepper position after this.
*/
inline void gcode_M410() {
stepper.quick_stop();
#if DISABLED(DELTA) && DISABLED(SCARA)
set_current_position_from_planner();
#endif
}
inline void gcode_M410() { quickstop_stepper(); }
#endif
@ -5990,8 +5985,9 @@ inline void gcode_M400() { stepper.synchronize(); }
#endif // FILAMENT_WIDTH_SENSOR
#if DISABLED(DELTA) && DISABLED(SCARA)
void set_current_position_from_planner() {
void quickstop_stepper() {
stepper.quick_stop();
#if DISABLED(DELTA) && DISABLED(SCARA)
stepper.synchronize();
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
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);
#endif
sync_plan_position(); // ...re-apply to planner position
}
#endif
#endif
}
#if ENABLED(MESH_BED_LEVELING)

View file

@ -186,10 +186,7 @@ void Endstops::report_state() {
if (stepper.abort_on_endstop_hit) {
card.sdprinting = false;
card.closefile();
stepper.quick_stop();
#if DISABLED(DELTA) && DISABLED(SCARA)
set_current_position_from_planner();
#endif
quickstop_stepper();
thermalManager.disable_all_heaters(); // switch off all heaters.
}
#endif

View file

@ -556,14 +556,11 @@ static void lcd_status_screen() {
static void lcd_sdcard_stop() {
card.stopSDPrint();
clear_command_queue();
stepper.quick_stop();
quickstop_stepper();
print_job_timer.stop();
thermalManager.autotempShutdown();
wait_for_heatup = false;
lcd_setstatus(MSG_PRINT_ABORTED, true);
#if DISABLED(DELTA) && DISABLED(SCARA)
set_current_position_from_planner();
#endif // !DELTA && !SCARA
}
#endif //SDSUPPORT