Merge pull request #2368 from wavexx/unretract_after_lcd_pause

Unretract when resuming a paused print
This commit is contained in:
DRracer 2020-01-15 12:47:24 +01:00 committed by GitHub
commit 43870c4028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 22 deletions

View File

@ -308,6 +308,7 @@ extern float max_pos[3];
extern bool axis_known_position[3];
extern int fanSpeed;
extern int8_t lcd_change_fil_state;
extern float default_retraction;
#ifdef TMC2130
void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0);

View File

@ -9568,10 +9568,6 @@ void long_pause() //long pause print
// Stop heaters
setAllTargetHotends(0);
//retract
current_position[E_AXIS] -= default_retraction;
plan_buffer_line_curposXYZE(400, active_extruder);
//lift z
current_position[Z_AXIS] += Z_PAUSE_LIFT;
if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
@ -10246,23 +10242,29 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
// move away from the print.
char buf[48];
// First unretract (relative extrusion)
if(!saved_extruder_relative_mode){
enquecommand(PSTR("M83"), true);
}
//retract 45mm/s
// A single sprintf may not be faster, but is definitely 20B shorter
// than a sequence of commands building the string piece by piece
// A snprintf would have been a safer call, but since it is not used
// in the whole program, its implementation would bring more bytes to the total size
// The behavior of dtostrf 8,3 should be roughly the same as %-0.3
sprintf_P(buf, PSTR("G1 E%-0.3f F2700"), e_move);
enquecommand(buf, false);
if(e_move)
{
// First unretract (relative extrusion)
if(!saved_extruder_relative_mode){
enquecommand(PSTR("M83"), true);
}
//retract 45mm/s
// A single sprintf may not be faster, but is definitely 20B shorter
// than a sequence of commands building the string piece by piece
// A snprintf would have been a safer call, but since it is not used
// in the whole program, its implementation would bring more bytes to the total size
// The behavior of dtostrf 8,3 should be roughly the same as %-0.3
sprintf_P(buf, PSTR("G1 E%-0.3f F2700"), e_move);
enquecommand(buf, false);
}
if(z_move)
{
// Then lift Z axis
sprintf_P(buf, PSTR("G1 Z%-0.3f F%-0.3f"), saved_pos[Z_AXIS] + z_move, homing_feedrate[Z_AXIS]);
enquecommand(buf, false);
}
// Then lift Z axis
sprintf_P(buf, PSTR("G1 Z%-0.3f F%-0.3f"), saved_pos[Z_AXIS] + z_move, homing_feedrate[Z_AXIS]);
// At this point the command queue is empty.
enquecommand(buf, false);
// If this call is invoked from the main Arduino loop() function, let the caller know that the command
// in the command queue is not the original command, but a new one, so it should not be removed from the queue.
repeatcommand_front();

View File

@ -1574,7 +1574,7 @@ void lcd_return_to_status()
//! @brief Pause print, disable nozzle heater, move to park position
void lcd_pause_print()
{
stop_and_save_print_to_ram(0.0,0.0);
stop_and_save_print_to_ram(0.0, -default_retraction);
lcd_return_to_status();
isPrintPaused = true;
if (LcdCommands::Idle == lcd_commands_type)
@ -6685,7 +6685,7 @@ void lcd_resume_print()
if (fan_error_selftest()) return; //abort if error persists
isPrintPaused = false;
restore_print_from_ram_and_continue(0.0);
restore_print_from_ram_and_continue(default_retraction);
pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation
refresh_cmd_timeout();
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint