👷 Add optimal stepper.set_e_position() (#27293)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Andrew 2024-07-22 16:33:37 -04:00 committed by GitHub
parent cdea1b8460
commit 94ce0d24d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 1 deletions

View file

@ -3192,7 +3192,7 @@ void Planner::set_position_mm(const xyze_pos_t &xyze) {
if (has_blocks_queued())
buffer_sync_block(BLOCK_BIT_SYNC_POSITION);
else
stepper.set_axis_position(E_AXIS, position.e);
stepper.set_e_position(position.e);
}
#endif // HAS_EXTRUDERS

View file

@ -3407,6 +3407,18 @@ void Stepper::set_axis_position(const AxisEnum a, const int32_t &v) {
#endif
}
#if HAS_EXTRUDERS
void Stepper::set_e_position(const int32_t &v) {
planner.synchronize();
AVR_ATOMIC_SECTION_START();
count_position.e = v;
AVR_ATOMIC_SECTION_END();
}
#endif // HAS_EXTRUDERS
#if ENABLED(FT_MOTION)
void Stepper::ftMotion_syncPosition() {

View file

@ -540,6 +540,11 @@ class Stepper {
static void set_position(const xyze_long_t &spos);
static void set_axis_position(const AxisEnum a, const int32_t &v);
#if HAS_EXTRUDERS
// Save a little when E is the only one used
static void set_e_position(const int32_t &v);
#endif
// Report the positions of the steppers, in steps
static void report_a_position(const xyz_long_t &pos);
static void report_positions();