M600 - Show filament name at the Insert filament prompt

This commit is contained in:
Panayiotis-git 2019-12-21 19:27:42 +02:00 committed by Panayiotis-git
parent f64f2bbe68
commit 815b68678d
4 changed files with 40 additions and 21 deletions

View File

@ -451,10 +451,10 @@ void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex);
#define UVLO !(PINE & (1<<4)) #define UVLO !(PINE & (1<<4))
void M600_load_filament(); void M600_load_filament(const char* filament_name);
void M600_load_filament_movements(); void M600_load_filament_movements(const char* filament_name);
void M600_wait_for_user(); void M600_wait_for_user();
bool M600_check_state_and_repeat(); bool M600_check_state_and_repeat(const char* filament_name);
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);

View File

@ -3387,7 +3387,7 @@ static void mmu_M600_load_filament(bool automatic) {
st_synchronize(); st_synchronize();
} }
static void gcode_M600(const bool automatic, const float x_position, const float y_position, const float z_shift, const float e_shift, const float e_shift_late) { static void gcode_M600(const bool automatic, const float x_position, const float y_position, const float z_shift, const float e_shift, const float e_shift_late, const char* filament_name) {
st_synchronize(); st_synchronize();
// When using an MMU, save the currently use slot number // When using an MMU, save the currently use slot number
@ -3450,7 +3450,7 @@ static void gcode_M600(const bool automatic, const float x_position, const float
st_synchronize(); st_synchronize();
lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHECK_IDLER)); lcd_show_fullscreen_message_and_wait_P(_T(MSG_CHECK_IDLER));
} }
M600_load_filament(); M600_load_filament(filament_name);
} }
else // MMU is enabled else // MMU is enabled
{ {
@ -3458,7 +3458,7 @@ 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)
repeat = M600_check_state_and_repeat(); repeat = M600_check_state_and_repeat(filament_name);
} }
while (repeat); while (repeat);
@ -7641,9 +7641,10 @@ Sigma_Exit:
- `Z` - relative lift Z, default MIN_Z_FOR_SWAP. - `Z` - relative lift Z, default MIN_Z_FOR_SWAP.
- `E` - initial retract, default FILAMENTCHANGE_FIRSTRETRACT - `E` - initial retract, default FILAMENTCHANGE_FIRSTRETRACT
- `L` - later retract distance for removal, default FILAMENTCHANGE_FINALRETRACT - `L` - later retract distance for removal, default FILAMENTCHANGE_FINALRETRACT
- `C` - filament name to show during loading
- `AUTO` - Automatically (only with MMU) - `AUTO` - Automatically (only with MMU)
*/ */
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] C"[filament name to show during loading]"
{ {
st_synchronize(); st_synchronize();
@ -7669,10 +7670,20 @@ Sigma_Exit:
if (code_seen('X')) x_position = code_value(); if (code_seen('X')) x_position = code_value();
if (code_seen('Y')) y_position = code_value(); if (code_seen('Y')) y_position = code_value();
// Filament name to show during the loading
char filament_name[LCD_WIDTH + 1] = "";
if (code_seen('C')) {
unquoted_string str = unquoted_string(strchr_pointer);
if (str.WasFound()) {
const uint8_t len = min(str.GetLength(), LCD_WIDTH);
memcpy(filament_name, str.GetUnquotedString(), len);
}
}
if (MMU2::mmu2.Enabled() && code_seen_P(PSTR("AUTO"))) if (MMU2::mmu2.Enabled() && code_seen_P(PSTR("AUTO")))
automatic = true; automatic = true;
gcode_M600(automatic, x_position, y_position, z_shift, e_shift_init, e_shift_late); gcode_M600(automatic, x_position, y_position, z_shift, e_shift_init, e_shift_late, filament_name);
// From this point forward, power panic should not use // From this point forward, power panic should not use
// the partial backup in RAM since the extruder is no // the partial backup in RAM since the extruder is no
@ -10899,7 +10910,7 @@ void load_filament_final_feed()
} }
//! @brief Wait for user to check the state //! @brief Wait for user to check the state
bool M600_check_state_and_repeat() bool M600_check_state_and_repeat(const char* filament_name)
{ {
uint8_t lcd_change_filament_state = 10; uint8_t lcd_change_filament_state = 10;
while (lcd_change_filament_state != 0 && lcd_change_filament_state != 3) while (lcd_change_filament_state != 0 && lcd_change_filament_state != 3)
@ -10923,7 +10934,7 @@ bool M600_check_state_and_repeat()
// After user clicks knob, MMU will load the filament // After user clicks knob, MMU will load the filament
mmu_M600_load_filament(false); mmu_M600_load_filament(false);
} else { } else {
M600_load_filament_movements(); M600_load_filament_movements(filament_name);
} }
break; break;
@ -11001,18 +11012,18 @@ void M600_wait_for_user() {
sound_wait_for_user_reset(); sound_wait_for_user_reset();
} }
void M600_load_filament_movements() void M600_load_filament_movements(const char* filament_name)
{ {
current_position[E_AXIS]+= FILAMENTCHANGE_FIRSTFEED; current_position[E_AXIS]+= FILAMENTCHANGE_FIRSTFEED;
plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FIRST); plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FIRST);
load_filament_final_feed(); load_filament_final_feed();
lcd_loading_filament(); lcd_loading_filament(filament_name);
st_synchronize(); st_synchronize();
} }
void M600_load_filament() { void M600_load_filament(const char* filament_name) {
//load filament for single material and MMU //load filament for single material and MMU
lcd_wait_interact(); lcd_wait_interact(filament_name);
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
@ -11029,7 +11040,7 @@ void M600_load_filament() {
} }
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
M600_load_filament_movements(); M600_load_filament_movements(filament_name);
Sound_MakeCustom(50,1000,false); Sound_MakeCustom(50,1000,false);
} }

View File

@ -2141,16 +2141,21 @@ static void lcd_unLoadFilament()
preheat_or_continue(FilamentAction::UnLoad); preheat_or_continue(FilamentAction::UnLoad);
} }
void lcd_wait_interact() { void lcd_wait_interact(const char* filament_name) {
lcd_clear(); lcd_clear();
lcd_puts_at_P(0, 0, _T(MSG_INSERT_FILAMENT)); lcd_puts_at_P(0, 0, _T(MSG_INSERT_FILAMENT));
lcd_set_cursor(0, 1);
if (filament_name[0]) {
lcd_print(filament_name);
lcd_set_cursor(0, 2);
}
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (!fsensor.getAutoLoadEnabled()) if (!fsensor.getAutoLoadEnabled())
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
{ {
lcd_puts_at_P(0, 1, _T(MSG_PRESS)); lcd_puts_P(_T(MSG_PRESS));
} }
} }
@ -2187,12 +2192,15 @@ void lcd_loading_color() {
} }
void lcd_loading_filament() { void lcd_loading_filament(const char* filament_name) {
lcd_clear(); lcd_clear();
lcd_puts_at_P(0, 0, _T(MSG_LOADING_FILAMENT)); lcd_puts_at_P(0, 0, _T(MSG_LOADING_FILAMENT));
if (filament_name[0]) {
lcd_set_cursor(0, 1);
lcd_print(filament_name);
}
lcd_puts_at_P(0, 2, _T(MSG_PLEASE_WAIT)); lcd_puts_at_P(0, 2, _T(MSG_PLEASE_WAIT));
uint16_t slow_seq_time = (FILAMENTCHANGE_FINALFEED * 1000ul) / FILAMENTCHANGE_EFEED_FINAL; uint16_t slow_seq_time = (FILAMENTCHANGE_FINALFEED * 1000ul) / FILAMENTCHANGE_EFEED_FINAL;
uint16_t fast_seq_time = (FILAMENTCHANGE_FIRSTFEED * 1000ul) / FILAMENTCHANGE_EFEED_FIRST; uint16_t fast_seq_time = (FILAMENTCHANGE_FIRSTFEED * 1000ul) / FILAMENTCHANGE_EFEED_FIRST;

View File

@ -49,8 +49,8 @@ void lcd_reset_alert_level();
uint8_t lcd_alright(); uint8_t lcd_alright();
void show_preheat_nozzle_warning(); void show_preheat_nozzle_warning();
void lcd_wait_interact(); void lcd_wait_interact(const char* filament_name);
void lcd_loading_filament(); void lcd_loading_filament(const char* filament_name);
void lcd_change_success(); void lcd_change_success();
void lcd_loading_color(); void lcd_loading_color();
void lcd_sdcard_stop(); void lcd_sdcard_stop();