Followup to stepper/planner refactor
This commit is contained in:
parent
6dfbb39f83
commit
435ecb6b67
|
@ -962,7 +962,7 @@ void Planner::reverse_pass() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The kernel called by recalculate() when scanning the plan from first to last entry.
|
// The kernel called by recalculate() when scanning the plan from first to last entry.
|
||||||
void Planner::forward_pass_kernel(const block_t * const previous, block_t* const current, uint8_t block_index) {
|
void Planner::forward_pass_kernel(const block_t* const previous, block_t* const current, const uint8_t block_index) {
|
||||||
if (previous) {
|
if (previous) {
|
||||||
// If the previous block is an acceleration block, too short to complete the full speed
|
// If the previous block is an acceleration block, too short to complete the full speed
|
||||||
// change, adjust the entry speed accordingly. Entry speeds have already been reset,
|
// change, adjust the entry speed accordingly. Entry speeds have already been reset,
|
||||||
|
@ -2234,7 +2234,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||||
if (block->millimeters < 1.0) {
|
if (block->millimeters < 1.0) {
|
||||||
|
|
||||||
// Fast acos approximation, minus the error bar to be safe
|
// Fast acos approximation, minus the error bar to be safe
|
||||||
float junction_theta = (RADIANS(-40) * sq(junction_cos_theta) - RADIANS(50)) * junction_cos_theta + RADIANS(90) - 0.18;
|
const float junction_theta = (RADIANS(-40) * sq(junction_cos_theta) - RADIANS(50)) * junction_cos_theta + RADIANS(90) - 0.18;
|
||||||
|
|
||||||
// If angle is greater than 135 degrees (octagon), find speed for approximate arc
|
// If angle is greater than 135 degrees (octagon), find speed for approximate arc
|
||||||
if (junction_theta > RADIANS(135)) {
|
if (junction_theta > RADIANS(135)) {
|
||||||
|
|
|
@ -452,7 +452,7 @@ class Planner {
|
||||||
* - Wait for the number of spaces to open up in the planner
|
* - Wait for the number of spaces to open up in the planner
|
||||||
* - Return the first head block
|
* - Return the first head block
|
||||||
*/
|
*/
|
||||||
FORCE_INLINE static block_t* get_next_free_block(uint8_t &next_buffer_head, uint8_t count = 1) {
|
FORCE_INLINE static block_t* get_next_free_block(uint8_t &next_buffer_head, const uint8_t count=1) {
|
||||||
|
|
||||||
// Wait until there are enough slots free
|
// Wait until there are enough slots free
|
||||||
while (moves_free() < count) { idle(); }
|
while (moves_free() < count) { idle(); }
|
||||||
|
|
|
@ -2035,7 +2035,7 @@ int32_t Stepper::position(const AxisEnum axis) {
|
||||||
if (was_enabled) DISABLE_STEPPER_DRIVER_INTERRUPT();
|
if (was_enabled) DISABLE_STEPPER_DRIVER_INTERRUPT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t v = count_position[axis];
|
const int32_t v = count_position[axis];
|
||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
// Reenable Stepper ISR
|
// Reenable Stepper ISR
|
||||||
|
|
|
@ -98,8 +98,8 @@ class Stepper {
|
||||||
static int32_t bezier_A, // A coefficient in Bézier speed curve
|
static int32_t bezier_A, // A coefficient in Bézier speed curve
|
||||||
bezier_B, // B coefficient in Bézier speed curve
|
bezier_B, // B coefficient in Bézier speed curve
|
||||||
bezier_C; // C coefficient in Bézier speed curve
|
bezier_C; // C coefficient in Bézier speed curve
|
||||||
static uint32_t bezier_F; // F coefficient in Bézier speed curve
|
static uint32_t bezier_F, // F coefficient in Bézier speed curve
|
||||||
static uint32_t bezier_AV; // AV coefficient in Bézier speed curve
|
bezier_AV; // AV coefficient in Bézier speed curve
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
static bool A_negative; // If A coefficient was negative
|
static bool A_negative; // If A coefficient was negative
|
||||||
#endif
|
#endif
|
||||||
|
@ -297,8 +297,8 @@ class Stepper {
|
||||||
NOLESS(step_rate, uint32_t(F_CPU / 500000U));
|
NOLESS(step_rate, uint32_t(F_CPU / 500000U));
|
||||||
step_rate -= F_CPU / 500000; // Correct for minimal speed
|
step_rate -= F_CPU / 500000; // Correct for minimal speed
|
||||||
if (step_rate >= (8 * 256)) { // higher step rate
|
if (step_rate >= (8 * 256)) { // higher step rate
|
||||||
uint8_t tmp_step_rate = (step_rate & 0x00FF);
|
const uint8_t tmp_step_rate = (step_rate & 0x00FF);
|
||||||
uint16_t table_address = (uint16_t)&speed_lookuptable_fast[(uint8_t)(step_rate >> 8)][0],
|
const uint16_t table_address = (uint16_t)&speed_lookuptable_fast[(uint8_t)(step_rate >> 8)][0],
|
||||||
gain = (uint16_t)pgm_read_word_near(table_address + 2);
|
gain = (uint16_t)pgm_read_word_near(table_address + 2);
|
||||||
timer = MultiU16X8toH16(tmp_step_rate, gain);
|
timer = MultiU16X8toH16(tmp_step_rate, gain);
|
||||||
timer = (uint16_t)pgm_read_word_near(table_address) - timer;
|
timer = (uint16_t)pgm_read_word_near(table_address) - timer;
|
||||||
|
|
Loading…
Reference in a new issue