DDA: extruders aren't subject to kinematics.
As such, move extruder handling out of dda_kinematics.c into dda.c.
This commit is contained in:
parent
705e4563db
commit
6cce9d173a
9
dda.c
9
dda.c
|
|
@ -118,6 +118,7 @@ void dda_init(void) {
|
||||||
*/
|
*/
|
||||||
void dda_new_startpoint(void) {
|
void dda_new_startpoint(void) {
|
||||||
axes_um_to_steps(startpoint.axis, startpoint_steps.axis);
|
axes_um_to_steps(startpoint.axis, startpoint_steps.axis);
|
||||||
|
startpoint_steps.axis[E] = um_to_steps(startpoint.axis[E], E);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! CREATE a dda given current_position and a target, save to passed location so we can write directly into the queue
|
/*! CREATE a dda given current_position and a target, save to passed location so we can write directly into the queue
|
||||||
|
|
@ -184,6 +185,7 @@ void dda_create(DDA *dda, TARGET *target) {
|
||||||
dda->id = idcnt++;
|
dda->id = idcnt++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Handle bot axes. They're subject to kinematics considerations.
|
||||||
code_axes_to_stepper_axes(&startpoint, target, delta_um, steps);
|
code_axes_to_stepper_axes(&startpoint, target, delta_um, steps);
|
||||||
for (i = X; i < E; i++) {
|
for (i = X; i < E; i++) {
|
||||||
int32_t delta_steps;
|
int32_t delta_steps;
|
||||||
|
|
@ -210,11 +212,14 @@ void dda_create(DDA *dda, TARGET *target) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this can likely be, at least partially, joined with the above for()
|
// Handle extruder axes. They act independently from the bots kinematics
|
||||||
// loop. Lots of almost-duplicate code.
|
// type, but are subject to other special handling.
|
||||||
|
steps[E] = um_to_steps(target->axis[E], E);
|
||||||
|
|
||||||
if ( ! target->e_relative) {
|
if ( ! target->e_relative) {
|
||||||
int32_t delta_steps;
|
int32_t delta_steps;
|
||||||
|
|
||||||
|
delta_um[E] = (uint32_t)labs(target->axis[E] - startpoint.axis[E]);
|
||||||
delta_steps = steps[E] - startpoint_steps.axis[E];
|
delta_steps = steps[E] - startpoint_steps.axis[E];
|
||||||
dda->delta[E] = (uint32_t)labs(delta_steps);
|
dda->delta[E] = (uint32_t)labs(delta_steps);
|
||||||
startpoint_steps.axis[E] = steps[E];
|
startpoint_steps.axis[E] = steps[E];
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ carthesian_to_carthesian(TARGET *startpoint, TARGET *target,
|
||||||
axes_uint32_t delta_um, axes_int32_t steps) {
|
axes_uint32_t delta_um, axes_int32_t steps) {
|
||||||
enum axis_e i;
|
enum axis_e i;
|
||||||
|
|
||||||
for (i = X; i < AXIS_COUNT; i++) {
|
for (i = X; i < E; i++) {
|
||||||
delta_um[i] = (uint32_t)labs(target->axis[i] - startpoint->axis[i]);
|
delta_um[i] = (uint32_t)labs(target->axis[i] - startpoint->axis[i]);
|
||||||
steps[i] = um_to_steps(target->axis[i], i);
|
steps[i] = um_to_steps(target->axis[i], i);
|
||||||
}
|
}
|
||||||
|
|
@ -28,14 +28,13 @@ carthesian_to_corexy(TARGET *startpoint, TARGET *target,
|
||||||
delta_um[Y] = (uint32_t)labs((target->axis[X] - startpoint->axis[X]) -
|
delta_um[Y] = (uint32_t)labs((target->axis[X] - startpoint->axis[X]) -
|
||||||
(target->axis[Y] - startpoint->axis[Y]));
|
(target->axis[Y] - startpoint->axis[Y]));
|
||||||
delta_um[Z] = (uint32_t)labs(target->axis[Z] - startpoint->axis[Z]);
|
delta_um[Z] = (uint32_t)labs(target->axis[Z] - startpoint->axis[Z]);
|
||||||
delta_um[E] = (uint32_t)labs(target->axis[E] - startpoint->axis[E]);
|
|
||||||
axes_um_to_steps_corexy(target->axis, steps);
|
axes_um_to_steps_corexy(target->axis, steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void axes_um_to_steps_cartesian(const axes_int32_t um, axes_int32_t steps) {
|
void axes_um_to_steps_cartesian(const axes_int32_t um, axes_int32_t steps) {
|
||||||
enum axis_e i;
|
enum axis_e i;
|
||||||
|
|
||||||
for (i = X; i < AXIS_COUNT; i++) {
|
for (i = X; i < E; i++) {
|
||||||
steps[i] = um_to_steps(um[i], i);
|
steps[i] = um_to_steps(um[i], i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -44,5 +43,4 @@ void axes_um_to_steps_corexy(const axes_int32_t um, axes_int32_t steps) {
|
||||||
steps[X] = um_to_steps(um[X] + um[Y], X);
|
steps[X] = um_to_steps(um[X] + um[Y], X);
|
||||||
steps[Y] = um_to_steps(um[X] - um[Y], Y);
|
steps[Y] = um_to_steps(um[X] - um[Y], Y);
|
||||||
steps[Z] = um_to_steps(um[Z], Z);
|
steps[Z] = um_to_steps(um[Z], Z);
|
||||||
steps[E] = um_to_steps(um[E], E);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue