Combine planner busy flag with other flags
This commit is contained in:
parent
fab47e63bf
commit
51f450f927
|
|
@ -295,7 +295,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_speed, float exit
|
||||||
// which corresponds to a maximum repeat frequency of 228.57 kHz.
|
// which corresponds to a maximum repeat frequency of 228.57 kHz.
|
||||||
// This blocking is safe in the context of a 10kHz stepper driver interrupt
|
// This blocking is safe in the context of a 10kHz stepper driver interrupt
|
||||||
// or a 115200 Bd serial line receive interrupt, which will not trigger faster than 12kHz.
|
// or a 115200 Bd serial line receive interrupt, which will not trigger faster than 12kHz.
|
||||||
if (! block->busy) { // Don't update variables if block is busy.
|
if (!(block->flag & BLOCK_FLAG_BUSY)) { // Don't update variables if block is busy.
|
||||||
block->accelerate_until = accelerate_steps;
|
block->accelerate_until = accelerate_steps;
|
||||||
block->decelerate_after = accelerate_steps+plateau_steps;
|
block->decelerate_after = accelerate_steps+plateau_steps;
|
||||||
block->initial_rate = initial_rate;
|
block->initial_rate = initial_rate;
|
||||||
|
|
@ -726,7 +726,8 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate
|
||||||
block_t *block = &block_buffer[block_buffer_head];
|
block_t *block = &block_buffer[block_buffer_head];
|
||||||
|
|
||||||
// Mark block as not busy (Not executed by the stepper interrupt, could be still tinkered with.)
|
// Mark block as not busy (Not executed by the stepper interrupt, could be still tinkered with.)
|
||||||
block->busy = false;
|
// Also reset the block flag.
|
||||||
|
block->flag = 0;
|
||||||
|
|
||||||
// Set sdlen for calculating sd position
|
// Set sdlen for calculating sd position
|
||||||
block->sdlen = 0;
|
block->sdlen = 0;
|
||||||
|
|
@ -1101,9 +1102,6 @@ Having the real displacement of the head, we can calculate the total movement le
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the block flag.
|
|
||||||
block->flag = 0;
|
|
||||||
|
|
||||||
if (plan_reset_next_e_sched)
|
if (plan_reset_next_e_sched)
|
||||||
{
|
{
|
||||||
// finally propagate a pending reset
|
// finally propagate a pending reset
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ enum BlockFlag {
|
||||||
BLOCK_FLAG_DDA_LOWRES = 8,
|
BLOCK_FLAG_DDA_LOWRES = 8,
|
||||||
// Block starts with Zeroed E counter
|
// Block starts with Zeroed E counter
|
||||||
BLOCK_FLAG_E_RESET = 16,
|
BLOCK_FLAG_E_RESET = 16,
|
||||||
|
// Block is being executed by the stepper ISR
|
||||||
|
BLOCK_FLAG_BUSY = 32,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
union dda_isteps_t
|
union dda_isteps_t
|
||||||
|
|
@ -104,7 +107,6 @@ typedef struct {
|
||||||
uint32_t final_rate; // The minimal rate at exit
|
uint32_t final_rate; // The minimal rate at exit
|
||||||
uint32_t acceleration_steps_per_s2; // acceleration steps/sec^2
|
uint32_t acceleration_steps_per_s2; // acceleration steps/sec^2
|
||||||
uint8_t fan_speed; // Print fan speed, ranges from 0 to 255
|
uint8_t fan_speed; // Print fan speed, ranges from 0 to 255
|
||||||
volatile char busy;
|
|
||||||
|
|
||||||
|
|
||||||
// Pre-calculated division for the calculate_trapezoid_for_block() routine to run faster.
|
// Pre-calculated division for the calculate_trapezoid_for_block() routine to run faster.
|
||||||
|
|
@ -233,7 +235,7 @@ FORCE_INLINE block_t *plan_get_current_block()
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
block_t *block = &block_buffer[block_buffer_tail];
|
block_t *block = &block_buffer[block_buffer_tail];
|
||||||
block->busy = true;
|
block->flag |= BLOCK_FLAG_BUSY;
|
||||||
return(block);
|
return(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue