Browse Source

🩹 Fix memset block warning

Scott Lahteine 1 year ago
parent
commit
d9ec3795fb
2 changed files with 3 additions and 1 deletions
  1. 1
    1
      Marlin/src/module/planner.cpp
  2. 2
    0
      Marlin/src/module/planner.h

+ 1
- 1
Marlin/src/module/planner.cpp View File

@@ -2896,7 +2896,7 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFl
2896 2896
   block_t * const block = get_next_free_block(next_buffer_head);
2897 2897
 
2898 2898
   // Clear block
2899
-  memset(block, 0, sizeof(block_t));
2899
+  block->reset();
2900 2900
 
2901 2901
   block->flag.apply(sync_flag);
2902 2902
 

+ 2
- 0
Marlin/src/module/planner.h View File

@@ -274,6 +274,8 @@ typedef struct block_t {
274 274
     block_laser_t laser;
275 275
   #endif
276 276
 
277
+  void reset() { memset((char*)this, 0, sizeof(*this)); }
278
+
277 279
 } block_t;
278 280
 
279 281
 #if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY)

Loading…
Cancel
Save