Move resuming nozzle temperature to restore_print_from_ram_and_continue().

Known limitations: Unused code not removed. Unload filament moves extruder to print position.
This commit is contained in:
Marek Bel 2018-09-04 14:56:20 +02:00
parent 2abd2a6cab
commit a5db084b70
2 changed files with 13 additions and 20 deletions

View file

@ -536,6 +536,7 @@ static float saved_pos[4] = { 0, 0, 0, 0 };
// Feedrate hopefully derived from an active block of the planner at the time the print has been canceled, in mm/min.
static float saved_feedrate2 = 0;
static uint8_t saved_active_extruder = 0;
static float saved_extruder_temperature = 0.0;
static bool saved_extruder_under_pressure = false;
static bool saved_extruder_relative_mode = false;
static int saved_fanSpeed = 0;
@ -8743,6 +8744,7 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
planner_abort_hard(); //abort printing
memcpy(saved_pos, current_position, sizeof(saved_pos));
saved_active_extruder = active_extruder; //save active_extruder
saved_extruder_temperature = degTargetHotend(active_extruder);
saved_extruder_under_pressure = extruder_under_pressure; //extruder under pressure flag - currently unused
saved_extruder_relative_mode = axis_relative_modes[E_AXIS];
@ -8797,6 +8799,10 @@ void restore_print_from_ram_and_continue(float e_move)
// for (int axis = X_AXIS; axis <= E_AXIS; axis++)
// current_position[axis] = st_get_position_mm(axis);
active_extruder = saved_active_extruder; //restore active_extruder
setTargetHotendSafe(saved_extruder_temperature,saved_active_extruder);
heating_status = 1;
wait_for_heater(millis(),saved_active_extruder);
heating_status = 2;
feedrate = saved_feedrate2; //restore feedrate
axis_relative_modes[E_AXIS] = saved_extruder_relative_mode;
fanSpeed = saved_fanSpeed;

View file

@ -5522,30 +5522,17 @@ static void lcd_test_menu()
static void pause_print()
{
lcd_clear();
lcd_puts_P(_i("Pausing"));
lcd_setstatuspgm(_i("Print paused"));
stop_and_save_print_to_ram(0.0,0.0);
long_pause();
lcd_return_to_status();
}
static void resume_print()
{
lcd_set_cursor(0, 0);
lcdui_print_temp(LCD_STR_THERMOMETER[0], (int)(degHotend(0) + 0.5), (int)(degTargetHotend(0) + 0.5));
lcd_space(3);
lcd_puts_P(_T(MSG_HEATING));
if (!blocks_queued())
{
if ((0 == menu_data[0]))
{
char cmd1[30];
strcpy(cmd1, "M109 S");
strcat(cmd1, ftostr3(HotendTempBckp));
enquecommand(cmd1);
menu_data[0] = 1;
} else if (1 != heating_status)
{
restore_print_from_ram_and_continue(0.0);
menu_back();
}
}
lcd_return_to_status();
restore_print_from_ram_and_continue(0.0);
}
static void lcd_main_menu()
@ -5645,7 +5632,7 @@ static void lcd_main_menu()
}
else
{
MENU_ITEM_SUBMENU_P(_i("Resume print"), resume_print);////MSG_RESUME_PRINT c=0 r=0
MENU_ITEM_SUBMENU_P(_i("Resume print"), resume_print);////MSG_RESUME_PRINT c=0 r=0
}
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
}