Browse Source

Apply int32_t to stepper

Scott Lahteine 6 years ago
parent
commit
0c23792344
2 changed files with 22 additions and 22 deletions
  1. 14
    14
      Marlin/src/module/stepper.cpp
  2. 8
    8
      Marlin/src/module/stepper.h

+ 14
- 14
Marlin/src/module/stepper.cpp View File

@@ -109,10 +109,10 @@ int16_t Stepper::cleaning_buffer_counter = 0;
109 109
   bool Stepper::locked_z_motor = false, Stepper::locked_z2_motor = false;
110 110
 #endif
111 111
 
112
-long Stepper::counter_X = 0,
113
-     Stepper::counter_Y = 0,
114
-     Stepper::counter_Z = 0,
115
-     Stepper::counter_E = 0;
112
+int32_t Stepper::counter_X = 0,
113
+        Stepper::counter_Y = 0,
114
+        Stepper::counter_Z = 0,
115
+        Stepper::counter_E = 0;
116 116
 
117 117
 volatile uint32_t Stepper::step_events_completed = 0; // The number of step events executed in the current block
118 118
 
@@ -159,7 +159,7 @@ volatile int32_t Stepper::count_position[NUM_AXIS] = { 0 };
159 159
 volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
160 160
 
161 161
 #if ENABLED(MIXING_EXTRUDER)
162
-  long Stepper::counter_m[MIXING_STEPPERS];
162
+  int32_t Stepper::counter_m[MIXING_STEPPERS];
163 163
 #endif
164 164
 
165 165
 uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
@@ -169,7 +169,7 @@ hal_timer_t Stepper::OCR1A_nominal;
169 169
   hal_timer_t Stepper::acc_step_rate; // needed for deceleration start point
170 170
 #endif
171 171
 
172
-volatile long Stepper::endstops_trigsteps[XYZ];
172
+volatile int32_t Stepper::endstops_trigsteps[XYZ];
173 173
 
174 174
 #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
175 175
   #define LOCKED_X_MOTOR  locked_x_motor
@@ -1976,7 +1976,7 @@ void Stepper::synchronize() { while (planner.has_blocks_queued() || cleaning_buf
1976 1976
  * This allows get_axis_position_mm to correctly
1977 1977
  * derive the current XYZ position later on.
1978 1978
  */
1979
-void Stepper::set_position(const long &a, const long &b, const long &c, const long &e) {
1979
+void Stepper::set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e) {
1980 1980
 
1981 1981
   synchronize(); // Bad to set stepper counts in the middle of a move
1982 1982
 
@@ -2009,13 +2009,13 @@ void Stepper::set_position(const long &a, const long &b, const long &c, const lo
2009 2009
   CRITICAL_SECTION_END;
2010 2010
 }
2011 2011
 
2012
-void Stepper::set_position(const AxisEnum &axis, const long &v) {
2012
+void Stepper::set_position(const AxisEnum &axis, const int32_t &v) {
2013 2013
   CRITICAL_SECTION_START;
2014 2014
   count_position[axis] = v;
2015 2015
   CRITICAL_SECTION_END;
2016 2016
 }
2017 2017
 
2018
-void Stepper::set_e_position(const long &e) {
2018
+void Stepper::set_e_position(const int32_t &e) {
2019 2019
   CRITICAL_SECTION_START;
2020 2020
   count_position[E_AXIS] = e;
2021 2021
   CRITICAL_SECTION_END;
@@ -2024,9 +2024,9 @@ void Stepper::set_e_position(const long &e) {
2024 2024
 /**
2025 2025
  * Get a stepper's position in steps.
2026 2026
  */
2027
-long Stepper::position(const AxisEnum axis) {
2027
+int32_t Stepper::position(const AxisEnum axis) {
2028 2028
   CRITICAL_SECTION_START;
2029
-  const long count_pos = count_position[axis];
2029
+  const int32_t count_pos = count_position[axis];
2030 2030
   CRITICAL_SECTION_END;
2031 2031
   return count_pos;
2032 2032
 }
@@ -2095,9 +2095,9 @@ void Stepper::endstop_triggered(const AxisEnum axis) {
2095 2095
 
2096 2096
 void Stepper::report_positions() {
2097 2097
   CRITICAL_SECTION_START;
2098
-  const long xpos = count_position[X_AXIS],
2099
-             ypos = count_position[Y_AXIS],
2100
-             zpos = count_position[Z_AXIS];
2098
+  const int32_t xpos = count_position[X_AXIS],
2099
+                ypos = count_position[Y_AXIS],
2100
+                zpos = count_position[Z_AXIS];
2101 2101
   CRITICAL_SECTION_END;
2102 2102
 
2103 2103
   #if CORE_IS_XY || CORE_IS_XZ || IS_DELTA || IS_SCARA

+ 8
- 8
Marlin/src/module/stepper.h View File

@@ -94,7 +94,7 @@ class Stepper {
94 94
     #endif
95 95
 
96 96
     // Counter variables for the Bresenham line tracer
97
-    static long counter_X, counter_Y, counter_Z, counter_E;
97
+    static int32_t counter_X, counter_Y, counter_Z, counter_E;
98 98
     static volatile uint32_t step_events_completed; // The number of step events executed in the current block
99 99
 
100 100
     #if ENABLED(BEZIER_JERK_CONTROL)
@@ -137,8 +137,8 @@ class Stepper {
137 137
       static hal_timer_t acc_step_rate; // needed for deceleration start point
138 138
     #endif
139 139
 
140
-    static volatile long endstops_trigsteps[XYZ];
141
-    static volatile long endstops_stepsTotal, endstops_stepsDone;
140
+    static volatile int32_t endstops_trigsteps[XYZ];
141
+    static volatile int32_t endstops_stepsTotal, endstops_stepsDone;
142 142
 
143 143
     //
144 144
     // Positions of stepper motors, in step units
@@ -154,7 +154,7 @@ class Stepper {
154 154
     // Mixing extruder mix counters
155 155
     //
156 156
     #if ENABLED(MIXING_EXTRUDER)
157
-      static long counter_m[MIXING_STEPPERS];
157
+      static int32_t counter_m[MIXING_STEPPERS];
158 158
       #define MIXING_STEPPERS_LOOP(VAR) \
159 159
         for (uint8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++) \
160 160
           if (current_block->mix_event_count[VAR])
@@ -191,9 +191,9 @@ class Stepper {
191 191
     //
192 192
     // Set the current position in steps
193 193
     //
194
-    static void set_position(const long &a, const long &b, const long &c, const long &e);
195
-    static void set_position(const AxisEnum &a, const long &v);
196
-    static void set_e_position(const long &e);
194
+    static void set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e);
195
+    static void set_position(const AxisEnum &a, const int32_t &v);
196
+    static void set_e_position(const int32_t &e);
197 197
 
198 198
     //
199 199
     // Set direction bits for all steppers
@@ -203,7 +203,7 @@ class Stepper {
203 203
     //
204 204
     // Get the position of a stepper, in steps
205 205
     //
206
-    static long position(const AxisEnum axis);
206
+    static int32_t position(const AxisEnum axis);
207 207
 
208 208
     //
209 209
     // Report the positions of the steppers, in steps

Loading…
Cancel
Save