Add custom types for position (#15204)

This commit is contained in:
Scott Lahteine
2019-09-29 04:25:39 -05:00
committed by GitHub
parent 43d6e9fa43
commit 50e4545255
227 changed files with 3147 additions and 3264 deletions

View File

@ -278,9 +278,9 @@ class Stepper {
#endif
// Delta error variables for the Bresenham line tracer
static int32_t delta_error[XYZE];
static uint32_t advance_dividend[XYZE],
advance_divisor,
static xyze_long_t delta_error;
static xyze_ulong_t advance_dividend;
static uint32_t advance_divisor,
step_events_completed, // The number of step events executed in the current block
accelerate_until, // The point from where we need to stop acceleration
decelerate_after, // The point from where we need to start decelerating
@ -320,17 +320,17 @@ class Stepper {
//
// Exact steps at which an endstop was triggered
//
static volatile int32_t endstops_trigsteps[XYZ];
static xyz_long_t endstops_trigsteps;
//
// Positions of stepper motors, in step units
//
static volatile int32_t count_position[NUM_AXIS];
static xyze_long_t count_position;
//
// Current direction of stepper motors (+1 or -1)
//
static int8_t count_direction[NUM_AXIS];
static xyze_int8_t count_direction;
public:
@ -382,13 +382,11 @@ class Stepper {
// The extruder associated to the last movement
FORCE_INLINE static uint8_t movement_extruder() {
return
#if ENABLED(MIXING_EXTRUDER) || EXTRUDERS < 2
0
#else
last_moved_extruder
return (0
#if EXTRUDERS > 1 && DISABLED(MIXING_EXTRUDER)
+ last_moved_extruder
#endif
;
);
}
// Handle a triggered endstop
@ -443,8 +441,9 @@ class Stepper {
_set_position(a, b, c, e);
if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
}
static inline void set_position(const xyze_long_t &abce) { set_position(abce.a, abce.b, abce.c, abce.e); }
static inline void set_position(const AxisEnum a, const int32_t &v) {
static inline void set_axis_position(const AxisEnum a, const int32_t &v) {
planner.synchronize();
#ifdef __AVR__
@ -469,6 +468,7 @@ class Stepper {
// Set the current position in steps
static void _set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e);
FORCE_INLINE static void _set_position(const abce_long_t &spos) { _set_position(spos.a, spos.b, spos.c, spos.e); }
FORCE_INLINE static uint32_t calc_timer_interval(uint32_t step_rate, uint8_t scale, uint8_t* loops) {
uint32_t timer;