Merge pull request #1594 from mkbel/fix_change_filament

Fix change filament
This commit is contained in:
PavelSindler 2019-03-12 11:39:15 +01:00 committed by GitHub
commit 4d2b155ff9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 62 deletions

View File

@ -496,5 +496,5 @@ void proc_commands();
void M600_load_filament();
void M600_load_filament_movements();
void M600_wait_for_user(float HotendTempBckp);
void M600_check_state();
void M600_check_state(float nozzle_temp);
void load_filament_final_feed();

View File

@ -3055,12 +3055,12 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
manage_response(false, false);
}
}
mmu_M600_load_filament(automatic);
mmu_M600_load_filament(automatic, HotendTempBckp);
}
else
M600_load_filament();
if (!automatic) M600_check_state();
if (!automatic) M600_check_state(HotendTempBckp);
lcd_update_enable(true);
@ -9109,38 +9109,41 @@ void load_filament_final_feed()
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EFEED_FINAL, active_extruder);
}
void M600_check_state()
//! @brief Wait for user to check the state
//! @par nozzle_temp nozzle temperature to load filament
void M600_check_state(float nozzle_temp)
{
//Wait for user to check the state
lcd_change_fil_state = 0;
while (lcd_change_fil_state != 1){
lcd_change_fil_state = 0;
KEEPALIVE_STATE(PAUSED_FOR_USER);
lcd_alright();
KEEPALIVE_STATE(IN_HANDLER);
switch(lcd_change_fil_state){
// Filament failed to load so load it again
case 2:
if (mmu_enabled)
mmu_M600_load_filament(false); //nonautomatic load; change to "wrong filament loaded" option?
else
M600_load_filament_movements();
break;
lcd_change_fil_state = 0;
while (lcd_change_fil_state != 1)
{
lcd_change_fil_state = 0;
KEEPALIVE_STATE(PAUSED_FOR_USER);
lcd_alright();
KEEPALIVE_STATE(IN_HANDLER);
switch(lcd_change_fil_state)
{
// Filament failed to load so load it again
case 2:
if (mmu_enabled)
mmu_M600_load_filament(false, nozzle_temp); //nonautomatic load; change to "wrong filament loaded" option?
else
M600_load_filament_movements();
break;
// Filament loaded properly but color is not clear
case 3:
st_synchronize();
load_filament_final_feed();
lcd_loading_color();
st_synchronize();
break;
// Filament loaded properly but color is not clear
case 3:
st_synchronize();
load_filament_final_feed();
lcd_loading_color();
st_synchronize();
break;
// Everything good
default:
lcd_change_success();
break;
}
}
// Everything good
default:
lcd_change_success();
break;
}
}
}
//! @brief Wait for user action

View File

@ -830,37 +830,43 @@ void mmu_M600_wait_and_beep() {
WRITE(BEEPER, LOW);
}
void mmu_M600_load_filament(bool automatic)
//! @brief load filament for mmu v2
//! @par nozzle_temp nozzle temperature to load filament
void mmu_M600_load_filament(bool automatic, float nozzle_temp)
{
//load filament for mmu v2
tmp_extruder = mmu_extruder;
if (!automatic) {
#ifdef MMU_M600_SWITCH_EXTRUDER
bool yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false);
if(yes) tmp_extruder = choose_extruder_menu();
#endif //MMU_M600_SWITCH_EXTRUDER
}
else {
tmp_extruder = ad_getAlternative(tmp_extruder);
}
lcd_update_enable(false);
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT));
lcd_print(" ");
lcd_print(tmp_extruder + 1);
snmm_filaments_used |= (1 << tmp_extruder); //for stop print
tmp_extruder = mmu_extruder;
if (!automatic)
{
#ifdef MMU_M600_SWITCH_EXTRUDER
bool yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false);
if(yes) tmp_extruder = choose_extruder_menu();
#endif //MMU_M600_SWITCH_EXTRUDER
}
else
{
tmp_extruder = ad_getAlternative(tmp_extruder);
}
lcd_update_enable(false);
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT));
lcd_print(" ");
lcd_print(tmp_extruder + 1);
snmm_filaments_used |= (1 << tmp_extruder); //for stop print
// printf_P(PSTR("T code: %d \n"), tmp_extruder);
// mmu_printf_P(PSTR("T%d\n"), tmp_extruder);
mmu_command(MmuCmd::T0 + tmp_extruder);
//printf_P(PSTR("T code: %d \n"), tmp_extruder);
//mmu_printf_P(PSTR("T%d\n"), tmp_extruder);
setTargetHotend(nozzle_temp,active_extruder);
mmu_wait_for_heater_blocking();
manage_response(false, true, MMU_LOAD_MOVE);
mmu_continue_loading();
mmu_extruder = tmp_extruder; //filament change is finished
mmu_command(MmuCmd::T0 + tmp_extruder);
mmu_load_to_nozzle();
load_filament_final_feed();
st_synchronize();
manage_response(false, true, MMU_LOAD_MOVE);
mmu_continue_loading();
mmu_extruder = tmp_extruder; //filament change is finished
mmu_load_to_nozzle();
load_filament_final_feed();
st_synchronize();
}

View File

@ -97,7 +97,7 @@ extern void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move =
extern void mmu_load_to_nozzle();
extern void mmu_M600_load_filament(bool automatic);
extern void mmu_M600_load_filament(bool automatic, float nozzle_temp);
extern void mmu_M600_wait_and_beep();
extern void extr_mov(float shift, float feed_rate);