Browse Source

Normalize load/unload length in M600

Thomas Moore 7 years ago
parent
commit
600c85226e
3 changed files with 33 additions and 26 deletions
  1. 1
    1
      Marlin/src/feature/pause.cpp
  2. 11
    9
      Marlin/src/module/motion.cpp
  3. 21
    16
      Marlin/src/module/planner.cpp

+ 1
- 1
Marlin/src/feature/pause.cpp View File

94
 }
94
 }
95
 
95
 
96
 void do_pause_e_move(const float &length, const float fr) {
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
   set_destination_from_current();
98
   set_destination_from_current();
99
   #if IS_KINEMATIC
99
   #if IS_KINEMATIC
100
     planner.buffer_line_kinematic(destination, fr, active_extruder);
100
     planner.buffer_line_kinematic(destination, fr, active_extruder);

+ 11
- 9
Marlin/src/module/motion.cpp View File

790
   clamp_to_software_endstops(destination);
790
   clamp_to_software_endstops(destination);
791
   gcode.refresh_cmd_timeout();
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
     if (!DEBUGGING(DRYRUN)) {
795
     if (!DEBUGGING(DRYRUN)) {
796
       if (destination[E_AXIS] != current_position[E_AXIS]) {
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
         #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
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
             current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
806
             current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
805
             SERIAL_ECHO_START();
807
             SERIAL_ECHO_START();
806
             SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
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
   if (
816
   if (
815
     #if UBL_DELTA // Also works for CARTESIAN (smaller segments follow mesh more closely)
817
     #if UBL_DELTA // Also works for CARTESIAN (smaller segments follow mesh more closely)

+ 21
- 16
Marlin/src/module/planner.cpp View File

740
 
740
 
741
   long de = target[E_AXIS] - position[E_AXIS];
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
   #if ENABLED(LIN_ADVANCE)
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
   #endif
747
   #endif
746
 
748
 
747
-  #if ENABLED(PREVENT_COLD_EXTRUSION)
749
+  #if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
748
     if (de) {
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
       #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
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
           position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
766
           position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
762
           de = 0; // no difference
767
           de = 0; // no difference
763
           #if ENABLED(LIN_ADVANCE)
768
           #if ENABLED(LIN_ADVANCE)
767
           SERIAL_ECHO_START();
772
           SERIAL_ECHO_START();
768
           SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
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
   // Compute direction bit-mask for this block
779
   // Compute direction bit-mask for this block
775
   uint8_t dm = 0;
780
   uint8_t dm = 0;
798
   #endif
803
   #endif
799
   if (de < 0) SBI(dm, E_AXIS);
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
   const int32_t esteps = abs(esteps_float) + 0.5;
807
   const int32_t esteps = abs(esteps_float) + 0.5;
803
 
808
 
804
   // Calculate the buffer head after we push this byte
809
   // Calculate the buffer head after we push this byte

Loading…
Cancel
Save