From 18dde3fb6181f38ad53de78e6d84695d457373e1 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Thu, 10 Feb 2022 16:24:52 +0100 Subject: [PATCH] Faster code when endstops/probe are not enabled --- Firmware/stepper.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 7195ba0e8..73bc3157f 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -482,11 +482,11 @@ FORCE_INLINE void stepper_next_block() // Check limit switches. FORCE_INLINE void stepper_check_endstops() { - uint8_t _endstop_hit = endstop_hit; - uint8_t _endstop = endstop; - uint8_t _old_endstop = old_endstop; if(check_endstops) { + uint8_t _endstop_hit = endstop_hit; + uint8_t _endstop = endstop; + uint8_t _old_endstop = old_endstop; #ifndef COREXY if ((out_bits & (1< -1) && !defined(DEBUG_DISABLE_ZMINLIMIT) if (check_z_endstop) { + uint8_t _endstop_hit = endstop_hit; + uint8_t _endstop = endstop; + uint8_t _old_endstop = old_endstop; // Check the Z min end-stop no matter what. // Good for searching for the center of an induction target. #ifdef TMC2130_SG_HOMING @@ -626,11 +632,11 @@ FORCE_INLINE void stepper_check_endstops() _endstop_hit |= _BV(Z_AXIS); step_events_completed.wide = current_block->step_event_count.wide; } + endstop = _endstop; + old_endstop = _endstop; //apply current endstop state to the old endstop + endstop_hit = _endstop_hit; } #endif - endstop = _endstop; - old_endstop = _endstop; //apply current endstop state to the old endstop - endstop_hit = _endstop_hit; }