Merge pull request #2382 from wavexx/fix_lcd_stop

Fix lcd "Stop" when used within a pause
This commit is contained in:
DRracer 2020-01-08 14:40:54 +01:00 committed by GitHub
commit 2f2e415eae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 20 deletions

View File

@ -455,6 +455,7 @@ extern void print_mesh_bed_leveling_table();
extern void stop_and_save_print_to_ram(float z_move, float e_move);
extern void restore_print_from_ram_and_continue(float e_move);
extern void cancel_saved_printing();
//estimated time to end of the print

View File

@ -10357,6 +10357,14 @@ void restore_print_from_ram_and_continue(float e_move)
waiting_inside_plan_buffer_line_print_aborted = true; //unroll the stack
}
// Cancel the state related to a currently saved print
void cancel_saved_printing()
{
saved_target[0] = SAVED_TARGET_UNSET;
saved_printing_type = PRINTING_TYPE_NONE;
saved_printing = false;
}
void print_world_coordinates()
{
printf_P(_N("world coordinates: (%.3f, %.3f, %.3f)\n"), current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);

View File

@ -7312,30 +7312,26 @@ static void lcd_sd_updir()
void lcd_print_stop()
{
//-//
if(!card.sdprinting)
{
SERIAL_ECHOLNRPGM(MSG_OCTOPRINT_CANCEL); // for Octoprint
}
saved_printing = false;
saved_printing_type = PRINTING_TYPE_NONE;
if (!card.sdprinting) {
SERIAL_ECHOLNRPGM(MSG_OCTOPRINT_CANCEL); // for Octoprint
}
CRITICAL_SECTION_START;
// Clear any saved printing state
cancel_saved_printing();
cancel_heatup = true;
#ifdef MESH_BED_LEVELING
mbl.active = false;
#endif
// Stop the stoppers, update the position from the stoppers.
if (mesh_bed_leveling_flag == false && homing_flag == false)
{
planner_abort_hard();
// Because the planner_abort_hard() initialized current_position[Z] from the stepper,
// Z baystep is no more applied. Reset it.
babystep_reset();
}
// Clean the input command queue.
// Abort the planner/queue/sd
planner_abort_hard();
cmdqueue_reset();
lcd_setstatuspgm(_T(MSG_PRINT_ABORTED));
card.sdprinting = false;
card.closefile();
st_reset_timer();
CRITICAL_SECTION_END;
lcd_setstatuspgm(_T(MSG_PRINT_ABORTED));
stoptime = _millis();
unsigned long t = (stoptime - starttime - pause_time) / 1000; //time in s
pause_time = 0;