Provide option to repeat the M600 unload/load filament sequence
This commit is contained in:
parent
9f9bb12eeb
commit
8ceda27cda
|
|
@ -446,7 +446,7 @@ void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex);
|
||||||
void M600_load_filament();
|
void M600_load_filament();
|
||||||
void M600_load_filament_movements();
|
void M600_load_filament_movements();
|
||||||
void M600_wait_for_user();
|
void M600_wait_for_user();
|
||||||
void M600_check_state();
|
bool M600_check_state_and_repeat();
|
||||||
void load_filament_final_feed();
|
void load_filament_final_feed();
|
||||||
void marlin_wait_for_click();
|
void marlin_wait_for_click();
|
||||||
float raise_z(float delta);
|
float raise_z(float delta);
|
||||||
|
|
|
||||||
|
|
@ -3435,17 +3435,19 @@ static void gcode_M600(const bool automatic, const float x_position, const float
|
||||||
plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED);
|
plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
// Unload filament
|
bool repeat = false;
|
||||||
if (MMU2::mmu2.Enabled()) {
|
do {
|
||||||
eject_slot = MMU2::mmu2.get_current_tool();
|
// Unload filament
|
||||||
mmu_M600_unload_filament();
|
if (MMU2::mmu2.Enabled()) {
|
||||||
} else {
|
eject_slot = MMU2::mmu2.get_current_tool();
|
||||||
// Beep, manage nozzle heater and wait for user to start unload filament
|
mmu_M600_unload_filament();
|
||||||
M600_wait_for_user();
|
} else {
|
||||||
unload_filament(e_shift_late);
|
// Beep, manage nozzle heater and wait for user to start unload filament
|
||||||
}
|
M600_wait_for_user();
|
||||||
st_synchronize(); // finish moves
|
unload_filament(e_shift_late);
|
||||||
{
|
}
|
||||||
|
st_synchronize(); // finish moves
|
||||||
|
|
||||||
FSensorBlockRunout fsBlockRunout;
|
FSensorBlockRunout fsBlockRunout;
|
||||||
|
|
||||||
if (!MMU2::mmu2.Enabled())
|
if (!MMU2::mmu2.Enabled())
|
||||||
|
|
@ -3453,10 +3455,11 @@ static void gcode_M600(const bool automatic, const float x_position, const float
|
||||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||||
uint8_t choice =
|
uint8_t choice =
|
||||||
lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Was filament unload successful?"), false, LCD_LEFT_BUTTON_CHOICE); ////MSG_UNLOAD_SUCCESSFUL c=20 r=3
|
lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Was filament unload successful?"), false, LCD_LEFT_BUTTON_CHOICE); ////MSG_UNLOAD_SUCCESSFUL c=20 r=3
|
||||||
|
lcd_update_enable(false);
|
||||||
if (choice == LCD_MIDDLE_BUTTON_CHOICE) {
|
if (choice == LCD_MIDDLE_BUTTON_CHOICE) {
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_puts_at_P(0, 2, _T(MSG_PLEASE_WAIT));
|
lcd_puts_at_P(0, 2, _T(MSG_PLEASE_WAIT));
|
||||||
current_position[X_AXIS] -= 100;
|
current_position[X_AXIS] = 100;
|
||||||
plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED);
|
plan_buffer_line_curposXYZE(FILAMENTCHANGE_XYFEED);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
lcd_show_fullscreen_message_and_wait_P(_i("Please open idler and remove filament manually.")); ////MSG_CHECK_IDLER c=20 r=4
|
lcd_show_fullscreen_message_and_wait_P(_i("Please open idler and remove filament manually.")); ////MSG_CHECK_IDLER c=20 r=4
|
||||||
|
|
@ -3469,51 +3472,54 @@ static void gcode_M600(const bool automatic, const float x_position, const float
|
||||||
mmu_M600_load_filament(automatic);
|
mmu_M600_load_filament(automatic);
|
||||||
}
|
}
|
||||||
if (!automatic)
|
if (!automatic)
|
||||||
M600_check_state();
|
repeat = M600_check_state_and_repeat();
|
||||||
|
|
||||||
lcd_update_enable(true);
|
|
||||||
|
|
||||||
// Not let's go back to print
|
|
||||||
fanSpeed = saved_fan_speed;
|
|
||||||
|
|
||||||
// Feed a little of filament to stabilize pressure
|
|
||||||
if (!automatic) {
|
|
||||||
if (print_job_timer.isPaused())
|
|
||||||
{
|
|
||||||
// Return to retracted state during a pause
|
|
||||||
// @todo is retraction really needed? E-position is reverted a few lines below
|
|
||||||
current_position[E_AXIS] -= default_retraction;
|
|
||||||
plan_buffer_line_curposXYZE(FILAMENTCHANGE_RFEED);
|
|
||||||
|
|
||||||
// Cooldown the extruder again
|
|
||||||
setTargetHotend(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Feed a little of filament to stabilize pressure
|
|
||||||
current_position[E_AXIS] += FILAMENTCHANGE_RECFEED;
|
|
||||||
plan_buffer_line_curposXYZE(FILAMENTCHANGE_EXFEED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move XY back
|
|
||||||
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_XYFEED);
|
|
||||||
st_synchronize();
|
|
||||||
|
|
||||||
// Move Z back
|
|
||||||
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_ZFEED);
|
|
||||||
st_synchronize();
|
|
||||||
|
|
||||||
// Set E position to original
|
|
||||||
plan_set_e_position(saved_pos[E_AXIS]);
|
|
||||||
|
|
||||||
memcpy(current_position, saved_pos, sizeof(saved_pos));
|
|
||||||
set_destination_to_current();
|
|
||||||
|
|
||||||
// Recover feed rate
|
|
||||||
feedmultiply = saved_feedmultiply2;
|
|
||||||
enquecommandf_P(MSG_M220, saved_feedmultiply2);
|
|
||||||
}
|
}
|
||||||
|
while (repeat);
|
||||||
|
|
||||||
|
lcd_update_enable(true);
|
||||||
|
|
||||||
|
// Not let's go back to print
|
||||||
|
fanSpeed = saved_fan_speed;
|
||||||
|
|
||||||
|
// Feed a little of filament to stabilize pressure
|
||||||
|
if (!automatic) {
|
||||||
|
if (print_job_timer.isPaused())
|
||||||
|
{
|
||||||
|
// Return to retracted state during a pause
|
||||||
|
// @todo is retraction really needed? E-position is reverted a few lines below
|
||||||
|
current_position[E_AXIS] -= default_retraction;
|
||||||
|
plan_buffer_line_curposXYZE(FILAMENTCHANGE_RFEED);
|
||||||
|
|
||||||
|
// Cooldown the extruder again
|
||||||
|
setTargetHotend(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Feed a little of filament to stabilize pressure
|
||||||
|
current_position[E_AXIS] += FILAMENTCHANGE_RECFEED;
|
||||||
|
plan_buffer_line_curposXYZE(FILAMENTCHANGE_EXFEED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move XY back
|
||||||
|
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_XYFEED);
|
||||||
|
st_synchronize();
|
||||||
|
|
||||||
|
// Move Z back
|
||||||
|
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_ZFEED);
|
||||||
|
st_synchronize();
|
||||||
|
|
||||||
|
// Set E position to original
|
||||||
|
plan_set_e_position(saved_pos[E_AXIS]);
|
||||||
|
|
||||||
|
memcpy(current_position, saved_pos, sizeof(saved_pos));
|
||||||
|
set_destination_to_current();
|
||||||
|
|
||||||
|
// Recover feed rate
|
||||||
|
feedmultiply = saved_feedmultiply2;
|
||||||
|
enquecommandf_P(MSG_M220, saved_feedmultiply2);
|
||||||
|
|
||||||
if (print_job_timer.isPaused()) lcd_setstatuspgm(_T(MSG_PRINT_PAUSED));
|
if (print_job_timer.isPaused()) lcd_setstatuspgm(_T(MSG_PRINT_PAUSED));
|
||||||
else lcd_setstatuspgm(MSG_WELCOME);
|
else lcd_setstatuspgm(MSG_WELCOME);
|
||||||
custom_message_type = CustomMsg::Status;
|
custom_message_type = CustomMsg::Status;
|
||||||
|
|
@ -10970,10 +10976,10 @@ void load_filament_final_feed()
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief Wait for user to check the state
|
//! @brief Wait for user to check the state
|
||||||
void M600_check_state()
|
bool M600_check_state_and_repeat()
|
||||||
{
|
{
|
||||||
uint8_t lcd_change_filament_state = 0;
|
uint8_t lcd_change_filament_state = 10;
|
||||||
while (lcd_change_filament_state != 1)
|
while (lcd_change_filament_state != 0 && lcd_change_filament_state != 3)
|
||||||
{
|
{
|
||||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||||
lcd_change_filament_state = lcd_alright();
|
lcd_change_filament_state = lcd_alright();
|
||||||
|
|
@ -10981,7 +10987,7 @@ void M600_check_state()
|
||||||
switch(lcd_change_filament_state)
|
switch(lcd_change_filament_state)
|
||||||
{
|
{
|
||||||
// Filament failed to load so load it again
|
// Filament failed to load so load it again
|
||||||
case 2:
|
case 1:
|
||||||
if (MMU2::mmu2.Enabled()) {
|
if (MMU2::mmu2.Enabled()) {
|
||||||
uint8_t eject_slot = MMU2::mmu2.get_current_tool();
|
uint8_t eject_slot = MMU2::mmu2.get_current_tool();
|
||||||
|
|
||||||
|
|
@ -10999,19 +11005,24 @@ void M600_check_state()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Filament loaded properly but color is not clear
|
// Filament loaded properly but color is not clear
|
||||||
case 3:
|
case 2:
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
load_filament_final_feed();
|
load_filament_final_feed();
|
||||||
lcd_loading_color();
|
lcd_loading_color();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Unload filament
|
||||||
|
case 3:
|
||||||
|
return true;
|
||||||
|
|
||||||
// Everything good
|
// Everything good
|
||||||
default:
|
default:
|
||||||
lcd_change_success();
|
lcd_change_success();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief Wait for user action
|
//! @brief Wait for user action
|
||||||
|
|
@ -11096,11 +11107,9 @@ void M600_load_filament() {
|
||||||
}
|
}
|
||||||
KEEPALIVE_STATE(IN_HANDLER);
|
KEEPALIVE_STATE(IN_HANDLER);
|
||||||
|
|
||||||
M600_load_filament_movements();
|
M600_load_filament_movements();
|
||||||
|
|
||||||
Sound_MakeCustom(50,1000,false);
|
Sound_MakeCustom(50,1000,false);
|
||||||
|
|
||||||
lcd_update_enable(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2179,14 +2179,14 @@ void lcd_loading_filament() {
|
||||||
|
|
||||||
|
|
||||||
uint8_t lcd_alright() {
|
uint8_t lcd_alright() {
|
||||||
uint8_t cursor_pos = 1;
|
uint8_t cursor_pos = 0;
|
||||||
|
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_puts_at_P(0, 0, _i("Changed correctly?"));////MSG_CORRECTLY c=20
|
lcd_puts_at_P(1, 0, _i("Changed correctly"));////MSG_CORRECTLY c=20
|
||||||
lcd_puts_at_P(1, 1, _T(MSG_YES));
|
lcd_puts_at_P(1, 1, _i("Filament not loaded"));////MSG_NOT_LOADED c=19
|
||||||
lcd_puts_at_P(1, 2, _i("Filament not loaded"));////MSG_NOT_LOADED c=19
|
lcd_puts_at_P(1, 2, _i("Color not correct"));////MSG_NOT_COLOR c=19
|
||||||
lcd_puts_at_P(1, 3, _i("Color not correct"));////MSG_NOT_COLOR c=19
|
lcd_puts_at_P(1, 3, _i("Unload filament"));////MSG_UNLOAD_FILAMENT c=17
|
||||||
lcd_putc_at(0, 1, '>');
|
lcd_putc_at(0, cursor_pos, '>');
|
||||||
|
|
||||||
lcd_consume_click();
|
lcd_consume_click();
|
||||||
while (1)
|
while (1)
|
||||||
|
|
@ -2199,21 +2199,20 @@ uint8_t lcd_alright() {
|
||||||
|
|
||||||
if (lcd_encoder < 0 ) {
|
if (lcd_encoder < 0 ) {
|
||||||
// Rotating knob counter clockwise
|
// Rotating knob counter clockwise
|
||||||
cursor_pos--;
|
if (cursor_pos > 0)
|
||||||
|
cursor_pos--;
|
||||||
|
else
|
||||||
|
Sound_MakeSound(e_SOUND_TYPE_BlindAlert);
|
||||||
} else if (lcd_encoder > 0) {
|
} else if (lcd_encoder > 0) {
|
||||||
// Rotating knob clockwise
|
// Rotating knob clockwise
|
||||||
cursor_pos++;
|
if (cursor_pos < 3)
|
||||||
}
|
cursor_pos++;
|
||||||
if (cursor_pos > 3) {
|
else
|
||||||
cursor_pos = 3;
|
Sound_MakeSound(e_SOUND_TYPE_BlindAlert);
|
||||||
Sound_MakeSound(e_SOUND_TYPE_BlindAlert);
|
|
||||||
} else if (cursor_pos < 1) {
|
|
||||||
cursor_pos = 1;
|
|
||||||
Sound_MakeSound(e_SOUND_TYPE_BlindAlert);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update '>' render only
|
// Update '>' render only
|
||||||
lcd_puts_at_P(0, 1, PSTR(" \n \n "));
|
lcd_puts_at_P(0, 0, PSTR(" \n \n \n "));
|
||||||
lcd_putc_at(0, cursor_pos, '>');
|
lcd_putc_at(0, cursor_pos, '>');
|
||||||
|
|
||||||
// Consume rotation event and make feedback sound
|
// Consume rotation event and make feedback sound
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue