Ver código fonte

Minor motion style changes

Scott Lahteine 4 anos atrás
pai
commit
49c5f614c6

+ 1
- 1
Marlin/src/MarlinCore.cpp Ver arquivo

@@ -650,7 +650,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
650 650
       // travel moves have been received so enact them
651 651
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
652 652
       destination = current_position;
653
-      prepare_move_to_destination();
653
+      prepare_line_to_destination();
654 654
     }
655 655
   #endif
656 656
 

+ 1
- 1
Marlin/src/gcode/feature/pause/G61.cpp Ver arquivo

@@ -65,7 +65,7 @@ void GcodeSuite::G61(void) {
65 65
   SERIAL_EOL();
66 66
 
67 67
   // Move to the saved position
68
-  prepare_move_to_destination();
68
+  prepare_line_to_destination();
69 69
 }
70 70
 
71 71
 #endif // SAVED_POSITIONS

+ 2
- 2
Marlin/src/gcode/motion/G0_G1.cpp Ver arquivo

@@ -100,9 +100,9 @@ void GcodeSuite::G0_G1(
100 100
     #endif // FWRETRACT
101 101
 
102 102
     #if IS_SCARA
103
-      fast_move ? prepare_fast_move_to_destination() : prepare_move_to_destination();
103
+      fast_move ? prepare_fast_move_to_destination() : prepare_line_to_destination();
104 104
     #else
105
-      prepare_move_to_destination();
105
+      prepare_line_to_destination();
106 106
     #endif
107 107
 
108 108
     #ifdef G0_FEEDRATE

+ 2
- 2
Marlin/src/gcode/probe/G38.cpp Ver arquivo

@@ -34,7 +34,7 @@
34 34
 inline void G38_single_probe(const uint8_t move_value) {
35 35
   endstops.enable(true);
36 36
   G38_move = move_value;
37
-  prepare_move_to_destination();
37
+  prepare_line_to_destination();
38 38
   planner.synchronize();
39 39
   G38_move = 0;
40 40
   endstops.hit_on_purpose();
@@ -77,7 +77,7 @@ inline bool G38_run_probe() {
77 77
       // Move away by the retract distance
78 78
       destination = current_position + retract_mm;
79 79
       endstops.enable(false);
80
-      prepare_move_to_destination();
80
+      prepare_line_to_destination();
81 81
       planner.synchronize();
82 82
 
83 83
       REMEMBER(fr, feedrate_mm_s, feedrate_mm_s * 0.25);

+ 21
- 22
Marlin/src/module/motion.cpp Ver arquivo

@@ -104,7 +104,7 @@ xyze_pos_t current_position = { X_HOME_POS, Y_HOME_POS, Z_HOME_POS };
104 104
 /**
105 105
  * Cartesian Destination
106 106
  *   The destination for a move, filled in by G-code movement commands,
107
- *   and expected by functions like 'prepare_move_to_destination'.
107
+ *   and expected by functions like 'prepare_line_to_destination'.
108 108
  *   G-codes can set destination using 'get_destination_from_command'
109 109
  */
110 110
 xyze_pos_t destination; // {0}
@@ -340,7 +340,7 @@ void _internal_move_to_destination(const feedRate_t &fr_mm_s/*=0.0f*/
340 340
       prepare_fast_move_to_destination();
341 341
     else
342 342
   #endif
343
-      prepare_move_to_destination();
343
+      prepare_line_to_destination();
344 344
 
345 345
   feedrate_mm_s = old_feedrate;
346 346
   feedrate_percentage = old_pct;
@@ -660,6 +660,16 @@ void restore_feedrate_and_scaling() {
660 660
 #endif // HAS_SOFTWARE_ENDSTOPS
661 661
 
662 662
 #if !UBL_SEGMENTED
663
+
664
+FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
665
+  const millis_t ms = millis();
666
+  thermalManager.manage_heater();  // This returns immediately if not really needed.
667
+  if (ELAPSED(ms, next_idle_ms)) {
668
+    next_idle_ms = ms + 200UL;
669
+    idle();
670
+  }
671
+}
672
+
663 673
 #if IS_KINEMATIC
664 674
 
665 675
   #if IS_SCARA
@@ -679,7 +689,7 @@ void restore_feedrate_and_scaling() {
679 689
   /**
680 690
    * Prepare a linear move in a DELTA or SCARA setup.
681 691
    *
682
-   * Called from prepare_move_to_destination as the
692
+   * Called from prepare_line_to_destination as the
683 693
    * default Delta/SCARA segmenter.
684 694
    *
685 695
    * This calls planner.buffer_line several times, adding
@@ -752,17 +762,10 @@ void restore_feedrate_and_scaling() {
752 762
     xyze_pos_t raw = current_position;
753 763
 
754 764
     // Calculate and execute the segments
765
+    millis_t next_idle_ms = millis() + 200UL;
755 766
     while (--segments) {
756
-
757
-      static millis_t next_idle_ms = millis() + 200UL;
758
-      thermalManager.manage_heater();  // This returns immediately if not really needed.
759
-      if (ELAPSED(millis(), next_idle_ms)) {
760
-        next_idle_ms = millis() + 200UL;
761
-        idle();
762
-      }
763
-
767
+      segment_idle(next_idle_ms);
764 768
       raw += segment_distance;
765
-
766 769
       if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, cartesian_segment_mm
767 770
         #if ENABLED(SCARA_FEEDRATE_SCALING)
768 771
           , inv_duration
@@ -831,13 +834,9 @@ void restore_feedrate_and_scaling() {
831 834
       xyze_pos_t raw = current_position;
832 835
 
833 836
       // Calculate and execute the segments
837
+      millis_t next_idle_ms = millis() + 200UL;
834 838
       while (--segments) {
835
-        static millis_t next_idle_ms = millis() + 200UL;
836
-        thermalManager.manage_heater();  // This returns immediately if not really needed.
837
-        if (ELAPSED(millis(), next_idle_ms)) {
838
-          next_idle_ms = millis() + 200UL;
839
-          idle();
840
-        }
839
+        segment_idle(next_idle_ms);
841 840
         raw += segment_distance;
842 841
         if (!planner.buffer_line(raw, fr_mm_s, active_extruder, cartesian_segment_mm
843 842
           #if ENABLED(SCARA_FEEDRATE_SCALING)
@@ -866,7 +865,7 @@ void restore_feedrate_and_scaling() {
866 865
    *
867 866
    * Return true if 'current_position' was set to 'destination'
868 867
    */
869
-  inline bool prepare_move_to_destination_cartesian() {
868
+  inline bool line_to_destination_cartesian() {
870 869
     const float scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
871 870
     #if HAS_MESH
872 871
       if (planner.leveling_active && planner.leveling_active_at_z(destination.z)) {
@@ -1009,7 +1008,7 @@ void restore_feedrate_and_scaling() {
1009 1008
  *
1010 1009
  * Before exit, current_position is set to destination.
1011 1010
  */
1012
-void prepare_move_to_destination() {
1011
+void prepare_line_to_destination() {
1013 1012
   apply_motion_limits(destination);
1014 1013
 
1015 1014
   #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
@@ -1059,12 +1058,12 @@ void prepare_move_to_destination() {
1059 1058
       #if IS_KINEMATIC // UBL using Kinematic / Cartesian cases as a workaround for now.
1060 1059
         ubl.line_to_destination_segmented(MMS_SCALED(feedrate_mm_s))
1061 1060
       #else
1062
-        prepare_move_to_destination_cartesian()
1061
+        line_to_destination_cartesian()
1063 1062
       #endif
1064 1063
     #elif IS_KINEMATIC
1065 1064
       line_to_destination_kinematic()
1066 1065
     #else
1067
-      prepare_move_to_destination_cartesian()
1066
+      line_to_destination_cartesian()
1068 1067
     #endif
1069 1068
   ) return;
1070 1069
 

+ 1
- 1
Marlin/src/module/motion.h Ver arquivo

@@ -182,7 +182,7 @@ void sync_plan_position_e();
182 182
  */
183 183
 void line_to_current_position(const feedRate_t &fr_mm_s=feedrate_mm_s);
184 184
 
185
-void prepare_move_to_destination();
185
+void prepare_line_to_destination();
186 186
 
187 187
 void _internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f
188 188
   #if IS_KINEMATIC

Carregando…
Cancelar
Salvar