From 6cb85a455f307105ac3e777022510cb277f3443c Mon Sep 17 00:00:00 2001 From: KDanielK Date: Fri, 14 Jun 2019 18:28:11 +0200 Subject: [PATCH] Update mmu.cpp --- Firmware/mmu.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index fa4a5517..5deb466d 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1462,11 +1462,20 @@ static void load_more() mmu_command(MmuCmd::C0); manage_response(true, true, MMU_LOAD_MOVE); } - current_position[E_AXIS] += 60; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); - current_position[E_AXIS] -= 58; - 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(); + uint8_t retries = 3; + do + {//We will retry the load to nozzle three times since it most of the time fails due to a bad tip and not a clog + current_position[E_AXIS] += 60; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + current_position[E_AXIS] -= 58; + 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(); + if(PIN_GET(IR_SENSOR_PIN) != 0) + {//Adjust position so we are back at zero if sensor isn't detecting filament but dont do the actual movement + current_position[E_AXIS] -= 2; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder); + } + }while(PIN_GET(IR_SENSOR_PIN) != 0 && retries-- > 0); } static void increment_load_fail()