Skip to content

Commit c1c0496

Browse files
committed
🩹 Fix memset block warning
1 parent a48831d commit c1c0496

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Marlin/src/module/planner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2896,7 +2896,7 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFl
28962896
block_t * const block = get_next_free_block(next_buffer_head);
28972897

28982898
// Clear block
2899-
memset(block, 0, sizeof(block_t));
2899+
block->reset();
29002900

29012901
block->flag.apply(sync_flag);
29022902

Marlin/src/module/planner.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ typedef struct block_t {
274274
block_laser_t laser;
275275
#endif
276276

277+
void reset() { memset((char*)this, 0, sizeof(*this)); }
278+
277279
} block_t;
278280

279281
#if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY)

0 commit comments

Comments
 (0)