From af08e164266d37b778c00668dff96a35d754e140 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 4 Sep 2018 08:06:03 +0200 Subject: [PATCH 01/14] Use stop_and_save_print_to_ram() and restore_print_from_ram_and_continue() pair to pause print from menu. Move declaration of those functions to marlin.h. Move declaration of FSensorStateMenu to ultralcd.h. Known limitations: Filament is not retracted, extruder is not lifted in Z and moved to rear left corner in XY. Nozzle heating is not turned off nor restored. Unused code is not removed. --- Firmware/Marlin.h | 3 +++ Firmware/Marlin_main.cpp | 3 --- Firmware/fsensor.cpp | 5 +---- Firmware/ultralcd.cpp | 13 +++++++++++-- Firmware/ultralcd.h | 1 + 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index dbb611f4..5367a41e 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -419,6 +419,9 @@ extern void print_world_coordinates(); extern void print_physical_coordinates(); 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); + //estimated time to end of the print extern uint16_t print_time_remaining(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6ac5298e..f30abc71 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -649,9 +649,6 @@ void servo_init() } -void stop_and_save_print_to_ram(float z_move, float e_move); -void restore_print_from_ram_and_continue(float e_move); - bool fans_check_enabled = true; diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index 8800dbb0..a035683c 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -7,6 +7,7 @@ #include "planner.h" #include "fastio.h" #include "cmdqueue.h" +#include "ultralcd.h" //Basic params #define FSENSOR_CHUNK_LEN 0.64F //filament sensor chunk length 0.64mm @@ -27,10 +28,6 @@ const char ERRMSG_PAT9125_NOT_RESP[] PROGMEM = "PAT9125 not responding (%d)!\n"; #define FSENSOR_INT_PIN 63 //filament sensor interrupt pin PK1 #define FSENSOR_INT_PIN_MSK 0x02 //filament sensor interrupt pin mask (bit1) -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 int8_t FSensorStateMenu; - void fsensor_stop_and_save_print(void) { printf_P(PSTR("fsensor_stop_and_save_print\n")); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f10aa6eb..95cc170a 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5520,6 +5520,15 @@ static void lcd_test_menu() } #endif //LCD_TEST +static void pause_print() +{ + stop_and_save_print_to_ram(0.0,0.0); +} +static void resume_print() +{ + restore_print_from_ram_and_continue(0.0); +} + static void lcd_main_menu() { @@ -5613,11 +5622,11 @@ static void lcd_main_menu() if (mesh_bed_leveling_flag == false && homing_flag == false) { if (card.sdprinting) { - MENU_ITEM_FUNCTION_P(_i("Pause print"), lcd_sdcard_pause);////MSG_PAUSE_PRINT c=0 r=0 + MENU_ITEM_FUNCTION_P(_i("Pause print"), pause_print);////MSG_PAUSE_PRINT c=0 r=0 } else { - MENU_ITEM_FUNCTION_P(_i("Resume print"), lcd_sdcard_resume);////MSG_RESUME_PRINT c=0 r=0 + MENU_ITEM_FUNCTION_P(_i("Resume print"), resume_print);////MSG_RESUME_PRINT c=0 r=0 } MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index c6bbb900..d7f8d00d 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -82,6 +82,7 @@ extern void lcd_diag_show_end_stops(); #define LCD_COMMAND_V2_CAL 8 extern int lcd_commands_type; +extern int8_t FSensorStateMenu; #define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable #define CUSTOM_MSG_TYPE_MESHBL 1 // Mesh bed leveling in progress From d54e629950ef58b676a179a4b7bceba0c37096d2 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 4 Sep 2018 08:53:27 +0200 Subject: [PATCH 02/14] Retract, lift Z, move away in XY, disable fan and nozzle heating. Resume nozzle heating. Known limitations: Doesn't wait for nozzle temperature reaching set temperature before moving to print area. Doesn't resume print fan. Unused code not removed. --- Firmware/ultralcd.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 95cc170a..c8e625c0 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5523,9 +5523,17 @@ static void lcd_test_menu() static void pause_print() { stop_and_save_print_to_ram(0.0,0.0); + long_pause(); } static void resume_print() { + char cmd1[30]; + strcpy(cmd1, "M104 S"); + strcat(cmd1, ftostr3(HotendTempBckp)); + enquecommand(cmd1); + strcpy(cmd1, "M109 S"); + strcat(cmd1, ftostr3(HotendTempBckp)); + enquecommand(cmd1); restore_print_from_ram_and_continue(0.0); } From acef0578a5bb53b68426c5133b0d26ca662247b8 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 4 Sep 2018 10:07:52 +0200 Subject: [PATCH 03/14] Don't move before reaching nozzle temperature when resuming the print. Known limitations: Doesn't resume print fan. Unused code not removed. Unload filament moves extruder to print position. --- Firmware/ultralcd.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c8e625c0..3a13fdae 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5527,14 +5527,25 @@ static void pause_print() } static void resume_print() { - char cmd1[30]; - strcpy(cmd1, "M104 S"); - strcat(cmd1, ftostr3(HotendTempBckp)); - enquecommand(cmd1); - strcpy(cmd1, "M109 S"); - strcat(cmd1, ftostr3(HotendTempBckp)); - enquecommand(cmd1); - restore_print_from_ram_and_continue(0.0); + 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(); + } + } } static void lcd_main_menu() @@ -5634,7 +5645,7 @@ static void lcd_main_menu() } else { - MENU_ITEM_FUNCTION_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); } From 2abd2a6cabed9543df421a81f375bb5a27146280 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 4 Sep 2018 11:13:51 +0200 Subject: [PATCH 04/14] Resume print fan. Known limitations: Unused code not removed. Unload filament moves extruder to print position. --- Firmware/Marlin_main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index f30abc71..80d14f3f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -538,6 +538,7 @@ static float saved_feedrate2 = 0; static uint8_t saved_active_extruder = 0; static bool saved_extruder_under_pressure = false; static bool saved_extruder_relative_mode = false; +static int saved_fanSpeed = 0; //=========================================================================== //=============================Routines====================================== @@ -8745,6 +8746,7 @@ void stop_and_save_print_to_ram(float z_move, float e_move) saved_extruder_under_pressure = extruder_under_pressure; //extruder under pressure flag - currently unused saved_extruder_relative_mode = axis_relative_modes[E_AXIS]; + saved_fanSpeed = fanSpeed; cmdqueue_reset(); //empty cmdqueue card.sdprinting = false; // card.closefile(); @@ -8797,6 +8799,7 @@ void restore_print_from_ram_and_continue(float e_move) active_extruder = saved_active_extruder; //restore active_extruder feedrate = saved_feedrate2; //restore feedrate axis_relative_modes[E_AXIS] = saved_extruder_relative_mode; + fanSpeed = saved_fanSpeed; float e = saved_pos[E_AXIS] - e_move; plan_set_e_position(e); //first move print head in XY to the saved position: From a5db084b705f24cc11e699b4ef0e083a56792374 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 4 Sep 2018 14:56:20 +0200 Subject: [PATCH 05/14] Move resuming nozzle temperature to restore_print_from_ram_and_continue(). Known limitations: Unused code not removed. Unload filament moves extruder to print position. --- Firmware/Marlin_main.cpp | 6 ++++++ Firmware/ultralcd.cpp | 27 +++++++-------------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 80d14f3f..0e7d8e91 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -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; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3a13fdae..a583f94b 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -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); } From 4b47a74d1d03a2b78340ef1a40b70a181b2f814b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 5 Sep 2018 18:14:32 +0200 Subject: [PATCH 06/14] Remove unused declarations from tmc2130.cpp. Move used declaration to Marlin.h. --- Firmware/Marlin.h | 1 + Firmware/tmc2130.cpp | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 5367a41e..767fac3e 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -379,6 +379,7 @@ extern void delay_keep_alive(unsigned int ms); extern void check_babystep(); extern void long_pause(); +extern void crashdet_stop_and_save_print(); #ifdef DIS diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 1d1495fe..732f290d 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -13,12 +13,6 @@ #define TMC2130_GCONF_SGSENS 0x00003180 // spreadCycle with stallguard (stall activates DIAG0 and DIAG1 [pushpull]) #define TMC2130_GCONF_SILENT 0x00000004 // stealthChop -//externals for debuging -extern float current_position[4]; -extern void st_get_position_xy(long &x, long &y); -extern long st_get_position(uint8_t axis); -extern void crashdet_stop_and_save_print(); -extern void crashdet_stop_and_save_print2(); //mode uint8_t tmc2130_mode = TMC2130_MODE_NORMAL; From 74be7677cfa0befa981858ea352fe3a134566ee0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 5 Sep 2018 21:10:05 +0200 Subject: [PATCH 07/14] Fix problem, that current_position is rewritten after long_pause() call. --- Firmware/ultralcd.cpp | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a583f94b..6f3652eb 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -967,18 +967,8 @@ void lcd_commands() { if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) { - if(lcd_commands_step == 0) { - if (card.sdprinting) { - card.pauseSDPrint(); - lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); - lcd_draw_update = 3; - lcd_commands_step = 1; - } - else { - lcd_commands_type = 0; - } - } - if (lcd_commands_step == 1 && !blocks_queued() && !homing_flag) { + if (!blocks_queued() && !homing_flag) + { lcd_setstatuspgm(_i("Print paused"));////MSG_PRINT_PAUSED c=20 r=1 isPrintPaused = true; long_pause(); @@ -5522,12 +5512,13 @@ 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(); + if (LCD_COMMAND_IDLE == lcd_commands_type) + { + lcd_commands_type = LCD_COMMAND_LONG_PAUSE; + lcd_return_to_status(); + } } static void resume_print() { @@ -5628,7 +5619,7 @@ static void lcd_main_menu() if (mesh_bed_leveling_flag == false && homing_flag == false) { if (card.sdprinting) { - MENU_ITEM_FUNCTION_P(_i("Pause print"), pause_print);////MSG_PAUSE_PRINT c=0 r=0 + MENU_ITEM_SUBMENU_P(_i("Pause print"), pause_print);////MSG_PAUSE_PRINT c=0 r=0 } else { From 920d828833b50bab775adb8ee4f1338fb0d3c7d9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 6 Sep 2018 08:32:50 +0200 Subject: [PATCH 08/14] 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[]. --- Firmware/Marlin.h | 1 - Firmware/Marlin_main.cpp | 15 ++----- Firmware/temperature.cpp | 2 +- Firmware/ultralcd.cpp | 94 ++++++---------------------------------- Firmware/ultralcd.h | 4 +- 5 files changed, 20 insertions(+), 96 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 767fac3e..5292334f 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -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; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0e7d8e91..2cf5d337 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -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; diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 34539483..ec05de2b 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -512,7 +512,7 @@ void fanSpeedError(unsigned char _fan) { } else { isPrintPaused = true; - lcd_sdcard_pause(); + lcd_pause_print(); } } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6f3652eb..4feb2299 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -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); } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index d7f8d00d..113f6f70 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -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 From d71311f13ff2cefa8cd9fd633df248f09890bd70 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 6 Sep 2018 09:41:37 +0200 Subject: [PATCH 09/14] Remove redundant HotendTempBckp from crash detection recover. --- Firmware/Marlin_main.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2cf5d337..351ddc02 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -745,16 +745,11 @@ void crashdet_detected(uint8_t mask) if (automatic_recovery_after_crash) { enquecommand_P(PSTR("CRASH_RECOVER")); }else{ - HotendTempBckp = degTargetHotend(active_extruder); setTargetHotend(0, active_extruder); bool yesno = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Crash detected. Resume print?"), false); lcd_update_enable(true); if (yesno) { - char cmd1[10]; - strcpy(cmd1, "M109 S"); - strcat(cmd1, ftostr3(HotendTempBckp)); - enquecommand(cmd1); enquecommand_P(PSTR("CRASH_RECOVER")); } else From b43c8dad746bf743cbfaabffd9cd728699aa941b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 6 Sep 2018 10:05:59 +0200 Subject: [PATCH 10/14] Remove HotendTempBckp global variable. --- Firmware/Marlin.h | 3 +-- Firmware/Marlin_main.cpp | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 5292334f..88d9a3bf 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -335,7 +335,6 @@ extern uint8_t active_extruder; //Long pause extern int saved_feedmultiply; -extern float HotendTempBckp; extern int fanSpeedBckp; extern unsigned long pause_time; extern unsigned long start_pause_print; @@ -476,5 +475,5 @@ void proc_commands(); void M600_load_filament(); void M600_load_filament_movements(); -void M600_wait_for_user(); +void M600_wait_for_user(float HotendTempBckp); void M600_check_state(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 351ddc02..68982587 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -331,7 +331,6 @@ unsigned int usb_printing_counter; int8_t lcd_change_fil_state = 0; int feedmultiplyBckp = 100; -float HotendTempBckp = 0; int fanSpeedBckp = 0; unsigned long pause_time = 0; unsigned long start_pause_print = millis(); @@ -3059,7 +3058,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float //First backup current position and settings feedmultiplyBckp = feedmultiply; - HotendTempBckp = degTargetHotend(active_extruder); + float HotendTempBckp = degTargetHotend(active_extruder); fanSpeedBckp = fanSpeed; lastpos[X_AXIS] = current_position[X_AXIS]; @@ -3087,7 +3086,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float st_synchronize(); //Beep, manage nozzle heater and wait for user to start unload filament - if(!mmu_enabled) M600_wait_for_user(); + if(!mmu_enabled) M600_wait_for_user(HotendTempBckp); lcd_change_fil_state = 0; @@ -8116,7 +8115,6 @@ void long_pause() //long pause print //save currently set parameters to global variables saved_feedmultiply = feedmultiply; - HotendTempBckp = degTargetHotend(active_extruder); fanSpeedBckp = fanSpeed; start_pause_print = millis(); @@ -8912,7 +8910,7 @@ void M600_check_state() } } -void M600_wait_for_user() { +void M600_wait_for_user(float HotendTempBckp) { //Beep, manage nozzle heater and wait for user to start unload filament KEEPALIVE_STATE(PAUSED_FOR_USER); From 40990c4deb25f9d5b87f6a177d82b23383fe4dfb Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 6 Sep 2018 11:30:06 +0200 Subject: [PATCH 11/14] Remove saved_feedmultiply global variable. --- Firmware/Marlin_main.cpp | 65 ++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 68982587..47ac08de 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -306,7 +306,6 @@ float homing_feedrate[] = HOMING_FEEDRATE; // Other axes are always absolute or relative based on the common relative_mode flag. bool axis_relative_modes[] = AXIS_RELATIVE_MODES; int feedmultiply=100; //100->1 200->2 -int saved_feedmultiply; int extrudemultiply=100; //100->1 200->2 int extruder_multiply[EXTRUDERS] = {100 #if EXTRUDERS > 1 @@ -2009,23 +2008,24 @@ static void axis_is_at_home(int axis) { inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); } inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); } - -static void setup_for_endstop_move(bool enable_endstops_now = true) { +//! @return original feedmultiply +static int setup_for_endstop_move(bool enable_endstops_now = true) { saved_feedrate = feedrate; - saved_feedmultiply = feedmultiply; + int l_feedmultiply = feedmultiply; feedmultiply = 100; previous_millis_cmd = millis(); enable_endstops(enable_endstops_now); + return l_feedmultiply; } -static void clean_up_after_endstop_move() { +static void clean_up_after_endstop_move(int original_feedmultiply) { #ifdef ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false); #endif feedrate = saved_feedrate; - feedmultiply = saved_feedmultiply; + feedmultiply = original_feedmultiply; previous_millis_cmd = millis(); } @@ -2610,7 +2610,7 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_ babystep_undo(); saved_feedrate = feedrate; - saved_feedmultiply = feedmultiply; + int l_feedmultiply = feedmultiply; feedmultiply = 100; previous_millis_cmd = millis(); @@ -2796,7 +2796,7 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_ #endif feedrate = saved_feedrate; - feedmultiply = saved_feedmultiply; + feedmultiply = l_feedmultiply; previous_millis_cmd = millis(); endstops_hit_on_purpose(); #ifndef MESH_BED_LEVELING @@ -2876,7 +2876,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) // Home in the XY plane. //set_destination_to_current(); - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); lcd_display_message_fullscreen_P(_T(MSG_AUTO_HOME)); home_xy(); @@ -2936,7 +2936,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) { if (onlyZ) { - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); // Z only calibration. // Load the machine correction matrix world2machine_initialize(); @@ -2961,7 +2961,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) // Complete XYZ calibration. uint8_t point_too_far_mask = 0; BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask); - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); // Print head up. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder); @@ -2978,10 +2978,10 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) mbl.reset(); world2machine_reset(); // Home in the XY plane. - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); home_xy(); result = improve_bed_offset_and_skew(1, verbosity_level, point_too_far_mask); - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); // Print head up. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder); @@ -3824,7 +3824,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) current_position[Y_AXIS] = uncorrected_position.y; current_position[Z_AXIS] = uncorrected_position.z; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); feedrate = homing_feedrate[Z_AXIS]; #ifdef AUTO_BED_LEVELING_GRID @@ -3890,7 +3890,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) xProbe += xInc; } } - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); // solve lsq problem double *plane_equation_coefficients = qr_solve(AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS, 3, eqnAMatrix, eqnBVector); @@ -3919,7 +3919,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // probe 3 float z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS); - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3); @@ -3945,7 +3945,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) { st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); feedrate = homing_feedrate[Z_AXIS]; @@ -3959,7 +3959,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) SERIAL_PROTOCOL(current_position[Z_AXIS]); SERIAL_PROTOCOLPGM("\n"); - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); } break; #else @@ -3977,7 +3977,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) { st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); feedrate = homing_feedrate[Z_AXIS]; @@ -3985,7 +3985,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) printf_P(_N("%S X: %.5f Y: %.5f Z: %.5f\n"), _T(MSG_BED), _x, _y, _z); - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); } break; @@ -4410,7 +4410,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) has_z ? SERIAL_PROTOCOLPGM("Z jitter data from Z cal. valid.\n") : SERIAL_PROTOCOLPGM("Z jitter data from Z cal. not valid.\n"); } #endif // SUPPORT_VERBOSITY - setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100 + int l_feedmultiply = setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100 const char *kill_message = NULL; while (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) { // Get coords of a measuring point. @@ -4517,7 +4517,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) kill(kill_message); SERIAL_ECHOLNPGM("killed"); } - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); // SERIAL_ECHOLNPGM("clean up finished "); bool apply_temp_comp = true; @@ -4641,9 +4641,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) */ case 82: SERIAL_PROTOCOLLNPGM("Finding bed "); - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); find_bed_induction_sensor_point_z(); - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); SERIAL_PROTOCOLPGM("Bed found at: "); SERIAL_PROTOCOL_F(current_position[Z_AXIS], 5); SERIAL_PROTOCOLPGM("\n"); @@ -5070,7 +5070,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) st_synchronize(); // Home in the XY plane. set_destination_to_current(); - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); home_xy(); int8_t verbosity_level = 0; if (code_seen('V')) { @@ -5079,7 +5079,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short(); } bool success = scan_bed_induction_points(verbosity_level); - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); // Print head up. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder); @@ -5209,7 +5209,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // Then retrace the right amount and use that in subsequent probes // - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); run_z_probe(); current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS); @@ -5273,7 +5273,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) do_blocking_move_to( X_probe_location, Y_probe_location, Z_start_location); // Go back to the probe location } - setup_for_endstop_move(); + int l_feedmultiply = setup_for_endstop_move(); run_z_probe(); sample_set[n] = current_position[Z_AXIS]; @@ -5324,9 +5324,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) delay(1000); - clean_up_after_endstop_move(); + clean_up_after_endstop_move(l_feedmultiply); -// enable_endstops(true); +// enable_endstops(true); if (verbose_level > 0) { SERIAL_PROTOCOLPGM("Mean: "); @@ -7850,7 +7850,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20; int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40; - setup_for_endstop_move(false); + int l_feedmultiply = setup_for_endstop_move(false); SERIAL_PROTOCOLPGM("Num X,Y: "); SERIAL_PROTOCOL(x_points_num); @@ -7979,7 +7979,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } card.closefile(); - + clean_up_after_endstop_move(l_feedmultiply); } #endif @@ -8114,7 +8114,6 @@ void long_pause() //long pause print st_synchronize(); //save currently set parameters to global variables - saved_feedmultiply = feedmultiply; fanSpeedBckp = fanSpeed; start_pause_print = millis(); From 05a0b9c93928a07274fe966732cead706b58dd20 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 6 Sep 2018 11:36:23 +0200 Subject: [PATCH 12/14] Remove fanSpeedBckp global variable. --- Firmware/Marlin_main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 47ac08de..6fbdf3ac 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -330,7 +330,6 @@ unsigned int usb_printing_counter; int8_t lcd_change_fil_state = 0; int feedmultiplyBckp = 100; -int fanSpeedBckp = 0; unsigned long pause_time = 0; unsigned long start_pause_print = millis(); unsigned long t_fan_rising_edge = millis(); @@ -3059,7 +3058,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float //First backup current position and settings feedmultiplyBckp = feedmultiply; float HotendTempBckp = degTargetHotend(active_extruder); - fanSpeedBckp = fanSpeed; + int fanSpeedBckp = fanSpeed; lastpos[X_AXIS] = current_position[X_AXIS]; lastpos[Y_AXIS] = current_position[Y_AXIS]; @@ -8113,8 +8112,6 @@ void long_pause() //long pause print { st_synchronize(); - //save currently set parameters to global variables - fanSpeedBckp = fanSpeed; start_pause_print = millis(); //retract From 0fe48de4aff8de61de44cfdc1a3477ad65d03137 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 6 Sep 2018 12:23:21 +0200 Subject: [PATCH 13/14] Remove feedmultiplyBckp global variable. Remove redundant isPrintPaused = true assignment, as it is already done in lcd_pause_print(). Remove unused saved_feedmultiply and fanSpeedBckp prototypes. Move isPrintPaused = true assignment to safer location, as LCD_COMMAND_LONG_PAUSE is not reached if lcd_commands_type is not LCD_COMMAND_IDLE. --- Firmware/Marlin.h | 2 -- Firmware/Marlin_main.cpp | 5 ++--- Firmware/temperature.cpp | 4 ---- Firmware/ultralcd.cpp | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 88d9a3bf..4c8440aa 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -334,8 +334,6 @@ extern uint8_t active_extruder; #endif //Long pause -extern int saved_feedmultiply; -extern int fanSpeedBckp; extern unsigned long pause_time; extern unsigned long start_pause_print; extern unsigned long t_fan_rising_edge; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6fbdf3ac..767ab8d5 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -329,7 +329,6 @@ unsigned int usb_printing_counter; int8_t lcd_change_fil_state = 0; -int feedmultiplyBckp = 100; unsigned long pause_time = 0; unsigned long start_pause_print = millis(); unsigned long t_fan_rising_edge = millis(); @@ -3056,7 +3055,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float } //First backup current position and settings - feedmultiplyBckp = feedmultiply; + int feedmultiplyBckp = feedmultiply; float HotendTempBckp = degTargetHotend(active_extruder); int fanSpeedBckp = fanSpeed; @@ -3541,7 +3540,7 @@ void process_commands() if(READ(FR_SENS)){ - feedmultiplyBckp=feedmultiply; + int feedmultiplyBckp=feedmultiply; float target[4]; float lastpos[4]; target[X_AXIS]=current_position[X_AXIS]; diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index ec05de2b..03f59693 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -500,9 +500,6 @@ void checkFanSpeed() } } -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); - void fanSpeedError(unsigned char _fan) { if (get_message_level() != 0 && isPrintPaused) return; //to ensure that target temp. is not set to zero in case taht we are resuming print @@ -511,7 +508,6 @@ void fanSpeedError(unsigned char _fan) { lcd_print_stop(); } else { - isPrintPaused = true; lcd_pause_print(); } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4feb2299..c699a19f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -970,7 +970,6 @@ void lcd_commands() if (!blocks_queued() && !homing_flag) { lcd_setstatuspgm(_i("Print paused"));////MSG_PRINT_PAUSED c=20 r=1 - isPrintPaused = true; long_pause(); lcd_commands_type = 0; lcd_commands_step = 0; @@ -1687,6 +1686,7 @@ void lcd_return_to_status() void lcd_pause_print() { lcd_return_to_status(); stop_and_save_print_to_ram(0.0,0.0); + isPrintPaused = true; if (LCD_COMMAND_IDLE == lcd_commands_type) { lcd_commands_type = LCD_COMMAND_LONG_PAUSE; From 5d1e59cec3d79093e8bc6d69e2e5f77b609d3b84 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 6 Sep 2018 13:20:24 +0200 Subject: [PATCH 14/14] Fix problem that nozzle temperature stays 0 if resume print is invoked from menu earlier than pause movements are finished. --- Firmware/Marlin_main.cpp | 3 --- Firmware/ultralcd.cpp | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 767ab8d5..6f9a6a0e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8122,9 +8122,6 @@ void long_pause() //long pause print if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder); - //set nozzle target temperature to 0 - setAllTargetHotends(0); - //Move XY to side current_position[X_AXIS] = X_PAUSE_POS; current_position[Y_AXIS] = Y_PAUSE_POS; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c699a19f..3043dbe0 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1683,14 +1683,16 @@ void lcd_return_to_status() } -void lcd_pause_print() { - lcd_return_to_status(); - stop_and_save_print_to_ram(0.0,0.0); - isPrintPaused = true; - if (LCD_COMMAND_IDLE == lcd_commands_type) - { - lcd_commands_type = LCD_COMMAND_LONG_PAUSE; - } +void lcd_pause_print() +{ + lcd_return_to_status(); + stop_and_save_print_to_ram(0.0,0.0); + setAllTargetHotends(0); + isPrintPaused = true; + if (LCD_COMMAND_IDLE == lcd_commands_type) + { + lcd_commands_type = LCD_COMMAND_LONG_PAUSE; + } }