From 27c861236016ccbc449ad54e3a280b8fe3297bd5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 17 Dec 2018 21:25:07 +0100 Subject: [PATCH] use just short movement for unloading filament --- Firmware/mmu.cpp | 14 ++++++-------- Firmware/mmu.h | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 948113821..2be8b1d2a 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -377,13 +377,6 @@ void mmu_load_step() { plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); st_synchronize(); } - -void mmu_unload_step() { - current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * 0.1; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); - st_synchronize(); -} - bool mmu_get_response(uint8_t move) { printf_P(PSTR("mmu_get_response - begin move:%d\n"), move); @@ -406,7 +399,11 @@ bool mmu_get_response(uint8_t move) mmu_load_step(); break; case MMU_UNLOAD_MOVE: - mmu_unload_step(); + current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * MMU_LOAD_TIME; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + st_synchronize(); + disable_e0(); //turn off E-stepper to prevent overheating and alow filament pull-out if necessary + move = MMU_NO_MOVE; break; case MMU_TCODE_MOVE: //first do unload and then continue with infinite loading current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * MMU_LOAD_TIME; @@ -414,6 +411,7 @@ bool mmu_get_response(uint8_t move) st_synchronize(); move = MMU_LOAD_MOVE; break; + case MMU_NO_MOVE: default: delay_keep_alive(100); break; diff --git a/Firmware/mmu.h b/Firmware/mmu.h index f19cbdbf9..88ba047a8 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -17,6 +17,7 @@ extern int16_t mmu_buildnr; #define MMU_FILAMENT_UNKNOWN 255 +#define MMU_NO_MOVE 0 #define MMU_UNLOAD_MOVE 1 #define MMU_LOAD_MOVE 2 #define MMU_TCODE_MOVE 3