dda.c: fix overflow for large steps/meter values.
The trick is to use doubles earlier. As these calculations are optimised out anyways, binary size and performance is kept. Verified to have an identical outcome on a few common steps/mm and acceleration cases.
This commit is contained in:
parent
6820e2cc0a
commit
fb249214f0
8
dda.c
8
dda.c
|
|
@ -74,10 +74,10 @@ static const axes_uint32_t PROGMEM maximum_feedrate_P = {
|
|||
/// \brief Initialization constant for the ramping algorithm. Timer cycles for
|
||||
/// first step interval.
|
||||
static const axes_uint32_t PROGMEM c0_P = {
|
||||
(uint32_t)((double)F_CPU / SQRT((double)(STEPS_PER_M_X * ACCELERATION / 2000.))),
|
||||
(uint32_t)((double)F_CPU / SQRT((double)(STEPS_PER_M_Y * ACCELERATION / 2000.))),
|
||||
(uint32_t)((double)F_CPU / SQRT((double)(STEPS_PER_M_Z * ACCELERATION / 2000.))),
|
||||
(uint32_t)((double)F_CPU / SQRT((double)(STEPS_PER_M_E * ACCELERATION / 2000.)))
|
||||
(uint32_t)((double)F_CPU / SQRT((double)STEPS_PER_M_X * ACCELERATION / 2000.)),
|
||||
(uint32_t)((double)F_CPU / SQRT((double)STEPS_PER_M_Y * ACCELERATION / 2000.)),
|
||||
(uint32_t)((double)F_CPU / SQRT((double)STEPS_PER_M_Z * ACCELERATION / 2000.)),
|
||||
(uint32_t)((double)F_CPU / SQRT((double)STEPS_PER_M_E * ACCELERATION / 2000.))
|
||||
};
|
||||
|
||||
/*! Set the direction of the 'n' axis
|
||||
|
|
|
|||
Loading…
Reference in New Issue