From 0c23792344a5134dc00446c192456bf62094c346 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 3 May 2018 20:13:01 -0500 Subject: [PATCH] Apply int32_t to stepper --- Marlin/src/module/stepper.cpp | 28 ++++++++++++++-------------- Marlin/src/module/stepper.h | 16 ++++++++-------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 04c6c270f..ec547c598 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -109,10 +109,10 @@ int16_t Stepper::cleaning_buffer_counter = 0; bool Stepper::locked_z_motor = false, Stepper::locked_z2_motor = false; #endif -long Stepper::counter_X = 0, - Stepper::counter_Y = 0, - Stepper::counter_Z = 0, - Stepper::counter_E = 0; +int32_t Stepper::counter_X = 0, + Stepper::counter_Y = 0, + Stepper::counter_Z = 0, + Stepper::counter_E = 0; volatile uint32_t Stepper::step_events_completed = 0; // The number of step events executed in the current block @@ -159,7 +159,7 @@ volatile int32_t Stepper::count_position[NUM_AXIS] = { 0 }; volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; #if ENABLED(MIXING_EXTRUDER) - long Stepper::counter_m[MIXING_STEPPERS]; + int32_t Stepper::counter_m[MIXING_STEPPERS]; #endif uint8_t Stepper::step_loops, Stepper::step_loops_nominal; @@ -169,7 +169,7 @@ hal_timer_t Stepper::OCR1A_nominal; hal_timer_t Stepper::acc_step_rate; // needed for deceleration start point #endif -volatile long Stepper::endstops_trigsteps[XYZ]; +volatile int32_t Stepper::endstops_trigsteps[XYZ]; #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) #define LOCKED_X_MOTOR locked_x_motor @@ -1976,7 +1976,7 @@ void Stepper::synchronize() { while (planner.has_blocks_queued() || cleaning_buf * This allows get_axis_position_mm to correctly * derive the current XYZ position later on. */ -void Stepper::set_position(const long &a, const long &b, const long &c, const long &e) { +void Stepper::set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e) { synchronize(); // Bad to set stepper counts in the middle of a move @@ -2009,13 +2009,13 @@ void Stepper::set_position(const long &a, const long &b, const long &c, const lo CRITICAL_SECTION_END; } -void Stepper::set_position(const AxisEnum &axis, const long &v) { +void Stepper::set_position(const AxisEnum &axis, const int32_t &v) { CRITICAL_SECTION_START; count_position[axis] = v; CRITICAL_SECTION_END; } -void Stepper::set_e_position(const long &e) { +void Stepper::set_e_position(const int32_t &e) { CRITICAL_SECTION_START; count_position[E_AXIS] = e; CRITICAL_SECTION_END; @@ -2024,9 +2024,9 @@ void Stepper::set_e_position(const long &e) { /** * Get a stepper's position in steps. */ -long Stepper::position(const AxisEnum axis) { +int32_t Stepper::position(const AxisEnum axis) { CRITICAL_SECTION_START; - const long count_pos = count_position[axis]; + const int32_t count_pos = count_position[axis]; CRITICAL_SECTION_END; return count_pos; } @@ -2095,9 +2095,9 @@ void Stepper::endstop_triggered(const AxisEnum axis) { void Stepper::report_positions() { CRITICAL_SECTION_START; - const long xpos = count_position[X_AXIS], - ypos = count_position[Y_AXIS], - zpos = count_position[Z_AXIS]; + const int32_t xpos = count_position[X_AXIS], + ypos = count_position[Y_AXIS], + zpos = count_position[Z_AXIS]; CRITICAL_SECTION_END; #if CORE_IS_XY || CORE_IS_XZ || IS_DELTA || IS_SCARA diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 88bbab874..5fad6a8f7 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -94,7 +94,7 @@ class Stepper { #endif // Counter variables for the Bresenham line tracer - static long counter_X, counter_Y, counter_Z, counter_E; + static int32_t counter_X, counter_Y, counter_Z, counter_E; static volatile uint32_t step_events_completed; // The number of step events executed in the current block #if ENABLED(BEZIER_JERK_CONTROL) @@ -137,8 +137,8 @@ class Stepper { static hal_timer_t acc_step_rate; // needed for deceleration start point #endif - static volatile long endstops_trigsteps[XYZ]; - static volatile long endstops_stepsTotal, endstops_stepsDone; + static volatile int32_t endstops_trigsteps[XYZ]; + static volatile int32_t endstops_stepsTotal, endstops_stepsDone; // // Positions of stepper motors, in step units @@ -154,7 +154,7 @@ class Stepper { // Mixing extruder mix counters // #if ENABLED(MIXING_EXTRUDER) - static long counter_m[MIXING_STEPPERS]; + static int32_t counter_m[MIXING_STEPPERS]; #define MIXING_STEPPERS_LOOP(VAR) \ for (uint8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++) \ if (current_block->mix_event_count[VAR]) @@ -191,9 +191,9 @@ class Stepper { // // Set the current position in steps // - static void set_position(const long &a, const long &b, const long &c, const long &e); - static void set_position(const AxisEnum &a, const long &v); - static void set_e_position(const long &e); + static void set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e); + static void set_position(const AxisEnum &a, const int32_t &v); + static void set_e_position(const int32_t &e); // // Set direction bits for all steppers @@ -203,7 +203,7 @@ class Stepper { // // Get the position of a stepper, in steps // - static long position(const AxisEnum axis); + static int32_t position(const AxisEnum axis); // // Report the positions of the steppers, in steps