1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 13:56:24 +00:00

Merge pull request #8072 from thinkyhead/bf2_fix_M600

[2.0.x] Fix position sync in M600 pause/resume
This commit is contained in:
Scott Lahteine 2017-10-24 14:55:46 -05:00 committed by GitHub
commit 3356d5a72d
2 changed files with 21 additions and 32 deletions

View File

@ -93,16 +93,21 @@ static void ensure_safe_temperature() {
}
}
void do_pause_e_move(const float &length, const float fr) {
current_position[E_AXIS] += length;
set_destination_from_current();
#if IS_KINEMATIC
planner.buffer_line_kinematic(destination, fr, active_extruder);
#else
line_to_destination(fr);
#endif
stepper.synchronize();
}
// public:
bool move_away_flag = false;
#if IS_KINEMATIC
#define RUNPLAN(RATE_MM_S) planner.buffer_line_kinematic(destination, RATE_MM_S, active_extruder)
#else
#define RUNPLAN(RATE_MM_S) line_to_destination(RATE_MM_S)
#endif
bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos,
const float &unload_length/*=0*/ , const int8_t max_beep_count/*=0*/, const bool show_lcd/*=false*/
) {
@ -140,17 +145,11 @@ bool pause_print(const float &retract, const float &z_lift, const float &x_pos,
#endif
}
// Save current position
stepper.synchronize();
COPY(resume_position, current_position);
COPY(resume_position, current_position); // Save current position for later
if (retract) {
// Initial retract before move to filament change position
set_destination_from_current();
destination[E_AXIS] += retract;
RUNPLAN(PAUSE_PARK_RETRACT_FEEDRATE);
stepper.synchronize();
}
// Initial retract before move to filament change position
if (retract) do_pause_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE);
// Lift Z axis
if (z_lift > 0)
@ -168,10 +167,7 @@ bool pause_print(const float &retract, const float &z_lift, const float &x_pos,
}
// Unload filament
set_destination_from_current();
destination[E_AXIS] += unload_length;
RUNPLAN(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
stepper.synchronize();
do_pause_e_move(unload_length, FILAMENT_CHANGE_UNLOAD_FEEDRATE);
}
if (show_lcd) {
@ -272,8 +268,6 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l
filament_change_beep(max_beep_count, true);
#endif
set_destination_from_current();
if (load_length != 0) {
#if ENABLED(ULTIPANEL)
// Show "insert filament"
@ -297,9 +291,7 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l
#endif
// Load filament
destination[E_AXIS] += load_length;
RUNPLAN(FILAMENT_CHANGE_LOAD_FEEDRATE);
stepper.synchronize();
do_pause_e_move(load_length, FILAMENT_CHANGE_LOAD_FEEDRATE);
}
#if ENABLED(ULTIPANEL) && ADVANCED_PAUSE_EXTRUDE_LENGTH > 0
@ -312,9 +304,7 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_EXTRUDE);
// Extrude filament to get into hotend
destination[E_AXIS] += extrude_length;
RUNPLAN(ADVANCED_PAUSE_EXTRUDE_FEEDRATE);
stepper.synchronize();
do_pause_e_move(extrude_length, ADVANCED_PAUSE_EXTRUDE_FEEDRATE);
}
// Show "Extrude More" / "Resume" menu and wait for reply
@ -337,8 +327,7 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l
#endif
// Set extruder to saved position
destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS];
planner.set_e_position_mm(current_position[E_AXIS]);
planner.set_e_position_mm((current_position[E_AXIS] = resume_position[E_AXIS]));
// Move XY to starting position, then Z
do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], PAUSE_PARK_XY_FEEDRATE);
@ -349,7 +338,7 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l
#endif
#if ENABLED(ULTIPANEL)
// Show status screen
// Show pause status screen
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
#endif

View File

@ -713,10 +713,10 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(8, 0);
#if HOTENDS > 1
lcd.print((CHAR)LCD_STR_THERMOMETER[0]);
lcd.print((char)LCD_STR_THERMOMETER[0]);
_draw_heater_status(1, -1, blink);
#else
lcd.print((CHAR)LCD_BEDTEMP_CHAR);
lcd.print((char)LCD_BEDTEMP_CHAR);
_draw_heater_status(-1, -1, blink);
#endif