瀏覽代碼

PFW-1439 Compensate load to nozzle extruder sequence for Extra Loading Distance

The Extra Loading Distance is configurable by the user.
We need to compensate the hardcoded sequence
such that it does not extrude too much or
too little. Currently the firmware
extrudes too little.
Guðni Már Gilbert 2 年之前
父節點
當前提交
6ee5f08505
共有 4 個文件被更改,包括 16 次插入10 次删除
  1. 9 4
      Firmware/mmu2.cpp
  2. 1 0
      Firmware/mmu2.h
  3. 3 3
      Firmware/mmu2/variants/config_MMU2.h
  4. 3 3
      Firmware/mmu2/variants/config_MMU2S.h

+ 9 - 4
Firmware/mmu2.cpp

@@ -23,8 +23,6 @@ static_assert(EXTRUDERS==1);
 
 namespace MMU2 {
 
-void execute_extruder_sequence(const E_Step *sequence, int steps);
-
 template<typename F>
 void waitForHotendTargetTemp(uint16_t delay, F f){
     while (((degTargetHotend(active_extruder) - degHotend(active_extruder)) > 5)) {
@@ -357,7 +355,7 @@ bool MMU2::tool_change(char code, uint8_t slot) {
 
     case 'c': {
         waitForHotendTargetTemp(100, []{});
-        execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0]));
+        execute_load_to_nozzle_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0]));
     } break;
     }
 
@@ -508,7 +506,7 @@ bool MMU2::load_filament_to_nozzle(uint8_t slot) {
         ToolChangeCommon(slot);
 
         // Finish loading to the nozzle with finely tuned steps.
-        execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0]));
+        execute_load_to_nozzle_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0]));
         Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
     }
     lcd_update_enable(true);
@@ -839,6 +837,13 @@ void MMU2::execute_extruder_sequence(const E_Step *sequence, uint8_t steps) {
     }
 }
 
+void MMU2::execute_load_to_nozzle_sequence(const E_Step *sequence, uint8_t steps) {
+    st_synchronize();
+    // Compensate for configurable Extra Loading Distance
+    current_position[E_AXIS] -= logic.ExtraLoadDistance();
+    execute_extruder_sequence(sequence, steps);
+}
+
 void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
     // Due to a potential lossy error reporting layers linked to this hook
     // we'd better report everything to make sure especially the error states

+ 1 - 0
Firmware/mmu2.h

@@ -239,6 +239,7 @@ private:
     
     void filament_ramming();
     void execute_extruder_sequence(const E_Step *sequence, uint8_t steps);
+    void execute_load_to_nozzle_sequence(const E_Step *sequence, uint8_t steps);
 
     /// Reports an error into attached ExtUIs
     /// @param ec error code, see ErrorCode

+ 3 - 3
Firmware/mmu2/variants/config_MMU2.h

@@ -64,7 +64,7 @@ static constexpr E_Step ramming_sequence[] PROGMEM = {
     { -35.0F,   2000.0F / 60.F},
 };
 
-static constexpr E_Step load_to_nozzle_sequence[] PROGMEM = { 
-    { 10.0F,  810.0F / 60.F}, // feed rate = 13.5mm/s - Load fast until filament reach end of nozzle
-    { 25.0F,  198.0F / 60.F}, // feed rate = 3.3mm/s  - Load slower once filament is out of the nozzle
+static constexpr E_Step load_to_nozzle_sequence[] PROGMEM = {
+    { MMU2_EXTRUDER_PTFE_LENGTH,       810.0F / 60.F}, // feed rate = 13.5mm/s - Load fast while not at heatbreak
+    { MMU2_EXTRUDER_HEATBREAK_LENGTH,  198.0F / 60.F}, // feed rate = 3.3mm/s  - Load slower once filament reaches heatbreak
 };

+ 3 - 3
Firmware/mmu2/variants/config_MMU2S.h

@@ -64,7 +64,7 @@ static constexpr E_Step ramming_sequence[] PROGMEM = {
     { -35.0F,   2000.0F / 60.F},
 };
 
-static constexpr E_Step load_to_nozzle_sequence[] PROGMEM = { 
-    { 10.0F,  810.0F / 60.F}, // feed rate = 13.5mm/s - Load fast until filament reach end of nozzle
-    { 25.0F,  198.0F / 60.F}, // feed rate = 3.3mm/s  - Load slower once filament is out of the nozzle
+static constexpr E_Step load_to_nozzle_sequence[] PROGMEM = {
+    { MMU2_EXTRUDER_PTFE_LENGTH,       810.0F / 60.F}, // feed rate = 13.5mm/s - Load fast while not at heatbreak
+    { MMU2_EXTRUDER_HEATBREAK_LENGTH,  198.0F / 60.F}, // feed rate = 3.3mm/s  - Load slower once filament reaches heatbreak
 };