From 549a8a1a6b56b38c661f4079fc43262afef7d608 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 16:23:16 +0200 Subject: [PATCH 1/3] Restore print fan speed earlier then nozzle temperature. Avoids nozzle temperature dip when fan is turned on. --- Firmware/Marlin_main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde72397..81e87ea1a 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9456,10 +9456,11 @@ void stop_and_save_print_to_ram(float z_move, float e_move) //! @brief Restore print from ram //! -//! Restore print saved by stop_and_save_print_to_ram(). Is blocking, -//! waits for extruder temperature restore, then restores position and continues -//! print moves. -//! Internaly lcd_update() is called by wait_for_heater(). +//! Restore print saved by stop_and_save_print_to_ram(). Is blocking, restores +//! print fan speed, waits for extruder temperature restore, then restores +//! position and continues print moves. +//! +//! Internally lcd_update() is called by wait_for_heater(). //! //! @param e_move void restore_print_from_ram_and_continue(float e_move) @@ -9474,6 +9475,7 @@ 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 + fanSpeed = saved_fanSpeed; if (saved_extruder_temperature) { setTargetHotendSafe(saved_extruder_temperature, saved_active_extruder); heating_status = 1; @@ -9482,7 +9484,6 @@ void restore_print_from_ram_and_continue(float e_move) } 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 ab4e7896885575a5046916be2ef1634053e37a36 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 17:22:39 +0200 Subject: [PATCH 2/3] Partially revert "aeed49a Fix filament runout on optical filament sensors" Revert plan move to filament change position before enqued M600. This was workaround to problem that restore_print_from_ram_and_continue() did 3s heating pause before resuming print. This problem will be fixed properly in restore_print_from_ram_and_continue() in next commit. Save 166B of FLASH. --- Firmware/fsensor.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index fd7936ee9..f20f647d6 100755 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -522,19 +522,6 @@ void fsensor_st_block_chunk(block_t* bl, int cnt) } } -//! This ensures generating z-position at least 25mm above the heat bed. -//! Making this a template enables changing the computation data type easily at all spots where necessary. -//! @param current_z current z-position -//! @return z-position at least 25mm above the heat bed plus FILAMENTCHANGE_ZADD -template -inline T fsensor_clamp_z(float current_z){ - T z( current_z ); - if(z < T(25)){ // make sure the compiler understands, that the constant 25 is of correct type - // - necessary for uint8_t -> results in shorter code - z = T(25); // move to at least 25mm above heat bed - } - return z + T(FILAMENTCHANGE_ZADD); // always move above the printout by FILAMENTCHANGE_ZADD (default 2mm) -} //! Common code for enqueing M600 and supplemental codes into the command queue. //! Used both for the IR sensor and the PAT9125 @@ -545,22 +532,6 @@ void fsensor_enque_M600(){ enquecommand_front_P(PSTR("PRUSA fsensor_recover")); fsensor_m600_enqueued = true; enquecommand_front_P((PSTR("M600"))); -#define xstr(a) str(a) -#define str(a) #a - static const char gcodeMove[] PROGMEM = - "G1 X" xstr(FILAMENTCHANGE_XPOS) - " Y" xstr(FILAMENTCHANGE_YPOS) - " Z%u"; -#undef str -#undef xstr - char buf[32]; - // integer arithmetics is far shorter, I don't need a precise float position here, just move a bit above - // 8bit arithmetics in fsensor_clamp_z is 10B shorter than 16bit (not talking about float ;) ) - // The compile-time static_assert here ensures, that the computation gets enough bits in case of Z-range too high, - // i.e. makes the user change the data type, which also results in larger code - static_assert(Z_MAX_POS < (255 - FILAMENTCHANGE_ZADD), "Z-range too high, change fsensor_clamp_z to "); - sprintf_P(buf, gcodeMove, fsensor_clamp_z(current_position[Z_AXIS]) ); - enquecommand_front(buf, false); } //! @brief filament sensor update (perform M600 on filament runout) From 9083d151b2b3387b68e096f3b199525b9113e784 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 18:07:05 +0200 Subject: [PATCH 3/3] wait_for_heater() in restore_print_from_ram_and_continue() only if saved_extruder_temperature differs from target hot-end temperature. This fixes problem, that restore_print_from_ram_and_continue() blocked for heating for at least TEMP_RESIDENCY_TIME (3 seconds) even if temperature was resumed by M600 command. --- Firmware/Marlin_main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 81e87ea1a..7372dae93 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9476,7 +9476,8 @@ void restore_print_from_ram_and_continue(float e_move) // current_position[axis] = st_get_position_mm(axis); active_extruder = saved_active_extruder; //restore active_extruder fanSpeed = saved_fanSpeed; - if (saved_extruder_temperature) { + if (degTargetHotend(saved_active_extruder) != saved_extruder_temperature) + { setTargetHotendSafe(saved_extruder_temperature, saved_active_extruder); heating_status = 1; wait_for_heater(_millis(), saved_active_extruder);