diff --git a/Marlin/Conditionals_LulzBot.h b/Marlin/Conditionals_LulzBot.h index 83e3088e1..d8141c0b1 100644 --- a/Marlin/Conditionals_LulzBot.h +++ b/Marlin/Conditionals_LulzBot.h @@ -13,7 +13,7 @@ * got disabled. */ -#define LULZBOT_FW_VERSION ".63" // Change this with each update +#define LULZBOT_FW_VERSION ".64" // Change this with each update #if ( \ !defined(LULZBOT_Gladiola_Mini) && \ diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index ec1e6ef64..d540c78a4 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -6354,10 +6354,6 @@ inline void gcode_M17() { KEEPALIVE_STATE(IN_HANDLER); } - #if defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) - void LULZBOT_RESTORE_ACTIVE_TOOLHEAD(); - #endif - static void resume_print(const float &load_length = 0, const float &initial_extrude_length = 0, const int8_t max_beep_count = 0) { bool nozzle_timed_out = false; @@ -6458,10 +6454,6 @@ inline void gcode_M17() { lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif - #if defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) - LULZBOT_RESTORE_ACTIVE_TOOLHEAD(); - #endif - #if ENABLED(SDSUPPORT) if (sd_print_paused) { card.startFileprint(); @@ -9725,6 +9717,7 @@ inline void gcode_M502() { * U[distance] - Retract distance for removal (negative value) (manual reload) * L[distance] - Extrude distance for insertion (positive value) (manual reload) * B[count] - Number of times to beep, -1 for indefinite (if equipped with a buzzer) + * T[toolhead] - Select extruder for filament change * * Default values are used for omitted arguments. * @@ -9736,6 +9729,18 @@ inline void gcode_M502() { if (axis_unhomed_error()) home_all_axes(); #endif + #if defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) + // Change toolhead if specified + uint8_t active_extruder_before_filament_change = -1; + if(parser.seen('T')) { + const uint8_t extruder = parser.value_byte(); + if(active_extruder != extruder) { + active_extruder_before_filament_change = active_extruder; + tool_change(extruder, 0, true); + } + } + #endif + // Initial retract before move to filament change position const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0 #ifdef PAUSE_PARK_RETRACT_LENGTH @@ -9791,6 +9796,13 @@ inline void gcode_M502() { resume_print(load_length, ADVANCED_PAUSE_EXTRUDE_LENGTH, beep_count); } + #if defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) + // Change toolhead if specified + if(active_extruder_before_filament_change != -1) { + tool_change(active_extruder_before_filament_change, 0, true); + } + #endif + // Resume the print job timer if it was running if (job_running) print_job_timer.start(); } diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 366fa9a55..d9e1da262 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -894,37 +894,16 @@ void kill_screen(const char* lcd_msg) { #if defined(LULZBOT_REORDERED_MENUS) && defined(LULZBOT_USE_LCD_DISPLAY) void lcd_configuration_menu(); void lcd_movement_menu(); - void lcd_enqueue_filament_change(); void lcd_show_custom_bootscreen(); static void lcd_store_settings(); static void lcd_load_settings(); #if defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) - - void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/); - - static uint8_t active_extruder_before_filament_change = -1; - - void lcd_enqueue_filament_change_e0() { - if (axis_unhomed_error()) {lcd_return_to_status(); return;}; - active_extruder_before_filament_change = active_extruder; - tool_change(0, 0, true); - lcd_enqueue_filament_change(); - } - - void lcd_enqueue_filament_change_e1() { - if (axis_unhomed_error()) {lcd_return_to_status(); return;}; - active_extruder_before_filament_change = active_extruder; - tool_change(1, 0, true); - lcd_enqueue_filament_change(); - } - - void LULZBOT_RESTORE_ACTIVE_TOOLHEAD() { - if(active_extruder_before_filament_change > -1) { - tool_change(active_extruder_before_filament_change, 0, true); - active_extruder_before_filament_change = -1; - } - } + void lcd_enqueue_filament_change(uint8_t); + void lcd_enqueue_filament_change_e0() {lcd_enqueue_filament_change(0);} + void lcd_enqueue_filament_change_e1() {lcd_enqueue_filament_change(1);} + #else + void lcd_enqueue_filament_change(); #endif void lcd_main_menu() { @@ -1270,10 +1249,12 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(ADVANCED_PAUSE_FEATURE) - void lcd_enqueue_filament_change() { - #if !defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) - if (axis_unhomed_error()) {lcd_return_to_status(); return;} + void lcd_enqueue_filament_change( + #if defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) + uint8_t extruder #endif + ) { + #if ENABLED(PREVENT_COLD_EXTRUSION) if (!DEBUGGING(DRYRUN) && !thermalManager.allow_cold_extrude && @@ -1285,7 +1266,11 @@ void kill_screen(const char* lcd_msg) { #endif lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT); + #if defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) + enqueue_and_echo_commands_P(extruder == 0 ? PSTR("M600 B0 T0") : PSTR("M600 B0 T1")); + #else enqueue_and_echo_commands_P(PSTR("M600 B0")); + #endif } #endif // ADVANCED_PAUSE_FEATURE @@ -2642,7 +2627,7 @@ void kill_screen(const char* lcd_msg) { // // Change filament // - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if ENABLED(ADVANCED_PAUSE_FEATURE) && !defined(LULZBOT_CHANGE_FILAMENT_DUAL_EXTRUDER_SUPPORT) if (!thermalManager.tooColdToExtrude(active_extruder) && !IS_SD_FILE_OPEN) MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change); #endif