Browse Source

Minor motion style changes

Scott Lahteine 4 years ago
parent
commit
49c5f614c6

+ 1
- 1
Marlin/src/MarlinCore.cpp View File

650
       // travel moves have been received so enact them
650
       // travel moves have been received so enact them
651
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
651
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
652
       destination = current_position;
652
       destination = current_position;
653
-      prepare_move_to_destination();
653
+      prepare_line_to_destination();
654
     }
654
     }
655
   #endif
655
   #endif
656
 
656
 

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

65
   SERIAL_EOL();
65
   SERIAL_EOL();
66
 
66
 
67
   // Move to the saved position
67
   // Move to the saved position
68
-  prepare_move_to_destination();
68
+  prepare_line_to_destination();
69
 }
69
 }
70
 
70
 
71
 #endif // SAVED_POSITIONS
71
 #endif // SAVED_POSITIONS

+ 2
- 2
Marlin/src/gcode/motion/G0_G1.cpp View File

100
     #endif // FWRETRACT
100
     #endif // FWRETRACT
101
 
101
 
102
     #if IS_SCARA
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
     #else
104
     #else
105
-      prepare_move_to_destination();
105
+      prepare_line_to_destination();
106
     #endif
106
     #endif
107
 
107
 
108
     #ifdef G0_FEEDRATE
108
     #ifdef G0_FEEDRATE

+ 2
- 2
Marlin/src/gcode/probe/G38.cpp View File

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

+ 21
- 22
Marlin/src/module/motion.cpp View File

104
 /**
104
 /**
105
  * Cartesian Destination
105
  * Cartesian Destination
106
  *   The destination for a move, filled in by G-code movement commands,
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
  *   G-codes can set destination using 'get_destination_from_command'
108
  *   G-codes can set destination using 'get_destination_from_command'
109
  */
109
  */
110
 xyze_pos_t destination; // {0}
110
 xyze_pos_t destination; // {0}
340
       prepare_fast_move_to_destination();
340
       prepare_fast_move_to_destination();
341
     else
341
     else
342
   #endif
342
   #endif
343
-      prepare_move_to_destination();
343
+      prepare_line_to_destination();
344
 
344
 
345
   feedrate_mm_s = old_feedrate;
345
   feedrate_mm_s = old_feedrate;
346
   feedrate_percentage = old_pct;
346
   feedrate_percentage = old_pct;
660
 #endif // HAS_SOFTWARE_ENDSTOPS
660
 #endif // HAS_SOFTWARE_ENDSTOPS
661
 
661
 
662
 #if !UBL_SEGMENTED
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
 #if IS_KINEMATIC
673
 #if IS_KINEMATIC
664
 
674
 
665
   #if IS_SCARA
675
   #if IS_SCARA
679
   /**
689
   /**
680
    * Prepare a linear move in a DELTA or SCARA setup.
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
    * default Delta/SCARA segmenter.
693
    * default Delta/SCARA segmenter.
684
    *
694
    *
685
    * This calls planner.buffer_line several times, adding
695
    * This calls planner.buffer_line several times, adding
752
     xyze_pos_t raw = current_position;
762
     xyze_pos_t raw = current_position;
753
 
763
 
754
     // Calculate and execute the segments
764
     // Calculate and execute the segments
765
+    millis_t next_idle_ms = millis() + 200UL;
755
     while (--segments) {
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
       raw += segment_distance;
768
       raw += segment_distance;
765
-
766
       if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, cartesian_segment_mm
769
       if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, cartesian_segment_mm
767
         #if ENABLED(SCARA_FEEDRATE_SCALING)
770
         #if ENABLED(SCARA_FEEDRATE_SCALING)
768
           , inv_duration
771
           , inv_duration
831
       xyze_pos_t raw = current_position;
834
       xyze_pos_t raw = current_position;
832
 
835
 
833
       // Calculate and execute the segments
836
       // Calculate and execute the segments
837
+      millis_t next_idle_ms = millis() + 200UL;
834
       while (--segments) {
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
         raw += segment_distance;
840
         raw += segment_distance;
842
         if (!planner.buffer_line(raw, fr_mm_s, active_extruder, cartesian_segment_mm
841
         if (!planner.buffer_line(raw, fr_mm_s, active_extruder, cartesian_segment_mm
843
           #if ENABLED(SCARA_FEEDRATE_SCALING)
842
           #if ENABLED(SCARA_FEEDRATE_SCALING)
866
    *
865
    *
867
    * Return true if 'current_position' was set to 'destination'
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
     const float scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
869
     const float scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
871
     #if HAS_MESH
870
     #if HAS_MESH
872
       if (planner.leveling_active && planner.leveling_active_at_z(destination.z)) {
871
       if (planner.leveling_active && planner.leveling_active_at_z(destination.z)) {
1009
  *
1008
  *
1010
  * Before exit, current_position is set to destination.
1009
  * Before exit, current_position is set to destination.
1011
  */
1010
  */
1012
-void prepare_move_to_destination() {
1011
+void prepare_line_to_destination() {
1013
   apply_motion_limits(destination);
1012
   apply_motion_limits(destination);
1014
 
1013
 
1015
   #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
1014
   #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
1059
       #if IS_KINEMATIC // UBL using Kinematic / Cartesian cases as a workaround for now.
1058
       #if IS_KINEMATIC // UBL using Kinematic / Cartesian cases as a workaround for now.
1060
         ubl.line_to_destination_segmented(MMS_SCALED(feedrate_mm_s))
1059
         ubl.line_to_destination_segmented(MMS_SCALED(feedrate_mm_s))
1061
       #else
1060
       #else
1062
-        prepare_move_to_destination_cartesian()
1061
+        line_to_destination_cartesian()
1063
       #endif
1062
       #endif
1064
     #elif IS_KINEMATIC
1063
     #elif IS_KINEMATIC
1065
       line_to_destination_kinematic()
1064
       line_to_destination_kinematic()
1066
     #else
1065
     #else
1067
-      prepare_move_to_destination_cartesian()
1066
+      line_to_destination_cartesian()
1068
     #endif
1067
     #endif
1069
   ) return;
1068
   ) return;
1070
 
1069
 

+ 1
- 1
Marlin/src/module/motion.h View File

182
  */
182
  */
183
 void line_to_current_position(const feedRate_t &fr_mm_s=feedrate_mm_s);
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
 void _internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f
187
 void _internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f
188
   #if IS_KINEMATIC
188
   #if IS_KINEMATIC

Loading…
Cancel
Save