浏览代码

🚸 More automatic MMU2 load (#24750)

FBN 2 年前
父节点
当前提交
d0e7c2c208
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 25 次插入5 次删除
  1. 25
    5
      Marlin/src/feature/mmu/mmu2.cpp

+ 25
- 5
Marlin/src/feature/mmu/mmu2.cpp 查看文件

585
       command(MMU_CMD_T0 + index);
585
       command(MMU_CMD_T0 + index);
586
       manage_response(true, true);
586
       manage_response(true, true);
587
       mmu_continue_loading();
587
       mmu_continue_loading();
588
-      command(MMU_CMD_C0);
588
+      //command(MMU_CMD_C0);
589
       extruder = index;
589
       extruder = index;
590
       active_extruder = 0;
590
       active_extruder = 0;
591
 
591
 
653
   }
653
   }
654
 
654
 
655
   void MMU2::mmu_continue_loading() {
655
   void MMU2::mmu_continue_loading() {
656
+    // Try to load the filament a limited number of times
656
     for (uint8_t i = 0; i < MMU_LOADING_ATTEMPTS_NR; i++) {
657
     for (uint8_t i = 0; i < MMU_LOADING_ATTEMPTS_NR; i++) {
657
-      DEBUG_ECHOLNPGM("Additional load attempt #", i);
658
-      if (FILAMENT_PRESENT()) break;
658
+      DEBUG_ECHOLNPGM("Load attempt #", i + 1);
659
+
660
+      // Done as soon as filament is present
661
+      bool fil_present = FILAMENT_PRESENT();
662
+      if (fil_present) break;
663
+
664
+      // Attempt to load the filament, 1mm at a time, for 3s
659
       command(MMU_CMD_C0);
665
       command(MMU_CMD_C0);
666
+      stepper.enable_extruder();
667
+      const millis_t expire_ms = millis() + 3000;
668
+      do {
669
+        current_position.e += 1;
670
+        line_to_current_position(MMU_LOAD_FEEDRATE);
671
+        planner.synchronize();
672
+        // When (T0 rx->ok) load is ready, but in fact it did not load
673
+        // successfully or an overload created pressure in the extruder.
674
+        // Send (C0) to load more and move E_AXIS a little to release pressure.
675
+        if ((fil_present = FILAMENT_PRESENT())) MMU2_COMMAND("A");
676
+      } while (!fil_present && PENDING(millis(), expire_ms));
677
+      stepper.disable_extruder();
660
       manage_response(true, true);
678
       manage_response(true, true);
661
     }
679
     }
662
-    if (!FILAMENT_PRESENT()) {
680
+
681
+    // Was the filament still missing in the last check?
682
+    if (!fil_present) {
663
       DEBUG_ECHOLNPGM("Filament never reached sensor, runout");
683
       DEBUG_ECHOLNPGM("Filament never reached sensor, runout");
664
       filament_runout();
684
       filament_runout();
665
     }
685
     }
682
       command(MMU_CMD_T0 + index);
702
       command(MMU_CMD_T0 + index);
683
       manage_response(true, true);
703
       manage_response(true, true);
684
       command(MMU_CMD_C0);
704
       command(MMU_CMD_C0);
685
-      extruder = index; //filament change is finished
705
+      extruder = index; // Filament change is finished
686
       active_extruder = 0;
706
       active_extruder = 0;
687
       stepper.enable_extruder();
707
       stepper.enable_extruder();
688
       SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);
708
       SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);

正在加载...
取消
保存