Apply int32_t to stepper
This commit is contained in:
parent
42180e25a3
commit
1682036533
@ -91,10 +91,10 @@ 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;
|
||||||
|
|
||||||
volatile uint32_t Stepper::step_events_completed = 0; // The number of step events executed in the current block
|
volatile uint32_t Stepper::step_events_completed = 0; // The number of step events executed in the current block
|
||||||
|
|
||||||
@ -123,13 +123,13 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
|
|||||||
|
|
||||||
#endif // LIN_ADVANCE
|
#endif // LIN_ADVANCE
|
||||||
|
|
||||||
long Stepper::acceleration_time, Stepper::deceleration_time;
|
int32_t Stepper::acceleration_time, Stepper::deceleration_time;
|
||||||
|
|
||||||
volatile long Stepper::count_position[NUM_AXIS] = { 0 };
|
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;
|
||||||
@ -137,7 +137,7 @@ uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
|
|||||||
uint16_t Stepper::OCR1A_nominal,
|
uint16_t Stepper::OCR1A_nominal,
|
||||||
Stepper::acc_step_rate; // needed for deceleration start point
|
Stepper::acc_step_rate; // needed for deceleration start point
|
||||||
|
|
||||||
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
|
||||||
@ -1120,7 +1120,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
|
||||||
|
|
||||||
@ -1153,13 +1153,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;
|
||||||
@ -1168,9 +1168,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;
|
||||||
}
|
}
|
||||||
@ -1239,9 +1239,9 @@ 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;
|
||||||
|
|
||||||
#if CORE_IS_XY || CORE_IS_XZ || IS_DELTA || IS_SCARA
|
#if CORE_IS_XY || CORE_IS_XZ || IS_DELTA || IS_SCARA
|
||||||
|
@ -119,7 +119,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(LIN_ADVANCE)
|
#if ENABLED(LIN_ADVANCE)
|
||||||
@ -142,19 +142,19 @@ class Stepper {
|
|||||||
|
|
||||||
#endif // !LIN_ADVANCE
|
#endif // !LIN_ADVANCE
|
||||||
|
|
||||||
static long acceleration_time, deceleration_time;
|
static int32_t acceleration_time, deceleration_time;
|
||||||
static uint8_t step_loops, step_loops_nominal;
|
static uint8_t step_loops, step_loops_nominal;
|
||||||
|
|
||||||
static uint16_t OCR1A_nominal,
|
static uint16_t OCR1A_nominal,
|
||||||
acc_step_rate; // needed for deceleration start point
|
acc_step_rate; // needed for deceleration start point
|
||||||
|
|
||||||
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
|
||||||
//
|
//
|
||||||
static volatile long count_position[NUM_AXIS];
|
static volatile int32_t count_position[NUM_AXIS];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Current direction of stepper motors (+1 or -1)
|
// Current direction of stepper motors (+1 or -1)
|
||||||
@ -165,7 +165,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])
|
||||||
@ -202,9 +202,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
|
||||||
@ -214,7 +214,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