diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp
index 9cbb794aa642765a40cf5312bd82bbffe34d2c1b..cf7d1c23aa5721e4ef80f65bbd192d2bc267fee1 100644
--- a/Marlin/stepper.cpp
+++ b/Marlin/stepper.cpp
@@ -346,8 +346,6 @@ ISR(TIMER1_COMPA_vect) {
void Stepper::isr() {
- static uint32_t step_remaining = 0;
-
uint16_t ocr_val;
#define ENDSTOP_NOMINAL_OCR_VAL 3000 // check endstops every 1.5ms to guarantee two stepper ISRs within 5ms for BLTouch
@@ -364,6 +362,7 @@ void Stepper::isr() {
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
#define SPLIT(L) _SPLIT(L)
#else // sample endstops in between step pulses
+ static uint32_t step_remaining = 0;
#define SPLIT(L) do { \
_SPLIT(L); \
if (ENDSTOPS_ENABLED && L > ENDSTOP_NOMINAL_OCR_VAL) { \
@@ -391,7 +390,7 @@ void Stepper::isr() {
_ENABLE_ISRs(); // re-enable ISRs
return;
}
- # endif
+ #endif
if (cleaning_buffer_counter) {
--cleaning_buffer_counter;