From fb7d7ee7b41fc609aac4a892dc4a77a066f50ccd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 4 Oct 2020 17:29:12 -0500 Subject: [PATCH] Add HAS_FAST_MOVES --- Marlin/src/gcode/gcode.cpp | 16 ++++------------ Marlin/src/gcode/gcode.h | 10 +++++----- Marlin/src/gcode/motion/G0_G1.cpp | 6 +----- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 39276bc72..1de54259b 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -260,12 +260,8 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { switch (parser.command_letter) { case 'G': switch (parser.codenum) { - case 0: case 1: G0_G1( // G0: Fast Move, G1: Linear Move - #if IS_SCARA || defined(G0_FEEDRATE) - parser.codenum == 0 - #endif - ); - break; + case 0: case 1: // G0: Fast Move, G1: Linear Move + G0_G1(TERN_(HAS_FAST_MOVES, parser.codenum == 0)); break; #if ENABLED(ARC_SUPPORT) && DISABLED(SCARA) case 2: case 3: G2_G3(parser.codenum == 2); break; // G2: CW ARC, G3: CCW ARC @@ -315,13 +311,9 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { #if HAS_LEVELING case 29: // G29: Bed leveling calibration - #if ENABLED(G29_RETRY_AND_RECOVER) - G29_with_retry(); - #else - G29(); - #endif + TERN(G29_RETRY_AND_RECOVER, G29_with_retry, G29)(); break; - #endif // HAS_LEVELING + #endif #if HAS_BED_PROBE case 30: G30(); break; // G30: Single Z probe diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 425a85736..026083bcf 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -298,6 +298,10 @@ #include "../feature/encoder_i2c.h" #endif +#if IS_SCARA || defined(G0_FEEDRATE) + #define HAS_FAST_MOVES 1 +#endif + enum AxisRelative : uint8_t { REL_X, REL_Y, REL_Z, REL_E, E_MODE_ABS, E_MODE_REL }; class GcodeSuite { @@ -404,11 +408,7 @@ public: private: - static void G0_G1( - #if IS_SCARA || defined(G0_FEEDRATE) - const bool fast_move=false - #endif - ); + static void G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move=false)); TERN_(ARC_SUPPORT, static void G2_G3(const bool clockwise)); diff --git a/Marlin/src/gcode/motion/G0_G1.cpp b/Marlin/src/gcode/motion/G0_G1.cpp index b6ddf9634..9ac49bd93 100644 --- a/Marlin/src/gcode/motion/G0_G1.cpp +++ b/Marlin/src/gcode/motion/G0_G1.cpp @@ -44,11 +44,7 @@ extern xyze_pos_t destination; /** * G0, G1: Coordinated movement of X Y Z E axes */ -void GcodeSuite::G0_G1( - #if IS_SCARA || defined(G0_FEEDRATE) - const bool fast_move/*=false*/ - #endif -) { +void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) { if (IsRunning() #if ENABLED(NO_MOTION_BEFORE_HOMING)