mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
Optimize calculation of block->millimeters for DELTA
This commit is contained in:
parent
db5df9500b
commit
b921f6b69d
@ -803,10 +803,16 @@ void Planner::check_axes_activity() {
|
|||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
float delta_mm[4];
|
float delta_mm[4];
|
||||||
|
#if ENABLED(DELTA)
|
||||||
|
// On delta all axes (should!) have the same steps-per-mm
|
||||||
|
// so calculate distance in steps first, then do one division
|
||||||
|
// at the end to get millimeters
|
||||||
|
#else
|
||||||
delta_mm[X_AXIS] = dx / axis_steps_per_mm[X_AXIS];
|
delta_mm[X_AXIS] = dx / axis_steps_per_mm[X_AXIS];
|
||||||
delta_mm[Y_AXIS] = dy / axis_steps_per_mm[Y_AXIS];
|
delta_mm[Y_AXIS] = dy / axis_steps_per_mm[Y_AXIS];
|
||||||
delta_mm[Z_AXIS] = dz / axis_steps_per_mm[Z_AXIS];
|
delta_mm[Z_AXIS] = dz / axis_steps_per_mm[Z_AXIS];
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
delta_mm[E_AXIS] = (de / axis_steps_per_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
|
delta_mm[E_AXIS] = (de / axis_steps_per_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
|
||||||
|
|
||||||
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
|
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
|
||||||
@ -820,10 +826,16 @@ void Planner::check_axes_activity() {
|
|||||||
sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD])
|
sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD])
|
||||||
#elif ENABLED(COREYZ)
|
#elif ENABLED(COREYZ)
|
||||||
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
|
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
|
||||||
|
#elif ENABLED(DELTA)
|
||||||
|
sq(dx) + sq(dy) + sq(dz)
|
||||||
#else
|
#else
|
||||||
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])
|
sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])
|
||||||
#endif
|
#endif
|
||||||
);
|
)
|
||||||
|
#if ENABLED(DELTA)
|
||||||
|
/ axis_steps_per_mm[X_AXIS]
|
||||||
|
#endif
|
||||||
|
;
|
||||||
}
|
}
|
||||||
float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
|
float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user