From f1eaed7e98f7a91c84a91815954ca7862aafd5b6 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Fri, 12 Jul 2019 05:30:15 -0400 Subject: [PATCH] Only init servo pins used for servos (#14589) --- Marlin/src/HAL/HAL_AVR/HAL.cpp | 8 ++++---- Marlin/src/HAL/HAL_LPC1768/main.cpp | 8 ++++---- Marlin/src/inc/Conditionals_post.h | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/HAL.cpp b/Marlin/src/HAL/HAL_AVR/HAL.cpp index 226dd9188a..058487feea 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.cpp +++ b/Marlin/src/HAL/HAL_AVR/HAL.cpp @@ -37,16 +37,16 @@ void HAL_init(void) { // Init Servo Pins - #if PIN_EXISTS(SERVO0) + #if HAS_SERVO_0 OUT_WRITE(SERVO0_PIN, LOW); #endif - #if PIN_EXISTS(SERVO1) + #if HAS_SERVO_1 OUT_WRITE(SERVO1_PIN, LOW); #endif - #if PIN_EXISTS(SERVO2) + #if HAS_SERVO_2 OUT_WRITE(SERVO2_PIN, LOW); #endif - #if PIN_EXISTS(SERVO3) + #if HAS_SERVO_3 OUT_WRITE(SERVO3_PIN, LOW); #endif } diff --git a/Marlin/src/HAL/HAL_LPC1768/main.cpp b/Marlin/src/HAL/HAL_LPC1768/main.cpp index 03b8d419b2..7ee34840bc 100644 --- a/Marlin/src/HAL/HAL_LPC1768/main.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/main.cpp @@ -73,16 +73,16 @@ void HAL_init(void) { #endif // Init Servo Pins - #if PIN_EXISTS(SERVO0) + #if HAS_SERVO_0 OUT_WRITE(SERVO0_PIN, LOW); #endif - #if PIN_EXISTS(SERVO1) + #if HAS_SERVO_1 OUT_WRITE(SERVO1_PIN, LOW); #endif - #if PIN_EXISTS(SERVO2) + #if HAS_SERVO_2 OUT_WRITE(SERVO2_PIN, LOW); #endif - #if PIN_EXISTS(SERVO3) + #if HAS_SERVO_3 OUT_WRITE(SERVO3_PIN, LOW); #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index afc22d260a..4399f7b184 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1000,11 +1000,11 @@ #define HAS_CONTROLLER_FAN (PIN_EXISTS(CONTROLLER_FAN)) // Servos -#define HAS_SERVO_0 (PIN_EXISTS(SERVO0)) -#define HAS_SERVO_1 (PIN_EXISTS(SERVO1)) -#define HAS_SERVO_2 (PIN_EXISTS(SERVO2)) -#define HAS_SERVO_3 (PIN_EXISTS(SERVO3)) -#define HAS_SERVOS (defined(NUM_SERVOS) && NUM_SERVOS > 0) +#define HAS_SERVO_0 (PIN_EXISTS(SERVO0) && NUM_SERVOS > 0) +#define HAS_SERVO_1 (PIN_EXISTS(SERVO1) && NUM_SERVOS > 1) +#define HAS_SERVO_2 (PIN_EXISTS(SERVO2) && NUM_SERVOS > 2) +#define HAS_SERVO_3 (PIN_EXISTS(SERVO3) && NUM_SERVOS > 3) +#define HAS_SERVOS (NUM_SERVOS > 0) #if HAS_SERVOS && !defined(Z_PROBE_SERVO_NR) #define Z_PROBE_SERVO_NR -1