parent
025118da3e
commit
930720bbbb
|
@ -289,18 +289,26 @@ void Planner::reverse_pass_kernel(block_t* const current, const block_t * const
|
|||
* Once in reverse and once forward. This implements the reverse pass.
|
||||
*/
|
||||
void Planner::reverse_pass() {
|
||||
if (movesplanned() > 3) {
|
||||
const uint8_t endnr = BLOCK_MOD(block_buffer_tail + 2); // tail is running. tail+1 shouldn't be altered because it's connected to the running block.
|
||||
// tail+2 because the index is not yet advanced when checked
|
||||
if (movesplanned() > 2) {
|
||||
const uint8_t endnr = BLOCK_MOD(block_buffer_tail + 1); // tail is running. tail+1 shouldn't be altered because it's connected to the running block.
|
||||
uint8_t blocknr = prev_block_index(block_buffer_head);
|
||||
block_t* current = &block_buffer[blocknr];
|
||||
|
||||
// Last/newest block in buffer:
|
||||
const float max_entry_speed = current->max_entry_speed;
|
||||
if (current->entry_speed != max_entry_speed) {
|
||||
// If nominal length true, max junction speed is guaranteed to be reached. Only compute
|
||||
// for max allowable speed if block is decelerating and nominal length is false.
|
||||
current->entry_speed = TEST(current->flag, BLOCK_BIT_NOMINAL_LENGTH)
|
||||
? max_entry_speed
|
||||
: min(max_entry_speed, max_allowable_speed(-current->acceleration, MINIMUM_PLANNER_SPEED, current->millimeters));
|
||||
SBI(current->flag, BLOCK_BIT_RECALCULATE);
|
||||
}
|
||||
|
||||
do {
|
||||
const block_t * const next = current;
|
||||
blocknr = prev_block_index(blocknr);
|
||||
current = &block_buffer[blocknr];
|
||||
if (TEST(current->flag, BLOCK_BIT_START_FROM_FULL_HALT)) // Up to this every block is already optimized.
|
||||
break;
|
||||
reverse_pass_kernel(current, next);
|
||||
} while (blocknr != endnr);
|
||||
}
|
||||
|
@ -920,7 +928,6 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
|
|||
|
||||
// Enable extruder(s)
|
||||
if (esteps) {
|
||||
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
powerManager.power_on();
|
||||
#endif
|
||||
|
@ -1425,17 +1432,11 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
|
|||
// Now the transition velocity is known, which maximizes the shared exit / entry velocity while
|
||||
// respecting the jerk factors, it may be possible, that applying separate safe exit / entry velocities will achieve faster prints.
|
||||
const float vmax_junction_threshold = vmax_junction * 0.99f;
|
||||
if (previous_safe_speed > vmax_junction_threshold && safe_speed > vmax_junction_threshold) {
|
||||
// Not coasting. The machine will stop and start the movements anyway,
|
||||
// better to start the segment from start.
|
||||
SBI(block->flag, BLOCK_BIT_START_FROM_FULL_HALT);
|
||||
if (previous_safe_speed > vmax_junction_threshold && safe_speed > vmax_junction_threshold)
|
||||
vmax_junction = safe_speed;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SBI(block->flag, BLOCK_BIT_START_FROM_FULL_HALT);
|
||||
else
|
||||
vmax_junction = safe_speed;
|
||||
}
|
||||
|
||||
// Max entry speed of this block equals the max exit speed of the previous block.
|
||||
block->max_entry_speed = vmax_junction;
|
||||
|
|
|
@ -53,9 +53,6 @@ enum BlockFlagBit {
|
|||
// from a safe speed (in consideration of jerking from zero speed).
|
||||
BLOCK_BIT_NOMINAL_LENGTH,
|
||||
|
||||
// Start from a halt at the start of this block, respecting the maximum allowed jerk.
|
||||
BLOCK_BIT_START_FROM_FULL_HALT,
|
||||
|
||||
// The block is busy
|
||||
BLOCK_BIT_BUSY,
|
||||
|
||||
|
@ -66,7 +63,6 @@ enum BlockFlagBit {
|
|||
enum BlockFlag {
|
||||
BLOCK_FLAG_RECALCULATE = _BV(BLOCK_BIT_RECALCULATE),
|
||||
BLOCK_FLAG_NOMINAL_LENGTH = _BV(BLOCK_BIT_NOMINAL_LENGTH),
|
||||
BLOCK_FLAG_START_FROM_FULL_HALT = _BV(BLOCK_BIT_START_FROM_FULL_HALT),
|
||||
BLOCK_FLAG_BUSY = _BV(BLOCK_BIT_BUSY),
|
||||
BLOCK_FLAG_CONTINUED = _BV(BLOCK_BIT_CONTINUED)
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue