Permalink
Browse files

dda.c, RAMPING: 16 bits for move_state.n are sufficient.

  • Loading branch information...
1 parent 826f534 commit bebb619054d5c56d65120819666cfedbe2c720ea @Traumflug Traumflug committed May 15, 2011
Showing with 4 additions and 4 deletions.
  1. +3 −3 dda.c
  2. +1 −1 dda.h
View
6 dda.c
@@ -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;
@@ -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 ...
View
2 dda.h
@@ -59,7 +59,7 @@ typedef struct {
/// time until next step
uint32_t c;
/// tracking variable
- int32_t n;
+ int16_t n;
#endif
} MOVE_STATE;

0 comments on commit bebb619

Please sign in to comment.