diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 1d8b6e716e..1b70d748e4 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2821,7 +2821,7 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, uint8_t sync_ block_t * const block = get_next_free_block(next_buffer_head); // Clear block - memset(block, 0, sizeof(block_t)); + block->reset(); block->flag = sync_flag; diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 1af5ccc810..38f958c10f 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -251,6 +251,8 @@ typedef struct block_t { block_laser_t laser; #endif + void reset() { memset((char*)this, 0, sizeof(*this)); } + } block_t; #if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY)