Browse Source

Clarify some motion code

Scott Lahteine 7 years ago
parent
commit
0cfb936dd1

+ 2
- 2
Marlin/src/feature/bedlevel/abl/abl.cpp View File

377
 
377
 
378
     if (cx1 == cx2 && cy1 == cy2) {
378
     if (cx1 == cx2 && cy1 == cy2) {
379
       // Start and end on same mesh square
379
       // Start and end on same mesh square
380
-      line_to_destination(fr_mm_s);
380
+      buffer_line_to_destination(fr_mm_s);
381
       set_current_from_destination();
381
       set_current_from_destination();
382
       return;
382
       return;
383
     }
383
     }
404
     }
404
     }
405
     else {
405
     else {
406
       // Already split on a border
406
       // Already split on a border
407
-      line_to_destination(fr_mm_s);
407
+      buffer_line_to_destination(fr_mm_s);
408
       set_current_from_destination();
408
       set_current_from_destination();
409
       return;
409
       return;
410
     }
410
     }

+ 2
- 2
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp View File

68
 
68
 
69
     if (cx1 == cx2 && cy1 == cy2) {
69
     if (cx1 == cx2 && cy1 == cy2) {
70
       // Start and end on same mesh square
70
       // Start and end on same mesh square
71
-      line_to_destination(fr_mm_s);
71
+      buffer_line_to_destination(fr_mm_s);
72
       set_current_from_destination();
72
       set_current_from_destination();
73
       return;
73
       return;
74
     }
74
     }
95
     }
95
     }
96
     else {
96
     else {
97
       // Already split on a border
97
       // Already split on a border
98
-      line_to_destination(fr_mm_s);
98
+      buffer_line_to_destination(fr_mm_s);
99
       set_current_from_destination();
99
       set_current_from_destination();
100
       return;
100
       return;
101
     }
101
     }

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

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);
101
   #else
101
   #else
102
-    line_to_destination(fr);
102
+    buffer_line_to_destination(fr);
103
   #endif
103
   #endif
104
   stepper.synchronize();
104
   stepper.synchronize();
105
 }
105
 }

+ 1
- 1
Marlin/src/gcode/bedlevel/mbl/G29.cpp View File

48
   #if ENABLED(MESH_G28_REST_ORIGIN)
48
   #if ENABLED(MESH_G28_REST_ORIGIN)
49
     current_position[Z_AXIS] = Z_MIN_POS;
49
     current_position[Z_AXIS] = Z_MIN_POS;
50
     set_destination_from_current();
50
     set_destination_from_current();
51
-    line_to_destination(homing_feedrate(Z_AXIS));
51
+    buffer_line_to_destination(homing_feedrate(Z_AXIS));
52
     stepper.synchronize();
52
     stepper.synchronize();
53
   #endif
53
   #endif
54
 }
54
 }

+ 1
- 1
Marlin/src/inc/SanityCheck.h View File

819
    */
819
    */
820
 
820
 
821
   #if ENABLED(DELTA)
821
   #if ENABLED(DELTA)
822
-    #error "MESH_BED_LEVELING does not yet support DELTA printers."
822
+    #error "MESH_BED_LEVELING is not compatible with DELTA printers."
823
   #elif GRID_MAX_POINTS_X > 9 || GRID_MAX_POINTS_Y > 9
823
   #elif GRID_MAX_POINTS_X > 9 || GRID_MAX_POINTS_Y > 9
824
     #error "GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y must be less than 10 for MBL."
824
     #error "GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y must be less than 10 for MBL."
825
   #endif
825
   #endif

+ 6
- 6
Marlin/src/module/motion.cpp View File

70
 /**
70
 /**
71
  * Cartesian Current Position
71
  * Cartesian Current Position
72
  *   Used to track the native machine position as moves are queued.
72
  *   Used to track the native machine position as moves are queued.
73
- *   Used by 'line_to_current_position' to do a move after changing it.
73
+ *   Used by 'buffer_line_to_current_position' to do a move after changing it.
74
  *   Used by 'SYNC_PLAN_POSITION_KINEMATIC' to update 'planner.position'.
74
  *   Used by 'SYNC_PLAN_POSITION_KINEMATIC' to update 'planner.position'.
75
  */
75
  */
76
 float current_position[XYZE] = { 0.0 };
76
 float current_position[XYZE] = { 0.0 };
77
 
77
 
78
 /**
78
 /**
79
  * Cartesian Destination
79
  * Cartesian Destination
80
- *   A temporary position, usually applied to 'current_position'.
81
- *   Set with 'get_destination_from_command' or 'set_destination_from_current'.
82
- *   'line_to_destination' sets 'current_position' to 'destination'.
80
+ *   The destination for a move, filled in by G-code movement commands,
81
+ *   and expected by functions like 'prepare_move_to_destination'.
82
+ *   Set with 'gcode_get_destination' or 'set_destination_from_current'.
83
  */
83
  */
84
 float destination[XYZE] = { 0.0 };
84
 float destination[XYZE] = { 0.0 };
85
 
85
 
235
  * Move the planner to the position stored in the destination array, which is
235
  * Move the planner to the position stored in the destination array, which is
236
  * used by G0/G1/G2/G3/G5 and many other functions to set a destination.
236
  * used by G0/G1/G2/G3/G5 and many other functions to set a destination.
237
  */
237
  */
238
-void line_to_destination(const float fr_mm_s) {
238
+void buffer_line_to_destination(const float fr_mm_s) {
239
   planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], fr_mm_s, active_extruder);
239
   planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], fr_mm_s, active_extruder);
240
 }
240
 }
241
 
241
 
667
       }
667
       }
668
     #endif // HAS_MESH
668
     #endif // HAS_MESH
669
 
669
 
670
-    line_to_destination(MMS_SCALED(feedrate_mm_s));
670
+    buffer_line_to_destination(MMS_SCALED(feedrate_mm_s));
671
     return false;
671
     return false;
672
   }
672
   }
673
 
673
 

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

138
  * Move the planner to the position stored in the destination array, which is
138
  * Move the planner to the position stored in the destination array, which is
139
  * used by G0/G1/G2/G3/G5 and many other functions to set a destination.
139
  * used by G0/G1/G2/G3/G5 and many other functions to set a destination.
140
  */
140
  */
141
-void line_to_destination(const float fr_mm_s);
142
-
143
-inline void line_to_destination() { line_to_destination(feedrate_mm_s); }
141
+void buffer_line_to_destination(const float fr_mm_s);
144
 
142
 
145
 #if IS_KINEMATIC
143
 #if IS_KINEMATIC
146
   void prepare_uninterpolated_move_to_destination(const float fr_mm_s=0.0);
144
   void prepare_uninterpolated_move_to_destination(const float fr_mm_s=0.0);

+ 7
- 7
Marlin/src/module/planner.h View File

376
      *  fr_mm_s  - (target) speed of the move (mm/s)
376
      *  fr_mm_s  - (target) speed of the move (mm/s)
377
      *  extruder - target extruder
377
      *  extruder - target extruder
378
      */
378
      */
379
-    static FORCE_INLINE void buffer_line_kinematic(const float rtarget[XYZE], const float &fr_mm_s, const uint8_t extruder) {
379
+    static FORCE_INLINE void buffer_line_kinematic(const float cart[XYZE], const float &fr_mm_s, const uint8_t extruder) {
380
       #if PLANNER_LEVELING
380
       #if PLANNER_LEVELING
381
-        float lpos[XYZ] = { rtarget[X_AXIS], rtarget[Y_AXIS], rtarget[Z_AXIS] };
382
-        apply_leveling(lpos);
381
+        float raw[XYZ] = { cart[X_AXIS], cart[Y_AXIS], cart[Z_AXIS] };
382
+        apply_leveling(raw);
383
       #else
383
       #else
384
-        const float * const lpos = rtarget;
384
+        const float * const raw = cart;
385
       #endif
385
       #endif
386
       #if IS_KINEMATIC
386
       #if IS_KINEMATIC
387
-        inverse_kinematics(lpos);
388
-        _buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], rtarget[E_AXIS], fr_mm_s, extruder);
387
+        inverse_kinematics(raw);
388
+        _buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], cart[E_AXIS], fr_mm_s, extruder);
389
       #else
389
       #else
390
-        _buffer_line(lpos[X_AXIS], lpos[Y_AXIS], lpos[Z_AXIS], rtarget[E_AXIS], fr_mm_s, extruder);
390
+        _buffer_line(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], cart[E_AXIS], fr_mm_s, extruder);
391
       #endif
391
       #endif
392
     }
392
     }
393
 
393
 

Loading…
Cancel
Save