Extend M106/M107 for better laser module support (#16082)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Martijn Bosgraaf
2021-03-24 18:21:11 +01:00
committed by GitHub
parent 3ae892bf91
commit 30e7e2c276
14 changed files with 189 additions and 89 deletions

View File

@@ -1988,9 +1988,18 @@ uint32_t Stepper::block_phase_isr() {
// Anything in the buffer?
if ((current_block = planner.get_current_block())) {
// Sync block? Sync the stepper counts and return
while (TEST(current_block->flag, BLOCK_BIT_SYNC_POSITION)) {
_set_position(current_block->position);
// Sync block? Sync the stepper counts or fan speeds and return
while (current_block->flag & BLOCK_MASK_SYNC) {
#if ENABLED(LASER_SYNCHRONOUS_M106_M107)
const bool is_sync_fans = TEST(current_block->flag, BLOCK_BIT_SYNC_FANS);
if (is_sync_fans) planner.sync_fan_speeds(current_block->fan_speed);
#else
constexpr bool is_sync_fans = false;
#endif
if (!is_sync_fans) _set_position(current_block->position);
discard_current_block();
// Try to get a new block