From c56b66543d57d7fc7148df8891f20e30718dd491 Mon Sep 17 00:00:00 2001 From: Neil van Geffen Date: Tue, 28 Apr 2020 01:27:14 +1200 Subject: [PATCH] Permit Stall Sensitivity of 0 (#17722) --- Marlin/src/HAL/STM32/SoftwareSerial.cpp | 44 +++++++++---------- Marlin/src/core/multi_language.h | 2 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 6 +-- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 6 +-- Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h | 6 +-- Marlin/src/pins/pins.h | 10 ++--- .../src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h | 6 +-- .../variants/STEVAL_F401VE/variant.cpp | 2 +- .../variants/STEVAL_F401VE/variant.h | 2 +- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Marlin/src/HAL/STM32/SoftwareSerial.cpp b/Marlin/src/HAL/STM32/SoftwareSerial.cpp index f6363aa1cf..60f355e08e 100644 --- a/Marlin/src/HAL/STM32/SoftwareSerial.cpp +++ b/Marlin/src/HAL/STM32/SoftwareSerial.cpp @@ -47,49 +47,49 @@ // The order is based on (lack of) features and compare channels, we choose the simplest available // because we only need an update interrupt #if !defined(TIMER_SERIAL) -#if defined (TIM18_BASE) +#if defined(TIM18_BASE) #define TIMER_SERIAL TIM18 -#elif defined (TIM7_BASE) +#elif defined(TIM7_BASE) #define TIMER_SERIAL TIM7 -#elif defined (TIM6_BASE) +#elif defined(TIM6_BASE) #define TIMER_SERIAL TIM6 -#elif defined (TIM22_BASE) +#elif defined(TIM22_BASE) #define TIMER_SERIAL TIM22 -#elif defined (TIM21_BASE) +#elif defined(TIM21_BASE) #define TIMER_SERIAL TIM21 -#elif defined (TIM17_BASE) +#elif defined(TIM17_BASE) #define TIMER_SERIAL TIM17 -#elif defined (TIM16_BASE) +#elif defined(TIM16_BASE) #define TIMER_SERIAL TIM16 -#elif defined (TIM15_BASE) +#elif defined(TIM15_BASE) #define TIMER_SERIAL TIM15 -#elif defined (TIM14_BASE) +#elif defined(TIM14_BASE) #define TIMER_SERIAL TIM14 -#elif defined (TIM13_BASE) +#elif defined(TIM13_BASE) #define TIMER_SERIAL TIM13 -#elif defined (TIM11_BASE) +#elif defined(TIM11_BASE) #define TIMER_SERIAL TIM11 -#elif defined (TIM10_BASE) +#elif defined(TIM10_BASE) #define TIMER_SERIAL TIM10 -#elif defined (TIM12_BASE) +#elif defined(TIM12_BASE) #define TIMER_SERIAL TIM12 -#elif defined (TIM19_BASE) +#elif defined(TIM19_BASE) #define TIMER_SERIAL TIM19 -#elif defined (TIM9_BASE) +#elif defined(TIM9_BASE) #define TIMER_SERIAL TIM9 -#elif defined (TIM5_BASE) +#elif defined(TIM5_BASE) #define TIMER_SERIAL TIM5 -#elif defined (TIM4_BASE) +#elif defined(TIM4_BASE) #define TIMER_SERIAL TIM4 -#elif defined (TIM3_BASE) +#elif defined(TIM3_BASE) #define TIMER_SERIAL TIM3 -#elif defined (TIM2_BASE) +#elif defined(TIM2_BASE) #define TIMER_SERIAL TIM2 -#elif defined (TIM20_BASE) +#elif defined(TIM20_BASE) #define TIMER_SERIAL TIM20 -#elif defined (TIM8_BASE) +#elif defined(TIM8_BASE) #define TIMER_SERIAL TIM8 -#elif defined (TIM1_BASE) +#elif defined(TIM1_BASE) #define TIMER_SERIAL TIM1 #else #error No suitable timer found for SoftwareSerial, define TIMER_SERIAL in variant.h diff --git a/Marlin/src/core/multi_language.h b/Marlin/src/core/multi_language.h index e1cd2f308e..3533412090 100644 --- a/Marlin/src/core/multi_language.h +++ b/Marlin/src/core/multi_language.h @@ -22,7 +22,7 @@ typedef const char Language_Str[]; -#if defined(LCD_LANGUAGE_5) +#ifdef LCD_LANGUAGE_5 #define NUM_LANGUAGES 5 #elif defined(LCD_LANGUAGE_4) #define NUM_LANGUAGES 4 diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index 94d90c30d1..a9d333721f 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -43,7 +43,7 @@ // // Limit Switches // -#if X_STALL_SENSITIVITY +#ifdef X_STALL_SENSITIVITY #define X_STOP_PIN X_DIAG_PIN #if X_HOME_DIR < 0 #define X_MAX_PIN P1_28 // X+ @@ -55,7 +55,7 @@ #define X_MAX_PIN P1_28 // X+ #endif -#if Y_STALL_SENSITIVITY +#ifdef Y_STALL_SENSITIVITY #define Y_STOP_PIN Y_DIAG_PIN #if Y_HOME_DIR < 0 #define Y_MAX_PIN P1_26 // Y+ @@ -67,7 +67,7 @@ #define Y_MAX_PIN P1_26 // Y+ #endif -#if Z_STALL_SENSITIVITY +#ifdef Z_STALL_SENSITIVITY #define Z_STOP_PIN Z_DIAG_PIN #if Z_HOME_DIR < 0 #define Z_MAX_PIN P1_24 // Z+ diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index 7e722ea45f..5004d166cd 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -57,7 +57,7 @@ // // Limit Switches // -#if X_STALL_SENSITIVITY +#ifdef X_STALL_SENSITIVITY #define X_STOP_PIN X_DIAG_PIN #if X_HOME_DIR < 0 #define X_MAX_PIN P1_26 // E0DET @@ -68,7 +68,7 @@ #define X_STOP_PIN P1_29 // X-STOP #endif -#if Y_STALL_SENSITIVITY +#ifdef Y_STALL_SENSITIVITY #define Y_STOP_PIN Y_DIAG_PIN #if Y_HOME_DIR < 0 #define Y_MAX_PIN P1_25 // E1DET @@ -79,7 +79,7 @@ #define Y_STOP_PIN P1_28 // Y-STOP #endif -#if Z_STALL_SENSITIVITY +#ifdef Z_STALL_SENSITIVITY #define Z_STOP_PIN Z_DIAG_PIN #if Z_HOME_DIR < 0 #define Z_MAX_PIN P1_00 // PWRDET diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index 8dcb194d33..f8fd0afcd3 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -58,7 +58,7 @@ // // Limit Switches // -#if X_STALL_SENSITIVITY +#ifdef X_STALL_SENSITIVITY #define X_STOP_PIN X_DIAG_PIN #if X_HOME_DIR < 0 #define X_MAX_PIN P1_28 // X+ @@ -70,7 +70,7 @@ #define X_MAX_PIN P1_28 // X+ #endif -#if Y_STALL_SENSITIVITY +#ifdef Y_STALL_SENSITIVITY #define Y_STOP_PIN Y_DIAG_PIN #if Y_HOME_DIR < 0 #define Y_MAX_PIN P1_26 // Y+ @@ -82,7 +82,7 @@ #define Y_MAX_PIN P1_26 // Y+ #endif -#if Z_STALL_SENSITIVITY +#ifdef Z_STALL_SENSITIVITY #define Z_STOP_PIN Z_DIAG_PIN #if Z_HOME_DIR < 0 #define Z_MAX_PIN P1_24 // Z+ diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 98415e02aa..d4ba832269 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -1225,7 +1225,7 @@ // // Auto-assign pins for stallGuard sensorless homing // - #if X2_STALL_SENSITIVITY && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG) + #if defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG) #define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG) #if DIAG_REMAPPED(X2, X_MIN) // If already remapped in the pins file... #define X2_USE_ENDSTOP _XMIN_ @@ -1294,7 +1294,7 @@ #define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX) #endif #endif - #if Y2_STALL_SENSITIVITY && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG) + #if defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG) #define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG) #if DIAG_REMAPPED(Y2, X_MIN) #define Y2_USE_ENDSTOP _XMIN_ @@ -1362,7 +1362,7 @@ #define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX) #endif #endif - #if Z2_STALL_SENSITIVITY && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG) + #if defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG) #define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG) #if DIAG_REMAPPED(Z2, X_MIN) #define Z2_USE_ENDSTOP _XMIN_ @@ -1431,7 +1431,7 @@ #define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX) #endif #endif - #if Z3_STALL_SENSITIVITY && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG) + #if defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG) #define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG) #if DIAG_REMAPPED(Z3, X_MIN) #define Z3_USE_ENDSTOP _XMIN_ @@ -1498,7 +1498,7 @@ #define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX) #endif #endif - #if Z4_STALL_SENSITIVITY && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG) + #if defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG) #define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG) #if DIAG_REMAPPED(Z4, X_MIN) #define Z4_USE_ENDSTOP _XMIN_ diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h index f9e43c0043..02f2c9071b 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h @@ -51,7 +51,7 @@ // // Limit Switches // -#if X_STALL_SENSITIVITY +#ifdef X_STALL_SENSITIVITY #define X_STOP_PIN X_DIAG_PIN #if X_HOME_DIR < 0 #define X_MAX_PIN PE15 // E0 @@ -63,7 +63,7 @@ #define X_MAX_PIN PE15 // E0 #endif -#if Y_STALL_SENSITIVITY +#ifdef Y_STALL_SENSITIVITY #define Y_STOP_PIN Y_DIAG_PIN #if Y_HOME_DIR < 0 #define Y_MAX_PIN PE10 // E1 @@ -75,7 +75,7 @@ #define Y_MAX_PIN PE10 // E1 #endif -#if Z_STALL_SENSITIVITY +#ifdef Z_STALL_SENSITIVITY #define Z_STOP_PIN Z_DIAG_PIN #if Z_HOME_DIR < 0 #define Z_MAX_PIN PG5 // E2 diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.cpp b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.cpp index a53a92c48c..4ecbff0ecc 100644 --- a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.cpp +++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.cpp @@ -34,7 +34,7 @@ extern "C" { #endif -#if defined(ARDUINO_STEVAL) +#ifdef ARDUINO_STEVAL // Pin number // This array allows to wrap Arduino pin number(Dx or x) // to STM32 PinName (PX_n) diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h index 571f3207e9..df7295ab17 100644 --- a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h +++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h @@ -41,7 +41,7 @@ extern "C" { /*---------------------------------------------------------------------------- * Pins *----------------------------------------------------------------------------*/ -#if defined(ARDUINO_STEVAL) +#ifdef ARDUINO_STEVAL /*----------------------------------------------------------------------------