️ Optimize FT Motion load block data (#27991)

This commit is contained in:
narno2202 2025-09-08 03:38:37 +02:00 committed by GitHub
parent fc4abd1335
commit a54daeeb39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 29 deletions

View file

@ -290,17 +290,17 @@ void MarlinUI::draw_status_screen() {
);
}
uint16_t hx = STATUS_HEATERS_X;
uint16_t shx = STATUS_HEATERS_X;
#if HAS_HOTEND
_draw_heater_status(H_E0, hx, STATUS_HEATERS_Y);
hx += STATUS_HEATERS_XSPACE;
_draw_heater_status(H_E0, shx, STATUS_HEATERS_Y);
shx += STATUS_HEATERS_XSPACE;
#endif
#if HAS_MULTI_HOTEND
_draw_heater_status(H_E1, hx, STATUS_HEATERS_Y);
hx += STATUS_HEATERS_XSPACE;
_draw_heater_status(H_E1, shx, STATUS_HEATERS_Y);
shx += STATUS_HEATERS_XSPACE;
#endif
#if HAS_HEATED_BED
_draw_heater_status(H_BED, hx, STATUS_HEATERS_Y);
_draw_heater_status(H_BED, shx, STATUS_HEATERS_Y);
#endif
#if HAS_FAN
_draw_fan_status(LCD_PIXEL_WIDTH - STATUS_CHR_WIDTH * 5, STATUS_FAN_Y);

View file

@ -467,18 +467,8 @@ void FTMotion::loadBlockData(block_t * const current_block) {
oneOverLength = 1.0f / totalLength;
startPosn = endPosn_prevBlock;
const xyze_pos_t moveDist = LOGICAL_AXIS_ARRAY(
current_block->steps.e * planner.mm_per_step[block_extruder_axis] * (current_block->direction_bits.e ? 1 : -1),
current_block->steps.x * planner.mm_per_step[X_AXIS] * (current_block->direction_bits.x ? 1 : -1),
current_block->steps.y * planner.mm_per_step[Y_AXIS] * (current_block->direction_bits.y ? 1 : -1),
current_block->steps.z * planner.mm_per_step[Z_AXIS] * (current_block->direction_bits.z ? 1 : -1),
current_block->steps.i * planner.mm_per_step[I_AXIS] * (current_block->direction_bits.i ? 1 : -1),
current_block->steps.j * planner.mm_per_step[J_AXIS] * (current_block->direction_bits.j ? 1 : -1),
current_block->steps.k * planner.mm_per_step[K_AXIS] * (current_block->direction_bits.k ? 1 : -1),
current_block->steps.u * planner.mm_per_step[U_AXIS] * (current_block->direction_bits.u ? 1 : -1),
current_block->steps.v * planner.mm_per_step[V_AXIS] * (current_block->direction_bits.v ? 1 : -1),
current_block->steps.w * planner.mm_per_step[W_AXIS] * (current_block->direction_bits.w ? 1 : -1)
);
const xyze_pos_t& moveDist = current_block->dist_mm;
ratio = moveDist * oneOverLength;
@ -566,17 +556,14 @@ void FTMotion::loadBlockData(block_t * const current_block) {
// Watch endstops until the move ends
const millis_t move_end_ti = millis() + SEC_TO_MS((FTM_TS) * float(max_intervals + num_samples_shaper_settle() + ((PROP_BATCHES) + 1) * (FTM_BATCH_SIZE)) + (float(FTM_STEPPERCMD_BUFF_SIZE) / float(FTM_STEPPER_FS)));
#define __SET_MOVE_END(A,V) do{ if (V) { axis_move_end_ti.A = move_end_ti; axis_move_dir.A = (V > 0); } }while(0);
#define _SET_MOVE_END(A) __SET_MOVE_END(A, moveDist[_AXIS(A)])
#if CORE_IS_XY
__SET_MOVE_END(X, moveDist.x + moveDist.y);
__SET_MOVE_END(Y, moveDist.x - moveDist.y);
#else
_SET_MOVE_END(X);
_SET_MOVE_END(Y);
#endif
TERN_(HAS_Z_AXIS, _SET_MOVE_END(Z));
SECONDARY_AXIS_MAP(_SET_MOVE_END);
#define _SET_MOVE_END(A) do{ \
if (moveDist.A) { \
axis_move_end_ti.A = move_end_ti; \
axis_move_dir.A = moveDist.A > 0; \
} \
}while(0);
LOGICAL_AXIS_MAP(_SET_MOVE_END);
}
// Generate data points of the trajectory.

View file

@ -2097,6 +2097,8 @@ bool Planner::_populate_block(
TERN_(BACKLASH_COMPENSATION, backlash.add_correction_steps(dist, dm, block));
}
TERN_(FT_MOTION, block->dist_mm = dist_mm); // Store the distance for all axes in mm for this block
TERN_(HAS_EXTRUDERS, block->steps.e = esteps);
block->step_event_count = (

View file

@ -266,6 +266,10 @@ typedef struct PlannerBlock {
AxisBits direction_bits; // Direction bits set for this block, where 1 is negative motion
#if ENABLED(FT_MOTION)
xyze_pos_t dist_mm; // The distance traveled in mm along each axis
#endif
// Advance extrusion
#if ENABLED(LIN_ADVANCE)
#if ENABLED(SMOOTH_LIN_ADVANCE)