Retry filament load on MMU load failure once.

This commit is contained in:
Marek Bel 2019-02-05 18:25:11 +01:00
parent d33b24c281
commit 6c8d9c6fb4
1 changed files with 42 additions and 28 deletions

View File

@ -1362,11 +1362,10 @@ void mmu_eject_filament(uint8_t filament, bool recover)
} }
} }
void mmu_continue_loading() static void load_more()
{ {
for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++)
if (ir_sensor_detected) { {
for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) {
if (PIN_GET(IR_SENSOR_PIN) == 0) return; if (PIN_GET(IR_SENSOR_PIN) == 0) return;
#ifdef MMU_DEBUG #ifdef MMU_DEBUG
printf_P(PSTR("Additional load attempt nr. %d\n"), i); printf_P(PSTR("Additional load attempt nr. %d\n"), i);
@ -1374,12 +1373,26 @@ void mmu_continue_loading()
mmu_command(MMU_CMD_C0); mmu_command(MMU_CMD_C0);
manage_response(true, true, MMU_LOAD_MOVE); manage_response(true, true, MMU_LOAD_MOVE);
} }
}
void mmu_continue_loading()
{
if (ir_sensor_detected)
{
load_more();
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];
mmu_command(MMU_CMD_T0 + tmp_extruder);
manage_response(true, true, MMU_TCODE_MOVE);
load_more();
if (PIN_GET(IR_SENSOR_PIN) != 0)
{
//pause print, show error message and then repeat last T-code //pause print, show error message and then repeat last T-code
stop_and_save_print_to_ram(0, 0); stop_and_save_print_to_ram(0, 0);
@ -1404,6 +1417,7 @@ void mmu_continue_loading()
isPrintPaused = true; isPrintPaused = true;
} }
} }
}
else { //mmu_ir_sensor_detected == false else { //mmu_ir_sensor_detected == false
mmu_command(MMU_CMD_C0); mmu_command(MMU_CMD_C0);
} }