diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 9fd98ac1..36ba1acf 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -478,3 +478,4 @@ void M600_load_filament(); void M600_load_filament_movements(); void M600_wait_for_user(float HotendTempBckp); void M600_check_state(); +void load_filament_final_feed(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0f117f5b..4821be81 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3025,6 +3025,8 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float } + + void gcode_M701() { printf_P(PSTR("gcode_M701 begin\n")); @@ -3051,28 +3053,15 @@ void gcode_M701() if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; current_position[E_AXIS] += 30; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence - st_synchronize(); - current_position[E_AXIS] += 25; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence - st_synchronize(); + + load_filament_final_feed(); //slow sequence if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) tone(BEEPER, 500); delay_keep_alive(50); noTone(BEEPER); if (!farm_mode && loading_flag) { - bool clean = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_FILAMENT_CLEAN), false, true); - - while (!clean) { - lcd_update_enable(true); - lcd_update(2); - current_position[E_AXIS] += 25; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence - st_synchronize(); - clean = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_FILAMENT_CLEAN), false, true); - - } - + lcd_load_filament_color_check(); } lcd_update_enable(true); lcd_update(2); @@ -6773,17 +6762,23 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) break; case 702: //! M702 [U C] - { - if (mmu_enabled) - { - if (code_seen('U')) - extr_unload_used(); //! if "U" unload all filaments which were used in current print - else if (code_seen('C')) - extr_unload(); //! if "C" unload just current filament - else - extr_unload_all(); //! otherwise unload all filaments - } +#ifdef SNMM + if (code_seen('U')) + extr_unload_used(); //! if "U" unload all filaments which were used in current print + else if (code_seen('C')) + extr_unload(); //! if "C" unload just current filament else - unload_filament(); + extr_unload_all(); //! otherwise unload all filaments +#else + if (code_seen('C')) { + if(mmu_enabled) extr_unload(); //! if "C" unload current filament; if mmu is not present no action is performed + } + else { + if(mmu_enabled) extr_unload(); //! unload current filament + else unload_filament(); + } + +#endif //SNMM } break; @@ -6799,7 +6794,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) // printf_P(_N("END M-CODE=%u\n"), mcode_in_progress); mcode_in_progress = 0; } - } // end if(code_seen('M')) (end of M codes) + } + // end if(code_seen('M')) (end of M codes) //! T - select extruder in case of multi extruder printer //! select filament in case of MMU_V2 //! if extruder is "?", open menu to let the user select extruder/filament @@ -6813,9 +6809,27 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) st_synchronize(); for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++); - if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '4') && *(strchr_pointer + index) != '?') { + *(strchr_pointer + index) = tolower(*(strchr_pointer + index)); + + if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '4') && *(strchr_pointer + index) != '?' && *(strchr_pointer + index) != 'x' && *(strchr_pointer + index) != 'c') { SERIAL_ECHOLNPGM("Invalid T code."); } + else if (*(strchr_pointer + index) == 'x'){ //load to bondtech gears; if mmu is not present do nothing + if (mmu_enabled) + { + tmp_extruder = choose_menu_P(_T(MSG_CHOOSE_FILAMENT), _T(MSG_FILAMENT)); + mmu_command(MMU_CMD_T0 + tmp_extruder); + manage_response(true, true); + } + } + else if (*(strchr_pointer + index) == 'c') { //load to from bondtech gears to nozzle (nozzle should be preheated) + if (mmu_enabled) + { + mmu_command(MMU_CMD_C0); + mmu_extruder = tmp_extruder; //filament change is finished + mmu_load_to_nozzle(); + } + } else { if (*(strchr_pointer + index) == '?') { @@ -7362,13 +7376,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s else { lcd_update_enable(false); - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - delay(2000); - lcd_clear(); + show_preheat_nozzle_warning(); lcd_update_enable(true); } } @@ -8910,6 +8918,14 @@ static void print_time_remaining_init() print_percent_done_silent = PRINT_PERCENT_DONE_INIT; } +void load_filament_final_feed() +{ + st_synchronize(); + current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 200/60, active_extruder); + st_synchronize(); +} + void M600_check_state() { //Wait for user to check the state @@ -8930,8 +8946,9 @@ void M600_check_state() // Filament loaded properly but color is not clear case 3: - current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED ; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2, active_extruder); + st_synchronize(); + current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 200/60, active_extruder); lcd_loading_color(); break; @@ -9050,8 +9067,7 @@ void M600_load_filament_movements() current_position[E_AXIS]+= FILAMENTCHANGE_FIRSTFEED ; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EFEED, active_extruder); #endif - current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED ; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder); + load_filament_final_feed(); lcd_loading_filament(); } diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 368d051a..92d13835 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -572,13 +572,8 @@ void mmu_M600_load_filament(bool automatic) manage_response(false, true); mmu_command(MMU_CMD_C0); mmu_extruder = tmp_extruder; //filament change is finished - mmu_load_to_nozzle(); - - - st_synchronize(); - current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED ; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2, active_extruder); + load_filament_final_feed(); } @@ -839,13 +834,7 @@ void extr_unload() } else { - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - delay(2000); - lcd_clear(); + show_preheat_nozzle_warning(); } //lcd_return_to_status(); } @@ -901,6 +890,31 @@ void extr_adj_4() #endif } +void mmu_load_to_nozzle_0() +{ + lcd_mmu_load_to_nozzle(0); +} + +void mmu_load_to_nozzle_1() +{ + lcd_mmu_load_to_nozzle(1); +} + +void mmu_load_to_nozzle_2() +{ + lcd_mmu_load_to_nozzle(2); +} + +void mmu_load_to_nozzle_3() +{ + lcd_mmu_load_to_nozzle(3); +} + +void mmu_load_to_nozzle_4() +{ + lcd_mmu_load_to_nozzle(4); +} + void mmu_eject_fil_0() { mmu_eject_filament(0, true); @@ -968,6 +982,7 @@ void extr_change_3() lcd_return_to_status(); } +#ifdef SNMM //wrapper functions for unloading filament void extr_unload_all() { @@ -981,13 +996,7 @@ void extr_unload_all() } else { - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - delay(2000); - lcd_clear(); + show_preheat_nozzle_warning(); lcd_return_to_status(); } } @@ -1005,16 +1014,11 @@ void extr_unload_used() snmm_filaments_used = 0; } else { - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - delay(2000); - lcd_clear(); + show_preheat_nozzle_warning(); lcd_return_to_status(); } } +#endif //SNMM void extr_unload_0() { @@ -1057,6 +1061,36 @@ void mmu_show_warning() kill(_i("Please update firmware in your MMU2. Waiting for reset.")); } +void lcd_mmu_load_to_nozzle(uint8_t filament_nr) +{ + if (degHotend0() > EXTRUDE_MINTEMP) + { + tmp_extruder = filament_nr; + 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); + mmu_command(MMU_CMD_T0 + tmp_extruder); + manage_response(true, true); + mmu_command(MMU_CMD_C0); + mmu_extruder = tmp_extruder; //filament change is finished + mmu_load_to_nozzle(); + load_filament_final_feed(); + custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; + lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); + lcd_return_to_status(); + lcd_update_enable(true); + lcd_load_filament_color_check(); + lcd_setstatuspgm(_T(WELCOME_MSG)); + custom_message_type = CUSTOM_MSG_TYPE_STATUS; + } + else + { + show_preheat_nozzle_warning(); + } +} + void mmu_eject_filament(uint8_t filament, bool recover) { if (filament < 5) @@ -1086,13 +1120,7 @@ void mmu_eject_filament(uint8_t filament, bool recover) } else { - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - delay(2000); - lcd_clear(); + show_preheat_nozzle_warning(); } } else diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 7ca5e25a..2071891e 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -74,13 +74,20 @@ extern void extr_adj_1(); extern void extr_adj_2(); extern void extr_adj_3(); extern void extr_adj_4(); +extern void mmu_load_to_nozzle_0(); +extern void mmu_load_to_nozzle_1(); +extern void mmu_load_to_nozzle_2(); +extern void mmu_load_to_nozzle_3(); +extern void mmu_load_to_nozzle_4(); extern void load_all(); extern void extr_change_0(); extern void extr_change_1(); extern void extr_change_2(); extern void extr_change_3(); +#ifdef SNMM extern void extr_unload_all(); extern void extr_unload_used(); +#endif //SNMM extern void extr_unload_0(); extern void extr_unload_1(); extern void extr_unload_2(); @@ -89,6 +96,7 @@ extern void extr_unload_4(); extern bool mmu_check_version(); extern void mmu_show_warning(); +extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr); extern void mmu_eject_filament(uint8_t filament, bool recover); extern void mmu_eject_fil_0(); extern void mmu_eject_fil_1(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3aa1256c..e6dfe957 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -113,7 +113,6 @@ static const char* lcd_display_message_fullscreen_nonBlocking_P(const char *msg, /* Different menus */ static void lcd_status_screen(); static void lcd_language_menu(); - static void lcd_main_menu(); static void lcd_tune_menu(); //static void lcd_move_menu(); @@ -2224,15 +2223,7 @@ void lcd_unLoadFilament() enquecommand_P(PSTR("M702")); //unload filament } else { - - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - - delay(2000); - lcd_clear(); + show_preheat_nozzle_warning(); } menu_back(); @@ -2279,6 +2270,7 @@ void lcd_change_success() { void lcd_loading_color() { + //we are extruding 25mm with feedrate 200mm/min -> 7.5 seconds for whole action, 0.375 s for one character lcd_clear(); @@ -2293,10 +2285,11 @@ void lcd_loading_color() { lcd_set_cursor(i, 3); lcd_print("."); - for (int j = 0; j < 10 ; j++) { + //0.375 s delay: + for (int j = 0; j < 5 ; j++) { manage_heater(); manage_inactivity(true); - delay(85); + delay(75); } @@ -2428,6 +2421,28 @@ void lcd_alright() { } +void show_preheat_nozzle_warning() +{ + lcd_clear(); + lcd_set_cursor(0, 0); + lcd_puts_P(_T(MSG_ERROR)); + lcd_set_cursor(0, 2); + lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); + delay(2000); + lcd_clear(); +} + +void lcd_load_filament_color_check() +{ + bool clean = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_FILAMENT_CLEAN), false, true); + while (!clean) { + lcd_update_enable(true); + lcd_update(2); + load_filament_final_feed(); + clean = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_FILAMENT_CLEAN), false, true); + } +} + #ifdef FILAMENT_SENSOR static void lcd_menu_AutoLoadFilament() { @@ -2463,17 +2478,11 @@ static void lcd_LoadFilament() } else { - - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - delay(2000); - lcd_clear(); + show_preheat_nozzle_warning(); } } + //! @brief Show filament used a print time //! //! If printing current print statistics are shown @@ -2622,12 +2631,7 @@ static void lcd_move_e() } else { - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - delay(2000); + show_preheat_nozzle_warning(); lcd_return_to_status(); } } @@ -4308,13 +4312,7 @@ void lcd_calibrate_pinda() { } else { - lcd_clear(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - delay(2000); - lcd_clear(); + show_preheat_nozzle_warning(); } lcd_return_to_status(); } @@ -5204,8 +5202,6 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite } } -//#endif - char reset_menu() { #ifdef SNMM int items_no = 5; @@ -5303,6 +5299,8 @@ static void lcd_disable_farm_mode() } + + static void fil_load_menu() { MENU_BEGIN(); @@ -5319,6 +5317,18 @@ static void fil_load_menu() MENU_END(); } +static void mmu_load_to_nozzle_menu() +{ + MENU_BEGIN(); + MENU_ITEM_BACK_P(_T(MSG_MAIN)); + MENU_ITEM_FUNCTION_P(_i("Load filament 1"), mmu_load_to_nozzle_0); + MENU_ITEM_FUNCTION_P(_i("Load filament 2"), mmu_load_to_nozzle_1); + MENU_ITEM_FUNCTION_P(_i("Load filament 3"), mmu_load_to_nozzle_2); + MENU_ITEM_FUNCTION_P(_i("Load filament 4"), mmu_load_to_nozzle_3); + MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle_4); + MENU_END(); +} + static void mmu_fil_eject_menu() { MENU_BEGIN(); @@ -5332,6 +5342,7 @@ static void mmu_fil_eject_menu() MENU_END(); } +#ifdef SNMM static void fil_unload_menu() { MENU_BEGIN(); @@ -5348,6 +5359,7 @@ static void fil_unload_menu() MENU_END(); } + static void change_extr_menu(){ MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); @@ -5358,7 +5370,7 @@ static void change_extr_menu(){ MENU_END(); } - +#endif //SNMM //unload filament for single material printer (used in M702 gcode) void unload_filament() @@ -5792,17 +5804,16 @@ static void lcd_main_menu() if (mmu_enabled) { MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); + MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); - if (mmu_enabled) - MENU_ITEM_GCODE_P(_T(MSG_UNLOAD_FILAMENT), PSTR("M702 C")); - else - { - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), fil_unload_menu); - MENU_ITEM_SUBMENU_P(_i("Change extruder"), change_extr_menu);////MSG_CHANGE_EXTR c=20 r=1 - } + MENU_ITEM_GCODE_P(_T(MSG_UNLOAD_FILAMENT), PSTR("M702 C")); } else { +#ifdef SNMM + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), fil_unload_menu); + MENU_ITEM_SUBMENU_P(_i("Change extruder"), change_extr_menu);////MSG_CHANGE_EXTR c=20 r=1 +#endif #ifdef FILAMENT_SENSOR if ((fsensor_autoload_enabled == true) && (fsensor_enabled == true) && (mmu_enabled == false)) MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=17 r=0 diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index aeb29c28..c7c9bea0 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -24,6 +24,7 @@ uint8_t get_message_level(); void lcd_adjust_z(); void lcd_pick_babystep(); void lcd_alright(); +void show_preheat_nozzle_warning(); void EEPROM_save_B(int pos, int* value); void EEPROM_read_B(int pos, int* value); void lcd_wait_interact(); @@ -38,6 +39,7 @@ void lcd_print_stop(); void prusa_statistics(int _message, uint8_t _col_nr = 0); void lcd_confirm_print(); unsigned char lcd_choose_color(); +void lcd_load_filament_color_check(); //void lcd_mylang(); extern bool lcd_selftest(); @@ -127,8 +129,10 @@ void lcd_commands(); void change_extr(int extr); void extr_adj(int extruder); +#ifdef SNMM void extr_unload_all(); void extr_unload_used(); +#endif //SNMM void extr_unload(); void unload_filament(); diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index 873be04e..e2c0eb4c 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -221,7 +221,7 @@ #define FILAMENTCHANGE_FINALRETRACT -80 #define FILAMENTCHANGE_FIRSTFEED 70 -#define FILAMENTCHANGE_FINALFEED 50 +#define FILAMENTCHANGE_FINALFEED 25 #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index fc17446d..704b8c70 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -222,7 +222,7 @@ #define FILAMENTCHANGE_FINALRETRACT -80 #define FILAMENTCHANGE_FIRSTFEED 70 -#define FILAMENTCHANGE_FINALFEED 50 +#define FILAMENTCHANGE_FINALFEED 25 #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50 diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index f47a17dc..50987c6d 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -340,7 +340,7 @@ #define FILAMENTCHANGE_FINALRETRACT -80 #define FILAMENTCHANGE_FIRSTFEED 70 -#define FILAMENTCHANGE_FINALFEED 50 +#define FILAMENTCHANGE_FINALFEED 25 #define FILAMENTCHANGE_RECFEED 5 #define FILAMENTCHANGE_XYFEED 50