diff --git a/Marlin/src/gcode/feature/trinamic/M906.cpp b/Marlin/src/gcode/feature/trinamic/M906.cpp index 853f09838b..d28117c5ed 100644 --- a/Marlin/src/gcode/feature/trinamic/M906.cpp +++ b/Marlin/src/gcode/feature/trinamic/M906.cpp @@ -37,7 +37,11 @@ void GcodeSuite::M906() { #define TMC_SET_CURRENT(Q) tmc_set_current(stepper##Q, value) bool report = true; - const uint8_t index = parser.byteval('I'); + + #if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) + const uint8_t index = parser.byteval('I'); + #endif + LOOP_XYZE(i) if (uint16_t value = parser.intval(axis_codes[i])) { report = false; switch (i) { diff --git a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp b/Marlin/src/gcode/feature/trinamic/M911-M915.cpp index f741d935e8..4c60676bcf 100644 --- a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp +++ b/Marlin/src/gcode/feature/trinamic/M911-M915.cpp @@ -30,10 +30,20 @@ #include "../../../module/planner.h" #include "../../queue.h" -#define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || (AXIS_DRIVER_TYPE(ST, TMC2208) && PIN_EXISTS(ST##_SERIAL_RX))) -#define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N)) - #if ENABLED(MONITOR_DRIVER_STATUS) + + #define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || (AXIS_DRIVER_TYPE(ST, TMC2208) && PIN_EXISTS(ST##_SERIAL_RX))) + #define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N)) + + #define M91x_SOME_X (M91x_USE(X) || M91x_USE(X2)) + #define M91x_SOME_Y (M91x_USE(Y) || M91x_USE(Y2)) + #define M91x_SOME_Z (M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3)) + #define M91x_SOME_E (M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5)) + + #if !M91x_SOME_X && !M91x_SOME_Y && !M91x_SOME_Z && !M91x_SOME_E + #error "MONITOR_DRIVER_STATUS requires at least one TMC2130 or serial-connected TMC2208." + #endif + /** * M911: Report TMC stepper driver overtemperature pre-warn flag * This flag is held by the library, persisting until cleared by M912 @@ -93,68 +103,89 @@ * M912 E1 ; clear E1 only */ void GcodeSuite::M912() { - const bool hasX = parser.seen(axis_codes[X_AXIS]), - hasY = parser.seen(axis_codes[Y_AXIS]), - hasZ = parser.seen(axis_codes[Z_AXIS]), - hasE = parser.seen(axis_codes[E_AXIS]), - hasNone = !hasX && !hasY && !hasZ && !hasE; + #if M91x_SOME_X + const bool hasX = parser.seen(axis_codes[X_AXIS]); + #else + constexpr bool hasX = false; + #endif - #if M91x_USE(X) || M91x_USE(X2) - const int8_t xval = int8_t(parser.byteval(axis_codes[X_AXIS], 0xFF)); - #if M91x_USE(X) - if (hasNone || xval == 1 || (hasX && xval < 0)) tmc_clear_otpw(stepperX); - #endif - #if M91x_USE(X2) - if (hasNone || xval == 2 || (hasX && xval < 0)) tmc_clear_otpw(stepperX2); - #endif - #endif + #if M91x_SOME_Y + const bool hasY = parser.seen(axis_codes[Y_AXIS]); + #else + constexpr bool hasY = false; + #endif - #if M91x_USE(Y) || M91x_USE(Y2) - const int8_t yval = int8_t(parser.byteval(axis_codes[Y_AXIS], 0xFF)); - #if M91x_USE(Y) - if (hasNone || yval == 1 || (hasY && yval < 0)) tmc_clear_otpw(stepperY); - #endif - #if M91x_USE(Y2) - if (hasNone || yval == 2 || (hasY && yval < 0)) tmc_clear_otpw(stepperY2); - #endif - #endif + #if M91x_SOME_Z + const bool hasZ = parser.seen(axis_codes[Z_AXIS]); + #else + constexpr bool hasZ = false; + #endif - #if M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3) - const int8_t zval = int8_t(parser.byteval(axis_codes[Z_AXIS], 0xFF)); - #if M91x_USE(Z) - if (hasNone || zval == 1 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ); - #endif - #if M91x_USE(Z2) - if (hasNone || zval == 2 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ2); - #endif - #if M91x_USE(Z3) - if (hasNone || zval == 3 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ3); - #endif - #endif + #if M91x_SOME_E + const bool hasE = parser.seen(axis_codes[E_AXIS]); + #else + constexpr bool hasE = false; + #endif - #if M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5) - const int8_t eval = int8_t(parser.byteval(axis_codes[E_AXIS], 0xFF)); - #if M91x_USE_E(0) - if (hasNone || eval == 0 || (hasE && eval < 0)) tmc_clear_otpw(stepperE0); - #endif - #if M91x_USE_E(1) - if (hasNone || eval == 1 || (hasE && eval < 0)) tmc_clear_otpw(stepperE1); - #endif - #if M91x_USE_E(2) - if (hasNone || eval == 2 || (hasE && eval < 0)) tmc_clear_otpw(stepperE2); - #endif - #if M91x_USE_E(3) - if (hasNone || eval == 3 || (hasE && eval < 0)) tmc_clear_otpw(stepperE3); - #endif - #if M91x_USE_E(4) - if (hasNone || eval == 4 || (hasE && eval < 0)) tmc_clear_otpw(stepperE4); - #endif - #if M91x_USE_E(5) - if (hasNone || eval == 5 || (hasE && eval < 0)) tmc_clear_otpw(stepperE5); - #endif + const bool hasNone = !hasX && !hasY && !hasZ && !hasE; + + #if M91x_SOME_X + const int8_t xval = int8_t(parser.byteval(axis_codes[X_AXIS], 0xFF)); + #if M91x_USE(X) + if (hasNone || xval == 1 || (hasX && xval < 0)) tmc_clear_otpw(stepperX); #endif + #if M91x_USE(X2) + if (hasNone || xval == 2 || (hasX && xval < 0)) tmc_clear_otpw(stepperX2); + #endif + #endif + + #if M91x_SOME_Y + const int8_t yval = int8_t(parser.byteval(axis_codes[Y_AXIS], 0xFF)); + #if M91x_USE(Y) + if (hasNone || yval == 1 || (hasY && yval < 0)) tmc_clear_otpw(stepperY); + #endif + #if M91x_USE(Y2) + if (hasNone || yval == 2 || (hasY && yval < 0)) tmc_clear_otpw(stepperY2); + #endif + #endif + + #if M91x_SOME_Z + const int8_t zval = int8_t(parser.byteval(axis_codes[Z_AXIS], 0xFF)); + #if M91x_USE(Z) + if (hasNone || zval == 1 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ); + #endif + #if M91x_USE(Z2) + if (hasNone || zval == 2 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ2); + #endif + #if M91x_USE(Z3) + if (hasNone || zval == 3 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ3); + #endif + #endif + + #if M91x_SOME_E + const int8_t eval = int8_t(parser.byteval(axis_codes[E_AXIS], 0xFF)); + #if M91x_USE_E(0) + if (hasNone || eval == 0 || (hasE && eval < 0)) tmc_clear_otpw(stepperE0); + #endif + #if M91x_USE_E(1) + if (hasNone || eval == 1 || (hasE && eval < 0)) tmc_clear_otpw(stepperE1); + #endif + #if M91x_USE_E(2) + if (hasNone || eval == 2 || (hasE && eval < 0)) tmc_clear_otpw(stepperE2); + #endif + #if M91x_USE_E(3) + if (hasNone || eval == 3 || (hasE && eval < 0)) tmc_clear_otpw(stepperE3); + #endif + #if M91x_USE_E(4) + if (hasNone || eval == 4 || (hasE && eval < 0)) tmc_clear_otpw(stepperE4); + #endif + #if M91x_USE_E(5) + if (hasNone || eval == 5 || (hasE && eval < 0)) tmc_clear_otpw(stepperE5); + #endif + #endif } -#endif + +#endif // MONITOR_DRIVER_STATUS /** * M913: Set HYBRID_THRESHOLD speed. @@ -167,7 +198,9 @@ #define TMC_SET_PWMTHRS_E(E) tmc_set_pwmthrs(stepperE##E, value, planner.settings.axis_steps_per_mm[E_AXIS_N(E)]) bool report = true; - const uint8_t index = parser.byteval('I'); + #if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) + const uint8_t index = parser.byteval('I'); + #endif LOOP_XYZE(i) if (int32_t value = parser.longval(axis_codes[i])) { report = false; switch (i) { diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 8bd14970d4..4f05d0e567 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -857,15 +857,13 @@ #define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208)) #define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING)) - #if USE_SENSORLESS - // Disable Z axis sensorless homing if a probe is used to home the Z axis - #if HOMING_Z_WITH_PROBE - #undef Z_STALL_SENSITIVITY - #endif - #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY)) - #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY)) - #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY)) + // Disable Z axis sensorless homing if a probe is used to home the Z axis + #if HOMING_Z_WITH_PROBE + #undef Z_STALL_SENSITIVITY #endif + #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY)) + #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY)) + #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY)) #endif // Endstops and bed probe diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 9a94edfe1c..71726ff103 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * SanityCheck.h @@ -26,9 +27,6 @@ * Test configuration values for errors at compile-time. */ -#ifndef _SANITYCHECK_H_ -#define _SANITYCHECK_H_ - /** * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features. */ @@ -1707,31 +1705,62 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * Check existing CS pins against enabled TMC SPI drivers. */ #if AXIS_DRIVER_TYPE(X, TMC2130) && !PIN_EXISTS(X_CS) - #error "X_CS_PIN is required for TMC2130. Define X_CS_PIN in Configuration_adv.h." + #error "TMC2130 on X requires X_CS_PIN." #elif AXIS_DRIVER_TYPE(X2, TMC2130) && !PIN_EXISTS(X2_CS) - #error "X2_CS_PIN is required for X2. Define X2_CS_PIN in Configuration_adv.h." + #error "TMC2130 on X2 requires X2_CS_PIN." #elif AXIS_DRIVER_TYPE(Y, TMC2130) && !PIN_EXISTS(Y_CS) - #error "Y_CS_PIN is required for TMC2130. Define Y_CS_PIN in Configuration_adv.h." + #error "TMC2130 on Y requires Y_CS_PIN." #elif AXIS_DRIVER_TYPE(Y2, TMC2130) && !PIN_EXISTS(Y2_CS) - #error "Y2_CS_PIN is required for TMC2130. Define Y2_CS_PIN in Configuration_adv.h." + #error "TMC2130 on Y2 requires Y2_CS_PIN." #elif AXIS_DRIVER_TYPE(Z, TMC2130) && !PIN_EXISTS(Z_CS) - #error "Z_CS_PIN is required for TMC2130. Define Z_CS_PIN in Configuration_adv.h." + #error "TMC2130 on Z requires Z_CS_PIN." #elif AXIS_DRIVER_TYPE(Z2, TMC2130) && !PIN_EXISTS(Z2_CS) - #error "Z2_CS_PIN is required for TMC2130. Define Z2_CS_PIN in Configuration_adv.h." + #error "TMC2130 on Z2 requires Z2_CS_PIN." #elif AXIS_DRIVER_TYPE(Z3, TMC2130) && !PIN_EXISTS(Z3_CS) - #error "Z3_CS_PIN is required for TMC2130. Define Z3_CS_PIN in Configuration_adv.h." + #error "TMC2130 on Z3 requires Z3_CS_PIN." #elif AXIS_DRIVER_TYPE(E0, TMC2130) && !PIN_EXISTS(E0_CS) - #error "E0_CS_PIN is required for TMC2130. Define E0_CS_PIN in Configuration_adv.h." + #error "TMC2130 on E0 requires E0_CS_PIN." #elif AXIS_DRIVER_TYPE(E1, TMC2130) && !PIN_EXISTS(E1_CS) - #error "E1_CS_PIN is required for TMC2130. Define E1_CS_PIN in Configuration_adv.h." + #error "TMC2130 on E1 requires E1_CS_PIN." #elif AXIS_DRIVER_TYPE(E2, TMC2130) && !PIN_EXISTS(E2_CS) - #error "E2_CS_PIN is required for TMC2130. Define E2_CS_PIN in Configuration_adv.h." + #error "TMC2130 on E2 requires E2_CS_PIN." #elif AXIS_DRIVER_TYPE(E3, TMC2130) && !PIN_EXISTS(E3_CS) - #error "E3_CS_PIN is required for TMC2130. Define E3_CS_PIN in Configuration_adv.h." + #error "TMC2130 on E3 requires E3_CS_PIN." #elif AXIS_DRIVER_TYPE(E4, TMC2130) && !PIN_EXISTS(E4_CS) - #error "E4_CS_PIN is required for TMC2130. Define E4_CS_PIN in Configuration_adv.h." + #error "TMC2130 on E4 requires E4_CS_PIN." #elif AXIS_DRIVER_TYPE(E5, TMC2130) && !PIN_EXISTS(E5_CS) - #error "E5_CS_PIN is required for TMC2130. Define E5_CS_PIN in Configuration_adv.h." + #error "TMC2130 on E5 requires E5_CS_PIN." +#endif + +/** + * Check existing RX/TX pins against enable TMC UART drivers. + */ +#if AXIS_DRIVER_TYPE(X, TMC2208) && !(defined(X_HARDWARE_SERIAL) || (PIN_EXISTS(X_SERIAL_RX) && PIN_EXISTS(X_SERIAL_TX))) + #error "TMC2208 on X requires X_HARDWARE_SERIAL or both X_SERIAL_RX_PIN and X_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(X2, TMC2208) && !(defined(X2_HARDWARE_SERIAL) || (PIN_EXISTS(X2_SERIAL_RX) && PIN_EXISTS(X2_SERIAL_TX))) + #error "TMC2208 on X2 requires X2_HARDWARE_SERIAL or both X2_SERIAL_RX_PIN and X2_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(Y, TMC2208) && !(defined(Y_HARDWARE_SERIAL) || (PIN_EXISTS(Y_SERIAL_RX) && PIN_EXISTS(Y_SERIAL_TX))) + #error "TMC2208 on Y requires Y_HARDWARE_SERIAL or both Y_SERIAL_RX_PIN and Y_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(Y2, TMC2208) && !(defined(Y2_HARDWARE_SERIAL) || (PIN_EXISTS(Y2_SERIAL_RX) && PIN_EXISTS(Y2_SERIAL_TX))) + #error "TMC2208 on Y2 requires Y2_HARDWARE_SERIAL or both Y2_SERIAL_RX_PIN and Y2_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(Z, TMC2208) && !(defined(Z_HARDWARE_SERIAL) || (PIN_EXISTS(Z_SERIAL_RX) && PIN_EXISTS(Z_SERIAL_TX))) + #error "TMC2208 on Z requires Z_HARDWARE_SERIAL or both Z_SERIAL_RX_PIN and Z_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(Z2, TMC2208) && !(defined(Z2_HARDWARE_SERIAL) || (PIN_EXISTS(Z2_SERIAL_RX) && PIN_EXISTS(Z2_SERIAL_TX))) + #error "TMC2208 on Z2 requires Z2_HARDWARE_SERIAL or both Z2_SERIAL_RX_PIN and Z2_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(Z3, TMC2208) && !(defined(Z3_HARDWARE_SERIAL) || (PIN_EXISTS(Z3_SERIAL_RX) && PIN_EXISTS(Z3_SERIAL_TX))) + #error "TMC2208 on Z3 requires Z3_HARDWARE_SERIAL or both Z3_SERIAL_RX_PIN and Z3_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(E0, TMC2208) && !(defined(E0_HARDWARE_SERIAL) || (PIN_EXISTS(E0_SERIAL_RX) && PIN_EXISTS(E0_SERIAL_TX))) + #error "TMC2208 on E0 requires E0_HARDWARE_SERIAL or both E0_SERIAL_RX_PIN and E0_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(E1, TMC2208) && !(defined(E1_HARDWARE_SERIAL) || (PIN_EXISTS(E1_SERIAL_RX) && PIN_EXISTS(E1_SERIAL_TX))) + #error "TMC2208 on E1 requires E1_HARDWARE_SERIAL or both E1_SERIAL_RX_PIN and E1_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(E2, TMC2208) && !(defined(E2_HARDWARE_SERIAL) || (PIN_EXISTS(E2_SERIAL_RX) && PIN_EXISTS(E2_SERIAL_TX))) + #error "TMC2208 on E2 requires E2_HARDWARE_SERIAL or both E2_SERIAL_RX_PIN and E2_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(E3, TMC2208) && !(defined(E3_HARDWARE_SERIAL) || (PIN_EXISTS(E3_SERIAL_RX) && PIN_EXISTS(E3_SERIAL_TX))) + #error "TMC2208 on E3 requires E3_HARDWARE_SERIAL or both E3_SERIAL_RX_PIN and E3_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(E4, TMC2208) && !(defined(E4_HARDWARE_SERIAL) || (PIN_EXISTS(E4_SERIAL_RX) && PIN_EXISTS(E4_SERIAL_TX))) + #error "TMC2208 on E4 requires E4_HARDWARE_SERIAL or both E4_SERIAL_RX_PIN and E4_SERIAL_TX_PIN." +#elif AXIS_DRIVER_TYPE(E5, TMC2208) && !(defined(E5_HARDWARE_SERIAL) || (PIN_EXISTS(E5_SERIAL_RX) && PIN_EXISTS(E5_SERIAL_TX))) + #error "TMC2208 on E5 requires E5_HARDWARE_SERIAL or both E5_SERIAL_RX_PIN and E5_SERIAL_TX_PIN." #endif /** @@ -1797,6 +1826,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif #endif +// Sensorless homing/probing requirements +#if ENABLED(SENSORLESS_HOMING) && !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS) + #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes." +#elif ENABLED(SENSORLESS_PROBING) && ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS) + #error "SENSORLESS_PROBING for DELTA requires TMC stepper drivers with StallGuard on X, Y, and Z axes." +#elif ENABLED(SENSORLESS_PROBING) && !Z_SENSORLESS + #error "SENSORLESS_PROBING requires a TMC stepper driver with StallGuard on Z." +#endif + // Sensorless homing is required for both combined steppers in an H-bot #if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS #error "CoreXY requires both X and Y to use sensorless homing if either does." @@ -1904,5 +1942,3 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m #if ENABLED(SD_FIRMWARE_UPDATE) && !defined(__AVR_ATmega2560__) #error "SD_FIRMWARE_UPDATE requires an ATmega2560-based (Arduino Mega) board." #endif - -#endif // _SANITYCHECK_H_ diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 9e1496a558..98b1063ea5 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -32,6 +32,10 @@ #include "../../module/planner.h" #include "../../feature/bedlevel/bedlevel.h" +#if HAS_BED_PROBE && DISABLED(BABYSTEP_ZPROBE_OFFSET) + #include "../../module/probe.h" +#endif + #if ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING) #include "../../module/motion.h" diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 4743b60ec8..c06549d8b7 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -155,9 +155,9 @@ static void _lcd_move_xyz(PGM_P name, AxisEnum axis) { lcd_implementation_drawedit(name, move_menu_scale >= 0.1f ? ftostr41sign(pos) : ftostr43sign(pos)); } } -inline void lcd_move_x() { _lcd_move_xyz(PSTR(MSG_MOVE_X), X_AXIS); } -inline void lcd_move_y() { _lcd_move_xyz(PSTR(MSG_MOVE_Y), Y_AXIS); } -inline void lcd_move_z() { _lcd_move_xyz(PSTR(MSG_MOVE_Z), Z_AXIS); } +void lcd_move_x() { _lcd_move_xyz(PSTR(MSG_MOVE_X), X_AXIS); } +void lcd_move_y() { _lcd_move_xyz(PSTR(MSG_MOVE_Y), Y_AXIS); } +void lcd_move_z() { _lcd_move_xyz(PSTR(MSG_MOVE_Z), Z_AXIS); } static void _lcd_move_e( #if E_MANUAL > 1 const int8_t eindex=-1 diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 4c246b7ae0..6f706d36ce 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -224,10 +224,27 @@ bool lcd_blink() { volatile uint8_t buttons_reprapworld_keypad; #endif -#if ENABLED(ADC_KEYPAD) +#if ENABLED(REPRAPWORLD_KEYPAD) || ENABLED(ADC_KEYPAD) + #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values - #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_F1 - #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_MIDDLE + #define BLEN_REPRAPWORLD_KEYPAD_F3 0 + #define BLEN_REPRAPWORLD_KEYPAD_F2 1 + #define BLEN_REPRAPWORLD_KEYPAD_F1 2 + + #define BLEN_REPRAPWORLD_KEYPAD_DOWN 3 + #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4 + #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5 + #define BLEN_REPRAPWORLD_KEYPAD_UP 6 + #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7 + #define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN)) + #define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT)) + #define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE)) + #define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP)) + #define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT)) + +#endif // REPRAPWORLD_KEYPAD || ADC_KEYPAD + +#if ENABLED(ADC_KEYPAD) inline bool handle_adc_keypad() { #define ADC_MIN_KEY_DELAY 100 @@ -259,42 +276,27 @@ bool lcd_blink() { #elif ENABLED(REPRAPWORLD_KEYPAD) - #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values + #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_F1 + #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_MIDDLE - #define BLEN_REPRAPWORLD_KEYPAD_F3 0 - #define BLEN_REPRAPWORLD_KEYPAD_F2 1 - #define BLEN_REPRAPWORLD_KEYPAD_F1 2 - #define BLEN_REPRAPWORLD_KEYPAD_DOWN 3 - #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4 - #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5 - #define BLEN_REPRAPWORLD_KEYPAD_UP 6 - #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7 - - #define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3)) - #define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2)) - #define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1)) - #define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN)) - #define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT)) - #define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE)) - #define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP)) - #define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT)) - - #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3) + #define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1)) + #define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2)) + #define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3)) + #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2) + #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3) #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT) - #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_MIDDLE - #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_F1 #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & KEYPAD_HOME) #define REPRAPWORLD_KEYPAD_MOVE_MENU (buttons_reprapworld_keypad & KEYPAD_EN_C) #define REPRAPWORLD_KEYPAD_PRESSED (buttons_reprapworld_keypad & ( \ - EN_REPRAPWORLD_KEYPAD_F3 | \ - EN_REPRAPWORLD_KEYPAD_F2 | \ EN_REPRAPWORLD_KEYPAD_F1 | \ + EN_REPRAPWORLD_KEYPAD_F2 | \ + EN_REPRAPWORLD_KEYPAD_F3 | \ EN_REPRAPWORLD_KEYPAD_DOWN | \ EN_REPRAPWORLD_KEYPAD_RIGHT | \ EN_REPRAPWORLD_KEYPAD_MIDDLE | \ @@ -302,6 +304,10 @@ bool lcd_blink() { EN_REPRAPWORLD_KEYPAD_LEFT) \ ) + void lcd_move_x(); + void lcd_move_y(); + void lcd_move_z(); + void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) { move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; encoderPosition = dir; @@ -347,9 +353,7 @@ bool lcd_blink() { if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) reprapworld_keypad_move_y_down(); if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) reprapworld_keypad_move_y_up(); } - else { - if (REPRAPWORLD_KEYPAD_MOVE_HOME) reprapworld_keypad_move_home(); - } + else if (REPRAPWORLD_KEYPAD_MOVE_HOME) reprapworld_keypad_move_home(); } } diff --git a/buildroot/share/tests/LPC1768_tests b/buildroot/share/tests/LPC1768_tests index 237d9d4d98..9d0742d9df 100755 --- a/buildroot/share/tests/LPC1768_tests +++ b/buildroot/share/tests/LPC1768_tests @@ -70,7 +70,8 @@ opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN opt_set X_DRIVER_TYPE TMC2130 opt_set Y_DRIVER_TYPE TMC2130 opt_set Z_DRIVER_TYPE TMC2130 -opt_enable_adv TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG SENSORLESS_PROBING +opt_enable_adv TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG \ + SENSORLESS_PROBING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY exec_test $1 $2 "Delta Config (generic) + BOARD_COHESION3D_REMIX + UBL + EEPROM_SETTINGS + SENSORLESS_PROBING" # clean up