|
@ -124,10 +124,7 @@ class I2CPositionEncoder { |
|
|
invert = false, |
|
|
invert = false, |
|
|
ec = true; |
|
|
ec = true; |
|
|
|
|
|
|
|
|
float axisOffset = 0; |
|
|
int32_t zeroOffset = 0, |
|
|
|
|
|
|
|
|
int32_t axisOffsetTicks = 0, |
|
|
|
|
|
zeroOffset = 0, |
|
|
|
|
|
lastPosition = 0, |
|
|
lastPosition = 0, |
|
|
position; |
|
|
position; |
|
|
|
|
|
|
|
@ -165,7 +162,7 @@ class I2CPositionEncoder { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
FORCE_INLINE float get_position_mm() { return mm_from_count(get_position()); } |
|
|
FORCE_INLINE float get_position_mm() { return mm_from_count(get_position()); } |
|
|
FORCE_INLINE int32_t get_position() { return get_raw_count() - zeroOffset - axisOffsetTicks; } |
|
|
FORCE_INLINE int32_t get_position() { return get_raw_count() - zeroOffset; } |
|
|
|
|
|
|
|
|
int32_t get_axis_error_steps(const bool report); |
|
|
int32_t get_axis_error_steps(const bool report); |
|
|
float get_axis_error_mm(const bool report); |
|
|
float get_axis_error_mm(const bool report); |
|
@ -216,16 +213,6 @@ class I2CPositionEncoder { |
|
|
|
|
|
|
|
|
FORCE_INLINE int get_stepper_ticks() { return stepperTicks; } |
|
|
FORCE_INLINE int get_stepper_ticks() { return stepperTicks; } |
|
|
FORCE_INLINE void set_stepper_ticks(const int ticks) { stepperTicks = ticks; } |
|
|
FORCE_INLINE void set_stepper_ticks(const int ticks) { stepperTicks = ticks; } |
|
|
|
|
|
|
|
|
FORCE_INLINE float get_axis_offset() { return axisOffset; } |
|
|
|
|
|
FORCE_INLINE void set_axis_offset(const float newOffset) { |
|
|
|
|
|
axisOffset = newOffset; |
|
|
|
|
|
axisOffsetTicks = int32_t(axisOffset * get_encoder_ticks_mm()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE void set_current_position(const float newPositionMm) { |
|
|
|
|
|
set_axis_offset(get_position_mm() - newPositionMm + axisOffset); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class I2CPositionEncodersMgr { |
|
|
class I2CPositionEncodersMgr { |
|
|