Browse Source

Use some int types in Planner

Scott Lahteine 7 years ago
parent
commit
d3f8111fe7
2 changed files with 10 additions and 10 deletions
  1. 9
    9
      Marlin/planner.cpp
  2. 1
    1
      Marlin/planner.h

+ 9
- 9
Marlin/planner.cpp View File

@@ -133,7 +133,7 @@ float Planner::min_feedrate_mm_s,
133 133
 
134 134
 // private:
135 135
 
136
-long Planner::position[NUM_AXIS] = { 0 };
136
+int32_t Planner::position[NUM_AXIS] = { 0 };
137 137
 
138 138
 uint32_t Planner::cutoff_long;
139 139
 
@@ -675,9 +675,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
675 675
     }
676 676
   #endif
677 677
 
678
-  const long da = target[X_AXIS] - position[X_AXIS],
679
-             db = target[Y_AXIS] - position[Y_AXIS],
680
-             dc = target[Z_AXIS] - position[Z_AXIS];
678
+  const int32_t da = target[X_AXIS] - position[X_AXIS],
679
+                db = target[Y_AXIS] - position[Y_AXIS],
680
+                dc = target[Z_AXIS] - position[Z_AXIS];
681 681
 
682 682
   /*
683 683
   SERIAL_ECHOPAIR("  Planner FR:", fr_mm_s);
@@ -706,7 +706,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
706 706
   if (DEBUGGING(DRYRUN))
707 707
     position[E_AXIS] = target[E_AXIS];
708 708
 
709
-  long de = target[E_AXIS] - position[E_AXIS];
709
+  int32_t de = target[E_AXIS] - position[E_AXIS];
710 710
 
711 711
   #if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE)
712 712
     if (de) {
@@ -1386,10 +1386,10 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
1386 1386
   #else
1387 1387
     #define _EINDEX E_AXIS
1388 1388
   #endif
1389
-  const long na = position[X_AXIS] = LROUND(a * axis_steps_per_mm[X_AXIS]),
1390
-             nb = position[Y_AXIS] = LROUND(b * axis_steps_per_mm[Y_AXIS]),
1391
-             nc = position[Z_AXIS] = LROUND(c * axis_steps_per_mm[Z_AXIS]),
1392
-             ne = position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
1389
+  const int32_t na = position[X_AXIS] = LROUND(a * axis_steps_per_mm[X_AXIS]),
1390
+                nb = position[Y_AXIS] = LROUND(b * axis_steps_per_mm[Y_AXIS]),
1391
+                nc = position[Z_AXIS] = LROUND(c * axis_steps_per_mm[Z_AXIS]),
1392
+                ne = position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
1393 1393
   stepper.set_position(na, nb, nc, ne);
1394 1394
   previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
1395 1395
   ZERO(previous_speed);

+ 1
- 1
Marlin/planner.h View File

@@ -182,7 +182,7 @@ class Planner {
182 182
      * The current position of the tool in absolute steps
183 183
      * Recalculated if any axis_steps_per_mm are changed by gcode
184 184
      */
185
-    static long position[NUM_AXIS];
185
+    static int32_t position[NUM_AXIS];
186 186
 
187 187
     /**
188 188
      * Speed of previous path line segment

Loading…
Cancel
Save