From 820cc69d0a5891cb365ff33e835c585d34e394e0 Mon Sep 17 00:00:00 2001 From: Vi B-P Date: Wed, 23 Dec 2020 23:43:33 -0500 Subject: [PATCH] Apply NO_MOTION_BEFORE_HOMING to joystick motion (#20462) Co-authored-by: Scott Lahteine --- Marlin/src/feature/joystick.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Marlin/src/feature/joystick.cpp b/Marlin/src/feature/joystick.cpp index d9c5ae7c1b..d2041598a5 100644 --- a/Marlin/src/feature/joystick.cpp +++ b/Marlin/src/feature/joystick.cpp @@ -127,6 +127,11 @@ Joystick joystick; static bool injecting_now; // = false; if (injecting_now) return; + #if ENABLED(NO_MOTION_BEFORE_HOMING) + if (TERN0(HAS_JOY_ADC_X, axis_should_home(X_AXIS)) || TERN0(HAS_JOY_ADC_Y, axis_should_home(Y_AXIS)) || TERN0(HAS_JOY_ADC_Z, axis_should_home(Z_AXIS))) + return; + #endif + static constexpr int QUEUE_DEPTH = 5; // Insert up to this many movements static constexpr float target_lag = 0.25f, // Aim for 1/4 second lag seg_time = target_lag / QUEUE_DEPTH; // 0.05 seconds, short segments inserted every 1/20th of a second