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:
Markus Hitter 2016-06-27 13:23:49 +02:00
parent 705e4563db
commit 6cce9d173a
2 changed files with 9 additions and 6 deletions

9
dda.c
View File

@ -118,6 +118,7 @@ void dda_init(void) {
*/
void dda_new_startpoint(void) {
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
@ -184,6 +185,7 @@ void dda_create(DDA *dda, TARGET *target) {
dda->id = idcnt++;
#endif
// Handle bot axes. They're subject to kinematics considerations.
code_axes_to_stepper_axes(&startpoint, target, delta_um, steps);
for (i = X; i < E; i++) {
int32_t delta_steps;
@ -210,11 +212,14 @@ void dda_create(DDA *dda, TARGET *target) {
#endif
}
// TODO: this can likely be, at least partially, joined with the above for()
// loop. Lots of almost-duplicate code.
// Handle extruder axes. They act independently from the bots kinematics
// type, but are subject to other special handling.
steps[E] = um_to_steps(target->axis[E], E);
if ( ! target->e_relative) {
int32_t delta_steps;
delta_um[E] = (uint32_t)labs(target->axis[E] - startpoint.axis[E]);
delta_steps = steps[E] - startpoint_steps.axis[E];
dda->delta[E] = (uint32_t)labs(delta_steps);
startpoint_steps.axis[E] = steps[E];

View File

@ -13,7 +13,7 @@ carthesian_to_carthesian(TARGET *startpoint, TARGET *target,
axes_uint32_t delta_um, axes_int32_t steps) {
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]);
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]) -
(target->axis[Y] - startpoint->axis[Y]));
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);
}
void axes_um_to_steps_cartesian(const axes_int32_t um, axes_int32_t steps) {
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);
}
}
@ -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[Y] = um_to_steps(um[X] - um[Y], Y);
steps[Z] = um_to_steps(um[Z], Z);
steps[E] = um_to_steps(um[E], E);
}