From 672e45652ecbae5dd7686f160f167ba40a2c6238 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Thu, 16 Mar 2017 21:25:19 -0500
Subject: [PATCH 1/2] Improved solution to tool-change bug

---
 Marlin/Marlin_main.cpp | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 1db71493996..1b9aacb5e04 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -7883,6 +7883,7 @@ inline void gcode_M999() {
   inline void move_extruder_servo(uint8_t e) {
     const int angles[2] = SWITCHING_EXTRUDER_SERVO_ANGLES;
     MOVE_SERVO(SWITCHING_EXTRUDER_SERVO_NR, angles[e]);
+    delay(500);
   }
 #endif
 
@@ -8029,25 +8030,15 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
 
           #if ENABLED(SWITCHING_EXTRUDER)
             // <0 if the new nozzle is higher, >0 if lower. A bigger raise when lower.
-            float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
-                  z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
+            const float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
+                        z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
 
             // Always raise by some amount (destination copied from current_position earlier)
-            float save_Z = destination[Z_AXIS];  // save Z for later on
-            destination[Z_AXIS] += z_raise;
-            planner.buffer_line_kinematic(destination, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
+            current_position[Z_AXIS] += z_raise;
+            planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
             stepper.synchronize();
 
             move_extruder_servo(active_extruder);
-            delay(500);
-
-            // Move back down, if needed
-            if (z_raise != z_diff) {
-              destination[Z_AXIS] = current_position[Z_AXIS] + z_diff;
-              planner.buffer_line_kinematic(destination, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
-              stepper.synchronize();
-            }
-            destination[Z_AXIS] = save_Z;  // restore original Z position so the 'Move to the "old position"' is correct
           #endif
 
           /**
@@ -8098,12 +8089,12 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
             #endif
 
             // Adjustments to the current position
-            float xydiff[2] = { offset_vec.x, offset_vec.y };
+            const float xydiff[2] = { offset_vec.x, offset_vec.y };
             current_position[Z_AXIS] += offset_vec.z;
 
           #else // !ABL_PLANAR
 
-            float xydiff[2] = {
+            const float xydiff[2] = {
               hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
               hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
             };
@@ -8170,6 +8161,15 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
           prepare_move_to_destination();
         }
 
+        #if ENABLED(SWITCHING_EXTRUDER)
+          // Move back down, if needed. (Including when the new tool is higher.)
+          if (z_raise != z_diff) {
+            destination[Z_AXIS] += z_diff;
+            feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS];
+            prepare_move_to_destination();
+          }
+        #endif
+
       } // (tmp_extruder != active_extruder)
 
       stepper.synchronize();

From f02af83d422b53c94745957031e8be1ba0de3865 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Thu, 16 Mar 2017 21:25:36 -0500
Subject: [PATCH 2/2] Remove some extraneous spaces

---
 Marlin/Configuration_adv.h                                    | 4 ++--
 Marlin/Makefile                                               | 4 ++--
 Marlin/example_configurations/Cartesio/Configuration_adv.h    | 4 ++--
 Marlin/example_configurations/Felix/Configuration_adv.h       | 4 ++--
 Marlin/example_configurations/Hephestos/Configuration_adv.h   | 4 ++--
 Marlin/example_configurations/Hephestos_2/Configuration_adv.h | 4 ++--
 Marlin/example_configurations/K8200/Configuration_adv.h       | 4 ++--
 Marlin/example_configurations/K8400/Configuration_adv.h       | 4 ++--
 Marlin/example_configurations/RigidBot/Configuration_adv.h    | 4 ++--
 Marlin/example_configurations/SCARA/Configuration_adv.h       | 4 ++--
 Marlin/example_configurations/TAZ4/Configuration_adv.h        | 4 ++--
 Marlin/example_configurations/WITBOX/Configuration_adv.h      | 4 ++--
 .../delta/flsun_kossel_mini/Configuration_adv.h               | 4 ++--
 .../example_configurations/delta/generic/Configuration_adv.h  | 4 ++--
 .../delta/kossel_mini/Configuration_adv.h                     | 4 ++--
 .../delta/kossel_pro/Configuration_adv.h                      | 4 ++--
 .../delta/kossel_xl/Configuration_adv.h                       | 4 ++--
 Marlin/example_configurations/makibox/Configuration_adv.h     | 4 ++--
 .../example_configurations/tvrrug/Round2/Configuration_adv.h  | 4 ++--
 Marlin/pinsDebug_Teensyduino.h                                | 2 +-
 Marlin/stepper_dac.cpp                                        | 2 +-
 Marlin/temperature.cpp                                        | 2 +-
 Marlin/ultralcd.cpp                                           | 2 +-
 23 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index 475a0813830..cd842f5022c 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -848,7 +848,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1063,7 +1063,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/Makefile b/Marlin/Makefile
index 81eeceada90..dffc21f7fe8 100644
--- a/Marlin/Makefile
+++ b/Marlin/Makefile
@@ -45,7 +45,7 @@
 #
 #   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
 #   HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
-# 
+#
 # If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
 # start upload manually (using stk500) like so:
 #
@@ -69,7 +69,7 @@ AVR_TOOLS_PATH ?=
 #Programmer configuration
 UPLOAD_RATE        ?= 57600
 AVRDUDE_PROGRAMMER ?= arduino
-# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1 
+# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
 UPLOAD_PORT        ?= /dev/ttyUSB0
 
 #Directory used to build files in, contains all the build files, from object files to the final hex file
diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h
index 8d10a0539f4..5d8b55f4952 100644
--- a/Marlin/example_configurations/Cartesio/Configuration_adv.h
+++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h
index 6ce93616f8f..27116092dcc 100644
--- a/Marlin/example_configurations/Felix/Configuration_adv.h
+++ b/Marlin/example_configurations/Felix/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h
index dc40f3dee37..b5e1d2832bb 100644
--- a/Marlin/example_configurations/Hephestos/Configuration_adv.h
+++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h
index c3d2713760c..a8899ab8386 100644
--- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h
+++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h
@@ -828,7 +828,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1043,7 +1043,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h
index 97ab4c3dd03..f85d1009da0 100644
--- a/Marlin/example_configurations/K8200/Configuration_adv.h
+++ b/Marlin/example_configurations/K8200/Configuration_adv.h
@@ -858,7 +858,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1073,7 +1073,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h
index 129a96774a8..fc293e3451e 100644
--- a/Marlin/example_configurations/K8400/Configuration_adv.h
+++ b/Marlin/example_configurations/K8400/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h
index 1326b550a2d..4751b30fd28 100644
--- a/Marlin/example_configurations/RigidBot/Configuration_adv.h
+++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h
index 0276f1a22d3..67dc5630a05 100644
--- a/Marlin/example_configurations/SCARA/Configuration_adv.h
+++ b/Marlin/example_configurations/SCARA/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h
index 4ebc3830243..b347b3d7dd8 100644
--- a/Marlin/example_configurations/TAZ4/Configuration_adv.h
+++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h
@@ -853,7 +853,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1068,7 +1068,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h
index dc40f3dee37..b5e1d2832bb 100644
--- a/Marlin/example_configurations/WITBOX/Configuration_adv.h
+++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h
index 461c98d156e..f1f703aa393 100644
--- a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h
+++ b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h
@@ -850,7 +850,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1065,7 +1065,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h
index 879338196f5..4e098263153 100644
--- a/Marlin/example_configurations/delta/generic/Configuration_adv.h
+++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h
@@ -847,7 +847,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1062,7 +1062,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
index 879338196f5..4e098263153 100644
--- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
+++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
@@ -847,7 +847,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1062,7 +1062,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
index fbf33bf2ceb..2b32809a821 100644
--- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
+++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
@@ -852,7 +852,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1067,7 +1067,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
index 1f1ce97ab03..3fa66b4cc8e 100644
--- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
+++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
@@ -847,7 +847,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1062,7 +1062,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h
index 171e618327f..84e65c0ed9a 100644
--- a/Marlin/example_configurations/makibox/Configuration_adv.h
+++ b/Marlin/example_configurations/makibox/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
index b6baf4d4f7c..ab80eca718c 100644
--- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
+++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
@@ -845,7 +845,7 @@
    * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered,
    * then decrease current by CURRENT_STEP until temperature prewarn is cleared.
    * Adjusting starts from X/Y/Z/E_MAX_CURRENT but will not increase over AUTO_ADJUST_MAX
-   */ 
+   */
   //#define AUTOMATIC_CURRENT_CONTROL
   #define CURRENT_STEP          50  // [mA]
   #define AUTO_ADJUST_MAX     1300  // [mA], 1300mA_rms = 1840mA_peak
@@ -1060,7 +1060,7 @@
  * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter.
  *
  * M200 D0 to disable, M200 Dn to set a new diameter.
- */ 
+ */
 //#define VOLUMETRIC_DEFAULT_ON
 
 /**
diff --git a/Marlin/pinsDebug_Teensyduino.h b/Marlin/pinsDebug_Teensyduino.h
index fc5c03abeec..187c190f689 100644
--- a/Marlin/pinsDebug_Teensyduino.h
+++ b/Marlin/pinsDebug_Teensyduino.h
@@ -19,7 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
- 
+
 //
 //  some of the pin mapping functions of the Teensduino extension to the Arduino IDE
 //  do not function the same as the other Arduino extensions
diff --git a/Marlin/stepper_dac.cpp b/Marlin/stepper_dac.cpp
index 798768ebfad..7d47602cbfa 100644
--- a/Marlin/stepper_dac.cpp
+++ b/Marlin/stepper_dac.cpp
@@ -64,7 +64,7 @@
 
     mcp4728_setVref_all(DAC_STEPPER_VREF);
     mcp4728_setGain_all(DAC_STEPPER_GAIN);
-    
+
     if (mcp4728_getDrvPct(0) < 1 || mcp4728_getDrvPct(1) < 1 || mcp4728_getDrvPct(2) < 1 || mcp4728_getDrvPct(3) < 1 ) {
       mcp4728_setDrvPct(dac_channel_pct);
       mcp4728_eepromWrite();
diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp
index 735d608ca7f..af76edb0ff2 100644
--- a/Marlin/temperature.cpp
+++ b/Marlin/temperature.cpp
@@ -1491,7 +1491,7 @@ void Temperature::isr() {
   // at the end of its run, potentially causing re-entry. This flag prevents it.
   if (in_temp_isr) return;
   in_temp_isr = true;
-  
+
   // Allow UART and stepper ISRs
   CBI(TIMSK0, OCIE0B); //Disable Temperature ISR
   sei();
diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp
index f788addde3a..b6f33cc320c 100755
--- a/Marlin/ultralcd.cpp
+++ b/Marlin/ultralcd.cpp
@@ -428,7 +428,7 @@ uint16_t max_display_update_time = 0;
         }
         else if (screen == lcd_status_screen && currentScreen == lcd_main_menu && PENDING(millis(), doubleclick_expire_ms))
           screen = lcd_babystep_z;
-      #endif 
+      #endif
 
       currentScreen = screen;
       encoderPosition = encoder;