From bf57eb2447f6639970549e75fd7f1568887cdc64 Mon Sep 17 00:00:00 2001
From: Sebastianv650 <sebastian_v650@kabelmail.de>
Date: Tue, 21 Mar 2017 18:05:44 +0100
Subject: [PATCH] Protect Babystepping against other ISRs

Especialy against stepper ISR.
This is even more important when a minimum pulse width is set,
increasing the runtime of a babystep.
---
 Marlin/stepper.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp
index 299cedb8c6..9c69f38118 100644
--- a/Marlin/stepper.cpp
+++ b/Marlin/stepper.cpp
@@ -1250,6 +1250,7 @@ void Stepper::report_positions() {
   // MUST ONLY BE CALLED BY AN ISR,
   // No other ISR should ever interrupt this!
   void Stepper::babystep(const AxisEnum axis, const bool direction) {
+    cli();
     static uint8_t old_pin;
     #if STEP_PULSE_CYCLES > CYCLES_EATEN_BY_BABYSTEP
       static uint32_t pulse_start;
@@ -1336,6 +1337,7 @@ void Stepper::report_positions() {
 
       default: break;
     }
+    sei();
   }
 
 #endif //BABYSTEPPING