From 75d31fd2cb9d07c0be10a514ce53852075531409 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 18 Dec 2018 18:47:54 +0100 Subject: [PATCH 1/4] Repeat last MMU command after timeout --- Firmware/mmu.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index b0c1beda..d8e32458 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -51,6 +51,8 @@ int16_t mmu_buildnr = -1; uint32_t mmu_last_request = 0; uint32_t mmu_last_response = 0; +uint8_t mmu_last_cmd = 0; + //clear rx buffer void mmu_clr_rx_buf(void) @@ -251,6 +253,7 @@ void mmu_loop(void) mmu_puts_P(PSTR("R0\n")); //send recover after eject mmu_state = 3; // wait for response } + mmu_last_cmd = mmu_cmd; mmu_cmd = 0; } else if ((mmu_last_response + 300) < millis()) //request every 300ms @@ -291,11 +294,20 @@ void mmu_loop(void) #ifdef MMU_DEBUG printf_P(PSTR("MMU => 'ok'\n")); #endif //MMU_DEBUG + mmu_last_cmd = 0; mmu_ready = true; mmu_state = 1; } else if ((mmu_last_request + MMU_CMD_TIMEOUT) < millis()) { //resend request after timeout (5 min) + if (mmu_last_cmd) + { +#ifdef MMU_DEBUG + printf_P(PSTR("MMU retry\n")); +#endif //MMU_DEBUG + mmu_cmd = mmu_last_cmd; +// mmu_last_cmd = 0; //resend just once + } mmu_state = 1; } return; From 34f116b4d9584b35f3d3f52e16721818952d5b27 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 18 Dec 2018 19:57:29 +0100 Subject: [PATCH 2/4] Move 1mm down with disabled endstop after calibrate_z_auto (PFW718) --- Firmware/Marlin_main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0318ee2b..27d729d1 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2796,7 +2796,12 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) // Move the print head close to the bed. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - bool endstops_enabled = enable_endstops(true); + bool endstops_enabled = enable_endstops(false); + current_position[Z_AXIS] -= 1; //move 1mm down with disabled endstop + 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); + st_synchronize(); + + enable_endstops(true); #ifdef TMC2130 tmc2130_home_enter(Z_AXIS_MASK); #endif //TMC2130 From 16e5fb50ddc72a294c7eb173622d0ec2961210cc Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 18 Dec 2018 20:39:38 +0100 Subject: [PATCH 3/4] Remove M601 from queue before saving state (prevent infinite loop - PFW713) --- Firmware/Marlin_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 27d729d1..fa5a1028 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6518,6 +6518,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) #endif //FILAMENTCHANGEENABLE case 601: //! M601 - Pause print { + cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore lcd_pause_print(); } break; From b8c5b6259ed7c635292240e36d435b0397191374 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Wed, 19 Dec 2018 14:40:10 +0100 Subject: [PATCH 4/4] Fix - move down after calibrate Z (PFW718) --- Firmware/Marlin_main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index fa5a1028..dc96673c 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2793,14 +2793,14 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) lcd_puts_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2)); } - // Move the print head close to the bed. - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - bool endstops_enabled = enable_endstops(false); current_position[Z_AXIS] -= 1; //move 1mm down with disabled endstop 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); st_synchronize(); + // Move the print head close to the bed. + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + enable_endstops(true); #ifdef TMC2130 tmc2130_home_enter(Z_AXIS_MASK);