From c1c0496073b8c70728f237fb2a99fdae19c7bb4f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 29 Jun 2022 17:14:23 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20memset=20block=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 2 +- Marlin/src/module/planner.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index c3b1fdd72a..129b9962d3 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2896,7 +2896,7 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFl block_t * const block = get_next_free_block(next_buffer_head); // Clear block - memset(block, 0, sizeof(block_t)); + block->reset(); block->flag.apply(sync_flag); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index b8a108b4b3..2d8a966ca0 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -274,6 +274,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)