瀏覽代碼

Add a Try-Load-to-Bondtech operation

PFW-1347
D.R.racer 2 年之前
父節點
當前提交
121d43f896
共有 6 個文件被更改,包括 67 次插入6 次删除
  1. 2 0
      Firmware/messages.cpp
  2. 2 0
      Firmware/messages.h
  3. 22 6
      Firmware/mmu2.cpp
  4. 6 0
      Firmware/mmu2.h
  5. 34 0
      Firmware/ultralcd.cpp
  6. 1 0
      Firmware/ultralcd.h

+ 2 - 0
Firmware/messages.cpp

@@ -54,7 +54,9 @@ const char MSG_SELECT_FILAMENT[] PROGMEM_I1 = ISTR("Select filament:"); ////MSG_
 const char MSG_LAST_PRINT[] PROGMEM_I1 = ISTR("Last print"); ////MSG_LAST_PRINT c=18
 const char MSG_LAST_PRINT_FAILURES[] PROGMEM_I1 = ISTR("Last print failures"); ////MSG_LAST_PRINT_FAILURES c=20
 const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); ////MSG_LOAD_FILAMENT c=17
+const char MSG_LOAD_TO_BONDTECH[] PROGMEM_I1 = ISTR("Load to Bondtech"); ////c=18
 const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////MSG_LOADING_FILAMENT c=20
+const char MSG_TESTING_FILAMENT[] PROGMEM_I1 = ISTR("Testing filament"); ////c=20
 const char MSG_EJECT_FILAMENT[] PROGMEM_I1 = ISTR("Eject filament"); ////MSG_EJECT_FILAMENT c=17
 const char MSG_CUT_FILAMENT[] PROGMEM_I1 = ISTR("Cut filament"); ////MSG_CUT_FILAMENT c=17
 const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); ////MSG_MAIN c=18

+ 2 - 0
Firmware/messages.h

@@ -60,7 +60,9 @@ extern const char MSG_SELECT_FILAMENT[];
 extern const char MSG_LAST_PRINT[];
 extern const char MSG_LAST_PRINT_FAILURES[];
 extern const char MSG_LOAD_FILAMENT[];
+extern const char MSG_LOAD_TO_BONDTECH[];
 extern const char MSG_LOADING_FILAMENT[];
+extern const char MSG_TESTING_FILAMENT[];
 extern const char MSG_M117_V2_CALIBRATION[];
 extern const char MSG_MAIN[];
 extern const char MSG_BACK[];

+ 22 - 6
Firmware/mmu2.cpp

@@ -333,20 +333,34 @@ bool MMU2::cut_filament(uint8_t index){
     return true;
 }
 
+void FullScreenMsg(const char *pgmS, uint8_t slot){
+    lcd_update_enable(false);
+    lcd_clear();
+    lcd_puts_at_P(0, 1, pgmS);
+    lcd_print(' ');
+    lcd_print(slot + 1);
+}
+
+bool MMU2::load_to_bondtech(uint8_t index){
+    FullScreenMsg(_T(MSG_TESTING_FILAMENT), index);
+    tool_change(index);
+    st_synchronize();
+    unload();
+    lcd_update_enable(true);
+    return true;
+}
+
 bool MMU2::load_filament(uint8_t index) {
     if( ! WaitForMMUReady())
         return false;
 
-    lcd_update_enable(false);
-    lcd_clear();
-    lcd_puts_at_P(0, 1, _T(MSG_LOADING_FILAMENT));
-    lcd_print(' ');
-    lcd_print(index + 1);
+    FullScreenMsg(_T(MSG_LOADING_FILAMENT), index);
 
     ReportingRAII rep(CommandInProgress::LoadFilament);
     logic.LoadFilament(index);
     manage_response(false, false);
     Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
+
     lcd_update_enable(true);
 
     return true;
@@ -370,6 +384,7 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) {
 
     WaitForHotendTargetTempBeep();
 
+    FullScreenMsg(_T(MSG_LOADING_FILAMENT), index);
     {
         // used for MMU-menu operation "Load to Nozzle"
         ReportingRAII rep(CommandInProgress::ToolChange);
@@ -406,8 +421,9 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) {
         SetActiveExtruder(0);
 
         Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
-        return true;
     }
+    lcd_update_enable(true);
+    return true;
 }
 
 bool MMU2::eject_filament(uint8_t index, bool recover) {

+ 6 - 0
Firmware/mmu2.h

@@ -112,6 +112,12 @@ public:
     /// @returns false if the operation cannot be performed (Stopped)
     bool cut_filament(uint8_t index);
 
+    /// Issue a Try-Load command
+    /// It behaves very similarly like a ToolChange, but it doesn't load the filament
+    /// all the way down to the nozzle. The sole purpose of this operation
+    /// is to check, that the filament will be ready for printing.
+    bool load_to_bondtech(uint8_t index);
+
     /// @returns the active filament slot index (0-4) or 0xff in case of no active tool
     uint8_t get_current_tool() const;
 

+ 34 - 0
Firmware/ultralcd.cpp

@@ -125,6 +125,7 @@ static void lcd_v2_calibration();
 
 static void mmu_fil_eject_menu();
 static void mmu_load_to_nozzle_menu();
+static void mmu_load_to_bondtech_menu();
 static void preheat_or_continue();
 
 #ifdef MMU_HAS_CUTTER
@@ -1836,6 +1837,7 @@ switch(eFilamentAction)
      case FilamentAction::Load:
      case FilamentAction::AutoLoad:
      case FilamentAction::MmuLoad:
+     case FilamentAction::MmuLoadBondtech:
           lcd_puts_P(_i("to load filament"));     ////MSG_TO_LOAD_FIL c=20
           break;
      case FilamentAction::UnLoad:
@@ -1874,6 +1876,7 @@ switch(eFilamentAction)
                enquecommand_P(PSTR("M702"));      // unload filament
                break;
           case FilamentAction::MmuLoad:
+          case FilamentAction::MmuLoadBondtech:
           case FilamentAction::MmuUnLoad:
           case FilamentAction::MmuEject:
           case FilamentAction::MmuCut:
@@ -1945,6 +1948,12 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
             menu_back(nLevel);
             menu_submenu(mmu_load_to_nozzle_menu);
             break;
+        case FilamentAction::MmuLoadBondtech:
+            nLevel = bFilamentPreheatState ? 1 : 2;
+            bFilamentAction = true;
+            menu_back(nLevel);
+            menu_submenu(mmu_load_to_bondtech_menu);
+            break;
         case FilamentAction::MmuUnLoad:
             nLevel = bFilamentPreheatState ? 1 : 2;
             bFilamentAction = true;
@@ -1999,6 +2008,7 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
             case FilamentAction::Load:
             case FilamentAction::AutoLoad:
             case FilamentAction::MmuLoad:
+            case FilamentAction::MmuLoadBondtech:
                 lcd_puts_P(_i("Preheating to load")); ////MSG_PREHEATING_TO_LOAD c=20
                 if (once) raise_z_above(MIN_Z_FOR_LOAD);
                 break;
@@ -5226,6 +5236,29 @@ static void mmu_cut_filament_menu() {
 }
 #endif //MMU_HAS_CUTTER
 
+static inline void load_to_bondtech_all_wrapper(){
+    for(uint8_t i = 0; i < 5; ++i){
+        MMU2::mmu2.load_to_bondtech(i);
+    }
+}
+
+static inline void load_to_bondtech_wrapper(uint8_t i){
+    MMU2::mmu2.load_to_bondtech(i);
+}
+
+static void mmu_load_to_bondtech_menu() {
+    if (bFilamentAction) {
+        MENU_BEGIN();
+        MENU_ITEM_BACK_P(_T(MSG_MAIN));
+        MENU_ITEM_FUNCTION_P(_i("Load all"), load_to_bondtech_all_wrapper); ////MSG_LOAD_ALL c=18
+        for (uint8_t i = 0; i < MMU_FILAMENT_COUNT; i++)
+            MENU_ITEM_FUNCTION_NR_P(_T(MSG_LOAD_FILAMENT), i + '1', load_to_bondtech_wrapper, i); ////MSG_LOAD_FILAMENT c=16
+        MENU_END();
+    } else {
+        eFilamentAction = FilamentAction::MmuLoadBondtech;
+        preheat_or_continue();
+    }
+}
 
 // unload filament for single material printer (used in M702 gcode)
 // @param automatic: If true, unload_filament is part of a unload+load sequence (M600)
@@ -5600,6 +5633,7 @@ static void lcd_main_menu()
     if ( ! ( IS_SD_PRINTING || usb_timer.running() || (lcd_commands_type == LcdCommands::Layer1Cal) ) ) {
         if (MMU2::mmu2.Enabled()) {
             MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), mmu_load_filament_menu);
+            MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_TO_BONDTECH), mmu_load_to_bondtech_menu);
             MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu);////MSG_LOAD_TO_NOZZLE c=18
             MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), mmu_unload_filament);
             MENU_ITEM_SUBMENU_P(_T(MSG_EJECT_FILAMENT), mmu_fil_eject_menu);

+ 1 - 0
Firmware/ultralcd.h

@@ -180,6 +180,7 @@ enum class FilamentAction : uint_least8_t
     MmuUnLoad,
     MmuEject,
     MmuCut,
+    MmuLoadBondtech,
     Preheat,
     Lay1Cal,
 };