Rename lcd_sdcard_pause() to lcd_pause_print() to reflect, that also USB printing could be possible to pause. Unite it with pause_print() and use new (immediate) pause mechanism in all places where old mechanism was used. Rename resume_print() to lcd_resume_print() and make it global, unite it with lcd_sdcard_resume() and use it also in place, where lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME was used. Remove LCD_COMMAND_LONG_PAUSE_RESUME lcd_command_type. Remove unused pause_lastpos[].
This commit is contained in:
parent
74be7677cf
commit
920d828833
@ -337,7 +337,6 @@ extern uint8_t active_extruder;
|
||||
extern int saved_feedmultiply;
|
||||
extern float HotendTempBckp;
|
||||
extern int fanSpeedBckp;
|
||||
extern float pause_lastpos[4];
|
||||
extern unsigned long pause_time;
|
||||
extern unsigned long start_pause_print;
|
||||
extern unsigned long t_fan_rising_edge;
|
||||
|
@ -333,7 +333,6 @@ int8_t lcd_change_fil_state = 0;
|
||||
int feedmultiplyBckp = 100;
|
||||
float HotendTempBckp = 0;
|
||||
int fanSpeedBckp = 0;
|
||||
float pause_lastpos[4];
|
||||
unsigned long pause_time = 0;
|
||||
unsigned long start_pause_print = millis();
|
||||
unsigned long t_fan_rising_edge = millis();
|
||||
@ -6479,13 +6478,14 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
}
|
||||
break;
|
||||
#endif //FILAMENTCHANGEENABLE
|
||||
case 601: {
|
||||
if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE;
|
||||
case 601:
|
||||
{
|
||||
lcd_pause_print();
|
||||
}
|
||||
break;
|
||||
|
||||
case 602: {
|
||||
if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME;
|
||||
lcd_resume_print();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -8124,13 +8124,6 @@ void long_pause() //long pause print
|
||||
HotendTempBckp = degTargetHotend(active_extruder);
|
||||
fanSpeedBckp = fanSpeed;
|
||||
start_pause_print = millis();
|
||||
|
||||
|
||||
//save position
|
||||
pause_lastpos[X_AXIS] = current_position[X_AXIS];
|
||||
pause_lastpos[Y_AXIS] = current_position[Y_AXIS];
|
||||
pause_lastpos[Z_AXIS] = current_position[Z_AXIS];
|
||||
pause_lastpos[E_AXIS] = current_position[E_AXIS];
|
||||
|
||||
//retract
|
||||
current_position[E_AXIS] -= default_retraction;
|
||||
|
@ -512,7 +512,7 @@ void fanSpeedError(unsigned char _fan) {
|
||||
}
|
||||
else {
|
||||
isPrintPaused = true;
|
||||
lcd_sdcard_pause();
|
||||
lcd_pause_print();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -975,68 +975,8 @@ void lcd_commands()
|
||||
lcd_commands_type = 0;
|
||||
lcd_commands_step = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE_RESUME) {
|
||||
char cmd1[30];
|
||||
if (lcd_commands_step == 0) {
|
||||
|
||||
lcd_draw_update = 3;
|
||||
lcd_commands_step = 4;
|
||||
}
|
||||
if (lcd_commands_step == 1 && !blocks_queued() && cmd_buffer_empty()) { //recover feedmultiply; cmd_buffer_empty() ensures that card.sdprinting is synchronized with buffered commands and thus print cant be paused until resume is finished
|
||||
|
||||
sprintf_P(cmd1, PSTR("M220 S%d"), saved_feedmultiply);
|
||||
enquecommand(cmd1);
|
||||
isPrintPaused = false;
|
||||
pause_time += (millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation
|
||||
card.startFileprint();
|
||||
lcd_commands_step = 0;
|
||||
lcd_commands_type = 0;
|
||||
}
|
||||
if (lcd_commands_step == 2 && !blocks_queued()) { //turn on fan, move Z and unretract
|
||||
|
||||
sprintf_P(cmd1, PSTR("M106 S%d"), fanSpeedBckp);
|
||||
enquecommand(cmd1);
|
||||
strcpy(cmd1, "G1 Z");
|
||||
strcat(cmd1, ftostr32(pause_lastpos[Z_AXIS]));
|
||||
enquecommand(cmd1);
|
||||
|
||||
if (axis_relative_modes[3] == false) {
|
||||
enquecommand_P(PSTR("M83")); // set extruder to relative mode
|
||||
enquecommand_P(PSTR("G1 E" STRINGIFY(default_retraction))); //unretract
|
||||
enquecommand_P(PSTR("M82")); // set extruder to absolute mode
|
||||
}
|
||||
else {
|
||||
enquecommand_P(PSTR("G1 E" STRINGIFY(default_retraction))); //unretract
|
||||
}
|
||||
|
||||
lcd_commands_step = 1;
|
||||
}
|
||||
if (lcd_commands_step == 3 && !blocks_queued()) { //wait for nozzle to reach target temp
|
||||
|
||||
strcpy(cmd1, "M109 S");
|
||||
strcat(cmd1, ftostr3(HotendTempBckp));
|
||||
enquecommand(cmd1);
|
||||
lcd_commands_step = 2;
|
||||
}
|
||||
if (lcd_commands_step == 4 && !blocks_queued()) { //set temperature back and move xy
|
||||
|
||||
strcpy(cmd1, "M104 S");
|
||||
strcat(cmd1, ftostr3(HotendTempBckp));
|
||||
enquecommand(cmd1);
|
||||
enquecommand_P(PSTR("G90")); //absolute positioning
|
||||
strcpy(cmd1, "G1 X");
|
||||
strcat(cmd1, ftostr32(pause_lastpos[X_AXIS]));
|
||||
strcat(cmd1, " Y");
|
||||
strcat(cmd1, ftostr32(pause_lastpos[Y_AXIS]));
|
||||
enquecommand(cmd1);
|
||||
|
||||
lcd_setstatuspgm(_T(MSG_RESUMING_PRINT));
|
||||
lcd_commands_step = 3;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SNMM
|
||||
if (lcd_commands_type == LCD_COMMAND_V2_CAL)
|
||||
@ -1744,17 +1684,15 @@ void lcd_return_to_status()
|
||||
}
|
||||
|
||||
|
||||
void lcd_sdcard_pause() {
|
||||
void lcd_pause_print() {
|
||||
lcd_return_to_status();
|
||||
lcd_commands_type = LCD_COMMAND_LONG_PAUSE;
|
||||
|
||||
stop_and_save_print_to_ram(0.0,0.0);
|
||||
if (LCD_COMMAND_IDLE == lcd_commands_type)
|
||||
{
|
||||
lcd_commands_type = LCD_COMMAND_LONG_PAUSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void lcd_sdcard_resume() {
|
||||
lcd_return_to_status();
|
||||
lcd_reset_alert_level(); //for fan speed error
|
||||
lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME;
|
||||
}
|
||||
|
||||
float move_menu_scale;
|
||||
static void lcd_move_menu_axis();
|
||||
@ -5510,20 +5448,14 @@ static void lcd_test_menu()
|
||||
}
|
||||
#endif //LCD_TEST
|
||||
|
||||
static void pause_print()
|
||||
{
|
||||
lcd_puts_P(_i("Pausing"));
|
||||
stop_and_save_print_to_ram(0.0,0.0);
|
||||
if (LCD_COMMAND_IDLE == lcd_commands_type)
|
||||
{
|
||||
lcd_commands_type = LCD_COMMAND_LONG_PAUSE;
|
||||
lcd_return_to_status();
|
||||
}
|
||||
}
|
||||
static void resume_print()
|
||||
void lcd_resume_print()
|
||||
{
|
||||
lcd_return_to_status();
|
||||
lcd_setstatuspgm(_T(MSG_RESUMING_PRINT));
|
||||
lcd_reset_alert_level(); //for fan speed error
|
||||
restore_print_from_ram_and_continue(0.0);
|
||||
pause_time += (millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation
|
||||
isPrintPaused = false;
|
||||
}
|
||||
|
||||
static void lcd_main_menu()
|
||||
@ -5619,11 +5551,11 @@ static void lcd_main_menu()
|
||||
if (mesh_bed_leveling_flag == false && homing_flag == false) {
|
||||
if (card.sdprinting)
|
||||
{
|
||||
MENU_ITEM_SUBMENU_P(_i("Pause print"), pause_print);////MSG_PAUSE_PRINT c=0 r=0
|
||||
MENU_ITEM_FUNCTION_P(_i("Pause print"), lcd_pause_print);////MSG_PAUSE_PRINT c=0 r=0
|
||||
}
|
||||
else
|
||||
{
|
||||
MENU_ITEM_SUBMENU_P(_i("Resume print"), resume_print);////MSG_RESUME_PRINT c=0 r=0
|
||||
MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT c=0 r=0
|
||||
}
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
|
||||
}
|
||||
|
@ -32,7 +32,8 @@ void lcd_loading_filament();
|
||||
void lcd_change_success();
|
||||
void lcd_loading_color();
|
||||
void lcd_sdcard_stop();
|
||||
void lcd_sdcard_pause();
|
||||
void lcd_pause_print();
|
||||
void lcd_resume_print();
|
||||
void lcd_print_stop();
|
||||
void prusa_statistics(int _message, uint8_t _col_nr = 0);
|
||||
void lcd_confirm_print();
|
||||
@ -77,7 +78,6 @@ extern void lcd_diag_show_end_stops();
|
||||
#define LCD_COMMAND_STOP_PRINT 2
|
||||
#define LCD_COMMAND_FARM_MODE_CONFIRM 4
|
||||
#define LCD_COMMAND_LONG_PAUSE 5
|
||||
#define LCD_COMMAND_LONG_PAUSE_RESUME 6
|
||||
#define LCD_COMMAND_PID_EXTRUDER 7
|
||||
#define LCD_COMMAND_V2_CAL 8
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user