From 77b75ce86c288265dfaa3995ad87e2418accba37 Mon Sep 17 00:00:00 2001 From: Scott Lahteine <github@thinkyhead.com> Date: Mon, 16 Apr 2018 02:34:13 -0500 Subject: [PATCH] One fewer compare in _lcd_move_xyz --- Marlin/ultralcd.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 2651d6c6fd8..8b520419444 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2921,14 +2921,16 @@ void kill_screen(const char* lcd_msg) { const float diff = float((int32_t)encoderPosition) * move_menu_scale; #if IS_KINEMATIC manual_move_offset += diff; - // Limit only when trying to move towards the limit - if ((int32_t)encoderPosition < 0) NOLESS(manual_move_offset, min - current_position[axis]); - if ((int32_t)encoderPosition > 0) NOMORE(manual_move_offset, max - current_position[axis]); + if ((int32_t)encoderPosition < 0) + NOLESS(manual_move_offset, min - current_position[axis]); + else + NOMORE(manual_move_offset, max - current_position[axis]); #else current_position[axis] += diff; - // Limit only when trying to move towards the limit - if ((int32_t)encoderPosition < 0) NOLESS(current_position[axis], min); - if ((int32_t)encoderPosition > 0) NOMORE(current_position[axis], max); + if ((int32_t)encoderPosition < 0) + NOLESS(current_position[axis], min); + else + NOMORE(current_position[axis], max); #endif manual_move_to_current(axis);