makes sure steppers cruise at exactly nominal rate to eliminate rounding errors. Possibly fixes the problem where some moves have a long tail of slow steps. (Untested)

This commit is contained in:
Simen Svale Skogsrud 2011-02-11 01:31:44 +01:00
parent d96e48cecf
commit ef61efbf70
2 changed files with 9 additions and 2 deletions

View File

@ -18,6 +18,8 @@
along with Grbl. If not, see <http://www.gnu.org/licenses/>. along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis. */
/* /*
Reasoning behind the mathematics in this module (in the key of 'Mathematica'): Reasoning behind the mathematics in this module (in the key of 'Mathematica'):

View File

@ -19,8 +19,7 @@
*/ */
/* The timer calculations of this module informed by the 'RepRap cartesian firmware' by Zack Smith /* The timer calculations of this module informed by the 'RepRap cartesian firmware' by Zack Smith
and Philipp Tiefenbacher. The ring buffer implementation gleaned from the wiring_serial library and Philipp Tiefenbacher. */
by David A. Mellis */
#include "stepper.h" #include "stepper.h"
#include "config.h" #include "config.h"
@ -108,6 +107,12 @@ inline void trapezoid_generator_tick() {
trapezoid_adjusted_rate -= current_block->rate_delta; trapezoid_adjusted_rate -= current_block->rate_delta;
} }
set_step_events_per_minute(trapezoid_adjusted_rate); set_step_events_per_minute(trapezoid_adjusted_rate);
} else {
// Make sure we cruise at exactly nominal rate
if (trapezoid_adjusted_rate != current_block->nominal_rate) {
trapezoid_adjusted_rate = current_block->nominal_rate;
set_step_events_per_minute(trapezoid_adjusted_rate);
}
} }
} }
} }