Apply int32_t to stepper
This commit is contained in:
parent
c2c02bdc67
commit
0c23792344
@ -109,7 +109,7 @@ int16_t Stepper::cleaning_buffer_counter = 0;
|
|||||||
bool Stepper::locked_z_motor = false, Stepper::locked_z2_motor = false;
|
bool Stepper::locked_z_motor = false, Stepper::locked_z2_motor = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long Stepper::counter_X = 0,
|
int32_t Stepper::counter_X = 0,
|
||||||
Stepper::counter_Y = 0,
|
Stepper::counter_Y = 0,
|
||||||
Stepper::counter_Z = 0,
|
Stepper::counter_Z = 0,
|
||||||
Stepper::counter_E = 0;
|
Stepper::counter_E = 0;
|
||||||
@ -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 };
|
volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
|
||||||
|
|
||||||
#if ENABLED(MIXING_EXTRUDER)
|
#if ENABLED(MIXING_EXTRUDER)
|
||||||
long Stepper::counter_m[MIXING_STEPPERS];
|
int32_t Stepper::counter_m[MIXING_STEPPERS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
|
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
|
hal_timer_t Stepper::acc_step_rate; // needed for deceleration start point
|
||||||
#endif
|
#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)
|
#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
#define LOCKED_X_MOTOR locked_x_motor
|
#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
|
* This allows get_axis_position_mm to correctly
|
||||||
* derive the current XYZ position later on.
|
* 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
|
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;
|
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;
|
CRITICAL_SECTION_START;
|
||||||
count_position[axis] = v;
|
count_position[axis] = v;
|
||||||
CRITICAL_SECTION_END;
|
CRITICAL_SECTION_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stepper::set_e_position(const long &e) {
|
void Stepper::set_e_position(const int32_t &e) {
|
||||||
CRITICAL_SECTION_START;
|
CRITICAL_SECTION_START;
|
||||||
count_position[E_AXIS] = e;
|
count_position[E_AXIS] = e;
|
||||||
CRITICAL_SECTION_END;
|
CRITICAL_SECTION_END;
|
||||||
@ -2024,9 +2024,9 @@ void Stepper::set_e_position(const long &e) {
|
|||||||
/**
|
/**
|
||||||
* Get a stepper's position in steps.
|
* Get a stepper's position in steps.
|
||||||
*/
|
*/
|
||||||
long Stepper::position(const AxisEnum axis) {
|
int32_t Stepper::position(const AxisEnum axis) {
|
||||||
CRITICAL_SECTION_START;
|
CRITICAL_SECTION_START;
|
||||||
const long count_pos = count_position[axis];
|
const int32_t count_pos = count_position[axis];
|
||||||
CRITICAL_SECTION_END;
|
CRITICAL_SECTION_END;
|
||||||
return count_pos;
|
return count_pos;
|
||||||
}
|
}
|
||||||
@ -2095,7 +2095,7 @@ void Stepper::endstop_triggered(const AxisEnum axis) {
|
|||||||
|
|
||||||
void Stepper::report_positions() {
|
void Stepper::report_positions() {
|
||||||
CRITICAL_SECTION_START;
|
CRITICAL_SECTION_START;
|
||||||
const long xpos = count_position[X_AXIS],
|
const int32_t xpos = count_position[X_AXIS],
|
||||||
ypos = count_position[Y_AXIS],
|
ypos = count_position[Y_AXIS],
|
||||||
zpos = count_position[Z_AXIS];
|
zpos = count_position[Z_AXIS];
|
||||||
CRITICAL_SECTION_END;
|
CRITICAL_SECTION_END;
|
||||||
|
@ -94,7 +94,7 @@ class Stepper {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Counter variables for the Bresenham line tracer
|
// 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
|
static volatile uint32_t step_events_completed; // The number of step events executed in the current block
|
||||||
|
|
||||||
#if ENABLED(BEZIER_JERK_CONTROL)
|
#if ENABLED(BEZIER_JERK_CONTROL)
|
||||||
@ -137,8 +137,8 @@ class Stepper {
|
|||||||
static hal_timer_t acc_step_rate; // needed for deceleration start point
|
static hal_timer_t acc_step_rate; // needed for deceleration start point
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static volatile long endstops_trigsteps[XYZ];
|
static volatile int32_t endstops_trigsteps[XYZ];
|
||||||
static volatile long endstops_stepsTotal, endstops_stepsDone;
|
static volatile int32_t endstops_stepsTotal, endstops_stepsDone;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Positions of stepper motors, in step units
|
// Positions of stepper motors, in step units
|
||||||
@ -154,7 +154,7 @@ class Stepper {
|
|||||||
// Mixing extruder mix counters
|
// Mixing extruder mix counters
|
||||||
//
|
//
|
||||||
#if ENABLED(MIXING_EXTRUDER)
|
#if ENABLED(MIXING_EXTRUDER)
|
||||||
static long counter_m[MIXING_STEPPERS];
|
static int32_t counter_m[MIXING_STEPPERS];
|
||||||
#define MIXING_STEPPERS_LOOP(VAR) \
|
#define MIXING_STEPPERS_LOOP(VAR) \
|
||||||
for (uint8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++) \
|
for (uint8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++) \
|
||||||
if (current_block->mix_event_count[VAR])
|
if (current_block->mix_event_count[VAR])
|
||||||
@ -191,9 +191,9 @@ class Stepper {
|
|||||||
//
|
//
|
||||||
// Set the current position in steps
|
// 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 int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e);
|
||||||
static void set_position(const AxisEnum &a, const long &v);
|
static void set_position(const AxisEnum &a, const int32_t &v);
|
||||||
static void set_e_position(const long &e);
|
static void set_e_position(const int32_t &e);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set direction bits for all steppers
|
// Set direction bits for all steppers
|
||||||
@ -203,7 +203,7 @@ class Stepper {
|
|||||||
//
|
//
|
||||||
// Get the position of a stepper, in steps
|
// 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
|
// Report the positions of the steppers, in steps
|
||||||
|
Loading…
Reference in New Issue
Block a user