diff --git a/.travis.yml b/.travis.yml index eb471fd11e4a..ac08fa594c0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -161,11 +161,11 @@ script: - opt_set MOTHERBOARD BOARD_MINIRAMBO - build_marlin # - # Test FILAMENT_CHANGE_FEATURE and LCD_INFO_MENU + # Test FILAMENTCHANGEENABLE, MANUAL_FILAMENT_CHANGE, and LCD_INFO_MENU # - restore_configs - opt_enable ULTIMAKERCONTROLLER - - opt_enable_adv FILAMENT_CHANGE_FEATURE LCD_INFO_MENU + - opt_enable_adv FILAMENTCHANGEENABLE MANUAL_FILAMENT_CHANGE LCD_INFO_MENU - build_marlin # # Enable filament sensor diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 3a673a673493..15d172241974 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index d17635221200..e638f5b5bcf2 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -561,7 +561,7 @@ const unsigned int dropsegments = 5; //everything with less than this number of #define FILAMENT_CHANGE_RETRACT_LENGTH 1 // Initial retract in mm // It is a short retract used immediately after print interrupt before move to filament exchange position #define FILAMENT_CHANGE_RETRACT_FEEDRATE 60 // Initial retract feedrate in mm/s - //#define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // Unload filament length from hotend in mm + #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // Unload filament length from hotend in mm // Longer length for bowden printers to unload filament from whole bowden tube, // shorter lenght for printers without bowden to unload filament from extruder only, // 0 to disable unloading for manual unloading @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index ffad119958a7..a2324b48cfc5 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 8956c41cd1eb..c458a76703e6 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index 704b20ce4066..bfca8536d07f 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 1a00bb37615e..281b2a54e703 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -581,8 +581,17 @@ const unsigned int dropsegments = 2; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index e1280f2d2ef9..809a4ccf0a1e 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 475e0335a44a..dafbbb023df9 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 8956c41cd1eb..c458a76703e6 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 894e861633e6..5b76073e90e3 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -577,8 +577,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index fba00960a25e..c3cfa0e14202 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -577,8 +577,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 7265b76284a6..a5af8027f578 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -576,8 +576,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 69eb9ce95659..e1051ad1ed44 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -581,8 +581,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index f224fd60e7a4..67db137a43c8 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -577,8 +577,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 857f320e4666..2550c9230e0d 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 69ee6e04b5c2..46f328b14e23 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -575,8 +575,17 @@ const unsigned int dropsegments = 5; //everything with less than this number of // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate - #endif -#endif + + //#define MANUAL_FILAMENT_CHANGE // Add Manual Filament Change to the LCD Menus + #if ENABLED(MANUAL_FILAMENT_CHANGE) + #define MFC_LOAD_LENGTH_CM 55 + #define MFC_NORMAL_SPEED 100 + #define MFC_SLOW_SPEED 3.5 + #endif + + #endif // FILAMENT_CHANGE_FEATURE + +#endif // ULTIPANEL /******************************************************************************\ * enable this section if you have TMC26X motor drivers. diff --git a/Marlin/language_en.h b/Marlin/language_en.h index aa9a52dfb65f..48fc57259998 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -651,4 +651,23 @@ #endif #endif // LCD_HEIGHT < 4 +#ifndef MSG_CHANGE_FILAMENT + #define MSG_CHANGE_FILAMENT "Filament" +#endif +#ifndef MSG_EJECT_FILAMENT + #define MSG_EJECT_FILAMENT "Eject" +#endif +#ifndef MSG_INSERT_FILAMENT + #define MSG_INSERT_FILAMENT "Insert" +#endif +#ifndef MSG_INSERT_FILAMENT_SLOW + #define MSG_INSERT_FILAMENT_SLOW "Slow Insert" +#endif +#ifndef MSG_STOP_EJECT + #define MSG_STOP_EJECT "Stop " MSG_EJECT_FILAMENT +#endif +#ifndef MSG_STOP_INSERT + #define MSG_STOP_INSERT "Stop " MSG_INSERT_FILAMENT +#endif + #endif // LANGUAGE_EN_H diff --git a/Marlin/language_pt-br.h b/Marlin/language_pt-br.h index cc37f31dae91..5f0d06e85214 100644 --- a/Marlin/language_pt-br.h +++ b/Marlin/language_pt-br.h @@ -170,4 +170,9 @@ #define MSG_DELTA_CALIBRATE_Z "Calibrar Z" #define MSG_DELTA_CALIBRATE_CENTER "Calibrar Centro" +#define MSG_CHANGE_FILAMENT "Filamento" +#define MSG_EJECT_FILAMENT "Retirar" +#define MSG_INSERT_FILAMENT "Inserir" +#define MSG_INSERT_FILAMENT_SLOW "Lentamente" + #endif // LANGUAGE_PT_BR_H diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index cf0b15ff3e5a..72033801f181 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -41,6 +41,12 @@ int absPreheatHotendTemp; int absPreheatHPBTemp; int absPreheatFanSpeed; +#if ENABLED(MANUAL_FILAMENT_CHANGE) + enum MFCState { MFC_IDLE, MFC_EJECTING, MFC_INSERTING, MFC_INSERTING_SLOW }; + MFCState mfc_state = MFC_IDLE; + bool mfc_filament_slow_inserting = false; +#endif + #if ENABLED(FILAMENT_LCD_DISPLAY) millis_t previous_lcd_status_ms = 0; #endif @@ -140,6 +146,11 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to static void lcd_filament_change_resume_message(); #endif + #if ENABLED(MANUAL_FILAMENT_CHANGE) + static void lcd_change_filament_menu(); + static void lcd_insert_filament(); + #endif + #if HAS_LCD_CONTRAST static void lcd_set_contrast(); #endif @@ -558,6 +569,9 @@ static void lcd_status_screen() { static void lcd_main_menu() { START_MENU(); MENU_ITEM(back, MSG_WATCH); + #if ENABLED(MANUAL_FILAMENT_CHANGE) + MENU_ITEM(submenu, MSG_CHANGE_FILAMENT, lcd_change_filament_menu); + #endif if (planner.movesplanned() || IS_SD_PRINTING) { MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu); } @@ -801,7 +815,7 @@ static void lcd_status_screen() { // // Change filament // - #if ENABLED(FILAMENT_CHANGE_FEATURE) + #if ENABLED(FILAMENT_CHANGE_FEATURE) && DISABLED(MANUAL_FILAMENT_CHANGE) MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600")); #endif @@ -1149,6 +1163,78 @@ static void lcd_status_screen() { #endif // MANUAL_BED_LEVELING + #if ENABLED(MANUAL_FILAMENT_CHANGE) + + /** + * + * "Change Filament" submenu + * + */ + + static void lcd_set_mfc_state(MFCState state) { + mfc_state = state; + lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; + defer_return_to_status = (state != MFC_IDLE); + mfc_filament_slow_inserting = (state == MFC_INSERTING_SLOW); + } + + inline void lcd_stop_mfc() { lcd_set_mfc_state(MFC_IDLE); } + + static void lcd_mfc_move(const MFCState state, const float distance, const float speed=100.0) { + lcd_set_mfc_state(state); + int count = MFC_LOAD_LENGTH_CM * 10; + #if ENABLED(DELTA) + calculate_delta(current_position); + #define MFC_DEST(axis) delta[axis] + #else + #define MFC_DEST(axis) current_position[axis] + #endif + while (mfc_state == state && count--) { + if (state == MFC_INSERTING_SLOW && !mfc_filament_slow_inserting) break; + current_position[E_AXIS] += distance; + planner.buffer_line(MFC_DEST(X_AXIS), MFC_DEST(Y_AXIS), MFC_DEST(Z_AXIS), current_position[E_AXIS], speed, active_extruder); + stepper.synchronize(); + } + lcd_stop_mfc(); + } + static void lcd_eject_filament() { lcd_mfc_move(MFC_EJECTING, -1.0, MFC_NORMAL_SPEED); } + static void lcd_insert_filament() { lcd_mfc_move(MFC_INSERTING, 1.0, MFC_NORMAL_SPEED); } + static void lcd_insert_filament_slow_callback() { + if (mfc_filament_slow_inserting) + lcd_mfc_move(MFC_INSERTING_SLOW, 1.0, MFC_SLOW_SPEED); + else + lcd_stop_mfc(); + } + + static void lcd_insert_filament_menu() { + START_MENU(); + MENU_ITEM(back, MSG_CHANGE_FILAMENT); + MENU_ITEM_EDIT_CALLBACK(bool, MSG_INSERT_FILAMENT_SLOW, &mfc_filament_slow_inserting, lcd_insert_filament_slow_callback); + if (mfc_state == MFC_IDLE) MENU_ITEM(function, MSG_INSERT_FILAMENT, lcd_insert_filament); + END_MENU(); + } + + static void lcd_change_filament_menu() { + START_MENU(); + MENU_ITEM(back, MSG_MAIN); + switch (mfc_state) { + case MFC_IDLE: + MENU_ITEM(function, MSG_EJECT_FILAMENT, lcd_eject_filament); + MENU_ITEM(submenu, MSG_INSERT_FILAMENT, lcd_insert_filament_menu); + break; + case MFC_EJECTING: + MENU_ITEM(function, MSG_STOP_EJECT, lcd_stop_mfc); + break; + case MFC_INSERTING: + case MFC_INSERTING_SLOW: + MENU_ITEM(function, MSG_STOP_INSERT, lcd_stop_mfc); + break; + } + END_MENU(); + } + + #endif // MANUAL_FILAMENT_CHANGE + /** * * "Prepare" submenu