Pārlūkot izejas kodu

Normalize load/unload length in M600

Thomas Moore 7 gadus atpakaļ
vecāks
revīzija
600c85226e

+ 1
- 1
Marlin/src/feature/pause.cpp Parādīt failu

@@ -94,7 +94,7 @@ static void ensure_safe_temperature() {
94 94
 }
95 95
 
96 96
 void do_pause_e_move(const float &length, const float fr) {
97
-  current_position[E_AXIS] += length;
97
+  current_position[E_AXIS] += length * 100.0 / planner.flow_percentage[active_extruder] / planner.volumetric_multiplier[active_extruder];
98 98
   set_destination_from_current();
99 99
   #if IS_KINEMATIC
100 100
     planner.buffer_line_kinematic(destination, fr, active_extruder);

+ 11
- 9
Marlin/src/module/motion.cpp Parādīt failu

@@ -790,26 +790,28 @@ void prepare_move_to_destination() {
790 790
   clamp_to_software_endstops(destination);
791 791
   gcode.refresh_cmd_timeout();
792 792
 
793
-  #if ENABLED(PREVENT_COLD_EXTRUSION)
793
+  #if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
794 794
 
795 795
     if (!DEBUGGING(DRYRUN)) {
796 796
       if (destination[E_AXIS] != current_position[E_AXIS]) {
797
-        if (thermalManager.tooColdToExtrude(active_extruder)) {
798
-          current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
799
-          SERIAL_ECHO_START();
800
-          SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
801
-        }
797
+        #if ENABLED(PREVENT_COLD_EXTRUSION)
798
+          if (thermalManager.tooColdToExtrude(active_extruder)) {
799
+            current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
800
+            SERIAL_ECHO_START();
801
+            SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
802
+          }
803
+        #endif // PREVENT_COLD_EXTRUSION
802 804
         #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
803
-          if (destination[E_AXIS] - current_position[E_AXIS] > EXTRUDE_MAXLENGTH) {
805
+          if (FABS(destination[E_AXIS] - current_position[E_AXIS]) > (EXTRUDE_MAXLENGTH) / planner.volumetric_multiplier[active_extruder]) {
804 806
             current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
805 807
             SERIAL_ECHO_START();
806 808
             SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
807 809
           }
808
-        #endif
810
+        #endif // PREVENT_LENGTHY_EXTRUDE
809 811
       }
810 812
     }
811 813
 
812
-  #endif
814
+  #endif // PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE
813 815
 
814 816
   if (
815 817
     #if UBL_DELTA // Also works for CARTESIAN (smaller segments follow mesh more closely)

+ 21
- 16
Marlin/src/module/planner.cpp Parādīt failu

@@ -740,24 +740,29 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
740 740
 
741 741
   long de = target[E_AXIS] - position[E_AXIS];
742 742
 
743
+  const float e_factor = volumetric_multiplier[extruder] * flow_percentage[extruder] * 0.01;
744
+
743 745
   #if ENABLED(LIN_ADVANCE)
744
-    float de_float = e - position_float[E_AXIS];
746
+    float de_float = e - position_float[E_AXIS]; // Should this include e_factor?
745 747
   #endif
746 748
 
747
-  #if ENABLED(PREVENT_COLD_EXTRUSION)
749
+  #if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
748 750
     if (de) {
749
-      if (thermalManager.tooColdToExtrude(extruder)) {
750
-        position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
751
-        de = 0; // no difference
752
-        #if ENABLED(LIN_ADVANCE)
753
-          position_float[E_AXIS] = e;
754
-          de_float = 0;
755
-        #endif
756
-        SERIAL_ECHO_START();
757
-        SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
758
-      }
751
+      #if ENABLED(PREVENT_COLD_EXTRUSION)
752
+        if (thermalManager.tooColdToExtrude(extruder)) {
753
+          position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
754
+          de = 0; // no difference
755
+          #if ENABLED(LIN_ADVANCE)
756
+            position_float[E_AXIS] = e;
757
+            de_float = 0;
758
+          #endif
759
+          SERIAL_ECHO_START();
760
+          SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
761
+        }
762
+      #endif // PREVENT_COLD_EXTRUSION
759 763
       #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
760
-        if (labs(de) > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int
764
+        const int32_t de_mm = labs(de * e_factor);
765
+        if (de_mm > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int
761 766
           position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
762 767
           de = 0; // no difference
763 768
           #if ENABLED(LIN_ADVANCE)
@@ -767,9 +772,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
767 772
           SERIAL_ECHO_START();
768 773
           SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
769 774
         }
770
-      #endif
775
+      #endif // PREVENT_LENGTHY_EXTRUDE
771 776
     }
772
-  #endif
777
+  #endif // PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE
773 778
 
774 779
   // Compute direction bit-mask for this block
775 780
   uint8_t dm = 0;
@@ -798,7 +803,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
798 803
   #endif
799 804
   if (de < 0) SBI(dm, E_AXIS);
800 805
 
801
-  const float esteps_float = de * volumetric_multiplier[extruder] * flow_percentage[extruder] * 0.01;
806
+  const float esteps_float = de * e_factor;
802 807
   const int32_t esteps = abs(esteps_float) + 0.5;
803 808
 
804 809
   // Calculate the buffer head after we push this byte

Notiek ielāde…
Atcelt
Saglabāt