Retry filament load on MMU load failure once.
This commit is contained in:
parent
d33b24c281
commit
6c8d9c6fb4
|
|
@ -1362,46 +1362,60 @@ void mmu_eject_filament(uint8_t filament, bool recover)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void load_more()
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++)
|
||||||
|
{
|
||||||
|
if (PIN_GET(IR_SENSOR_PIN) == 0) return;
|
||||||
|
#ifdef MMU_DEBUG
|
||||||
|
printf_P(PSTR("Additional load attempt nr. %d\n"), i);
|
||||||
|
#endif // MMU_DEBUG
|
||||||
|
mmu_command(MMU_CMD_C0);
|
||||||
|
manage_response(true, true, MMU_LOAD_MOVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void mmu_continue_loading()
|
void mmu_continue_loading()
|
||||||
{
|
{
|
||||||
|
if (ir_sensor_detected)
|
||||||
|
{
|
||||||
|
load_more();
|
||||||
|
|
||||||
if (ir_sensor_detected) {
|
|
||||||
for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) {
|
|
||||||
if (PIN_GET(IR_SENSOR_PIN) == 0) return;
|
|
||||||
#ifdef MMU_DEBUG
|
|
||||||
printf_P(PSTR("Additional load attempt nr. %d\n"), i);
|
|
||||||
#endif // MMU_DEBUG
|
|
||||||
mmu_command(MMU_CMD_C0);
|
|
||||||
manage_response(true, true, MMU_LOAD_MOVE);
|
|
||||||
}
|
|
||||||
if (PIN_GET(IR_SENSOR_PIN) != 0) {
|
if (PIN_GET(IR_SENSOR_PIN) != 0) {
|
||||||
uint8_t mmu_load_fail = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL);
|
uint8_t mmu_load_fail = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL);
|
||||||
uint16_t mmu_load_fail_tot = eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT);
|
uint16_t mmu_load_fail_tot = eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT);
|
||||||
if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1);
|
if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1);
|
||||||
if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1);
|
if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1);
|
||||||
char cmd[3];
|
|
||||||
//pause print, show error message and then repeat last T-code
|
|
||||||
stop_and_save_print_to_ram(0, 0);
|
|
||||||
|
|
||||||
//lift z
|
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
||||||
current_position[Z_AXIS] += Z_PAUSE_LIFT;
|
manage_response(true, true, MMU_TCODE_MOVE);
|
||||||
if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
|
load_more();
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
|
|
||||||
st_synchronize();
|
|
||||||
|
|
||||||
//Move XY to side
|
if (PIN_GET(IR_SENSOR_PIN) != 0)
|
||||||
current_position[X_AXIS] = X_PAUSE_POS;
|
{
|
||||||
current_position[Y_AXIS] = Y_PAUSE_POS;
|
//pause print, show error message and then repeat last T-code
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
|
stop_and_save_print_to_ram(0, 0);
|
||||||
st_synchronize();
|
|
||||||
|
|
||||||
mmu_command(MMU_CMD_U0);
|
//lift z
|
||||||
manage_response(false, true, MMU_UNLOAD_MOVE);
|
current_position[Z_AXIS] += Z_PAUSE_LIFT;
|
||||||
|
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);
|
||||||
|
st_synchronize();
|
||||||
|
|
||||||
setAllTargetHotends(0);
|
//Move XY to side
|
||||||
lcd_setstatuspgm(_i("MMU load failed "));////MSG_RECOVERING_PRINT c=20 r=1
|
current_position[X_AXIS] = X_PAUSE_POS;
|
||||||
mmu_fil_loaded = false; //so we can retry same T-code again
|
current_position[Y_AXIS] = Y_PAUSE_POS;
|
||||||
isPrintPaused = true;
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
|
||||||
|
st_synchronize();
|
||||||
|
|
||||||
|
mmu_command(MMU_CMD_U0);
|
||||||
|
manage_response(false, true, MMU_UNLOAD_MOVE);
|
||||||
|
|
||||||
|
setAllTargetHotends(0);
|
||||||
|
lcd_setstatuspgm(_i("MMU load failed "));////MSG_RECOVERING_PRINT c=20 r=1
|
||||||
|
mmu_fil_loaded = false; //so we can retry same T-code again
|
||||||
|
isPrintPaused = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { //mmu_ir_sensor_detected == false
|
else { //mmu_ir_sensor_detected == false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue