Browse Source

Optimisation: Set lastpos using memcpy directly

Verified the change by running the M600 gcode. All axis move as expected.

Change in memory:
Flash: -64 bytes
SRAM: 0 bytes
Guðni Már Gilbert 2 years ago
parent
commit
db1b0ea9ac
1 changed files with 1 additions and 4 deletions
  1. 1 4
      Firmware/Marlin_main.cpp

+ 1 - 4
Firmware/Marlin_main.cpp

@@ -3536,10 +3536,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
     float HotendTempBckp = degTargetHotend(active_extruder);
     int fanSpeedBckp = fanSpeed;
 
-    lastpos[X_AXIS] = current_position[X_AXIS];
-    lastpos[Y_AXIS] = current_position[Y_AXIS];
-    lastpos[Z_AXIS] = current_position[Z_AXIS];
-    lastpos[E_AXIS] = current_position[E_AXIS];
+    memcpy(lastpos, current_position, sizeof(lastpos));
 
     // Retract E
     current_position[E_AXIS] += e_shift;