dda.h: comment on these direction flags and other things.
This commit is contained in:
parent
41e76ca9fe
commit
96e9ae4dab
28
dda.c
28
dda.c
|
|
@ -483,15 +483,25 @@ void dda_start(DDA *dda) {
|
||||||
current_position.F = dda->endpoint.F;
|
current_position.F = dda->endpoint.F;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! STEP
|
/**
|
||||||
\param *dda the current move
|
\brief Do per-step movement maintenance.
|
||||||
|
|
||||||
This is called from our timer interrupt every time a step needs to occur. Keep it as simple as possible!
|
\param *dda the current move
|
||||||
We first work out which axes need to step, and generate step pulses for them
|
|
||||||
Then we re-enable global interrupts so serial data reception and other important things can occur while we do some math.
|
\details Most important task here is to update the Bresenham algorithm and
|
||||||
Next, we work out how long until our next step using the selected acceleration algorithm and set the timer.
|
to generate step pulses accordingly, this guarantees geometrical accuracy
|
||||||
Then we decide if this was the last step for this move, and if so mark this dda as dead so next timer interrupt we can start a new one.
|
of the movement. Other tasks, like acceleration calculations, are moved
|
||||||
Finally we de-assert any asserted step pins.
|
into dda_clock() as much as possible.
|
||||||
|
|
||||||
|
This is called from our timer interrupt every time a step needs to occur.
|
||||||
|
Keep it as simple and fast as possible, this is most critical for the
|
||||||
|
achievable step frequency.
|
||||||
|
|
||||||
|
Note: it was tried to do this in loops instead of straight, repeating code.
|
||||||
|
However, this resulted in at least 16% performance loss, no matter
|
||||||
|
how it was done. On how to measure, see commit "testcases: Add
|
||||||
|
config.h". On the various tries and measurement results, see commits
|
||||||
|
starting with "DDA: Move axis calculations into loops, part 6".
|
||||||
*/
|
*/
|
||||||
void dda_step(DDA *dda) {
|
void dda_step(DDA *dda) {
|
||||||
|
|
||||||
|
|
|
||||||
3
dda.h
3
dda.h
|
|
@ -106,6 +106,9 @@ typedef struct {
|
||||||
uint8_t waitfor_temp :1; ///< bool: wait for temperatures to reach their set values
|
uint8_t waitfor_temp :1; ///< bool: wait for temperatures to reach their set values
|
||||||
|
|
||||||
// directions
|
// directions
|
||||||
|
// As we have muldiv() now, overflows became much less an issue and
|
||||||
|
// it's likely time to get rid of these flags and use int instead of
|
||||||
|
// uint for distance/speed calculations. --Traumflug 2014-07-04
|
||||||
uint8_t x_direction :1; ///< direction flag for X axis
|
uint8_t x_direction :1; ///< direction flag for X axis
|
||||||
uint8_t y_direction :1; ///< direction flag for Y axis
|
uint8_t y_direction :1; ///< direction flag for Y axis
|
||||||
uint8_t z_direction :1; ///< direction flag for Z axis
|
uint8_t z_direction :1; ///< direction flag for Z axis
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue