Skip to content

Commit

Permalink
dda.c, RAMPING: 16 bits for move_state.n are sufficient.
Browse files Browse the repository at this point in the history
  • Loading branch information
Traumflug committed May 15, 2011
1 parent 826f534 commit bebb619
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dda.c
Expand Up @@ -532,7 +532,7 @@ void dda_step(DDA *dda) {

// debug ramping algorithm
//if (dda->step_no == 0) {
// sersendf_P(PSTR("\r\nc %lu c_min %lu n %ld"), dda->c, dda->c_min, move_state.n);
// sersendf_P(PSTR("\r\nc %lu c_min %lu n %d"), dda->c, dda->c_min, move_state.n);
//}

recalc_speed = 0;
Expand All @@ -549,14 +549,14 @@ void dda_step(DDA *dda) {
if (recalc_speed) {
move_state.n += 4;
// be careful of signedness!
move_state.c = (int32_t)move_state.c - ((int32_t)(move_state.c * 2) / move_state.n);
move_state.c = (int32_t)move_state.c - ((int32_t)(move_state.c * 2) / (int32_t)move_state.n);
}
dda->step_no++;

// debug ramping algorithm
// for very low speeds like 10 mm/min, only
//if (dda->step_no % 10 /* 10, 100, ...*/ == 0)
// sersendf_P(PSTR("\r\nc %lu c_min %lu n %ld"), dda->c, dda->c_min, move_state.n);
// sersendf_P(PSTR("\r\nc %lu c_min %lu n %d"), dda->c, dda->c_min, move_state.n);
#endif

// TODO: did_step is obsolete ...
Expand Down
2 changes: 1 addition & 1 deletion dda.h
Expand Up @@ -59,7 +59,7 @@ typedef struct {
/// time until next step
uint32_t c;
/// tracking variable
int32_t n;
int16_t n;
#endif
} MOVE_STATE;

Expand Down

0 comments on commit bebb619

Please sign in to comment.