From ed4a6371ad629dc3e4e4095aa07a8b1045445ab5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Jul 2015 20:42:34 -0700 Subject: [PATCH 1/5] Add HAS_SERVO_ENDSTOPS to simplify conditonals --- Marlin/Conditionals.h | 1 + Marlin/Marlin_main.cpp | 28 ++++++++++++++-------------- Marlin/SanityCheck.h | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index bed26bffdd..464ead540c 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -526,6 +526,7 @@ #endif #if (X_ENDSTOP_SERVO_NR >= 0) || (Y_ENDSTOP_SERVO_NR >= 0) || (Z_ENDSTOP_SERVO_NR >= 0) #define SERVO_ENDSTOPS {X_ENDSTOP_SERVO_NR, Y_ENDSTOP_SERVO_NR, Z_ENDSTOP_SERVO_NR} + #define HAS_SERVO_ENDSTOPS true #endif #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4395ca3493..ef439efd8a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -314,8 +314,8 @@ bool target_direction; }; #endif -#ifdef SERVO_ENDSTOPS const int servo_endstops[] = SERVO_ENDSTOPS; +#if HAS_SERVO_ENDSTOPS const int servo_endstop_angles[][2] = SERVO_ENDSTOP_ANGLES; #endif @@ -578,7 +578,7 @@ void servo_init() { #endif // Set position of Servo Endstops that are defined - #ifdef SERVO_ENDSTOPS + #if HAS_SERVO_ENDSTOPS for (int i = 0; i < 3; i++) if (servo_endstops[i] >= 0) servo[servo_endstops[i]].move(servo_endstop_angles[i][1]); @@ -1322,7 +1322,7 @@ static void setup_for_endstop_move() { static void deploy_z_probe() { - #ifdef SERVO_ENDSTOPS + #if HAS_SERVO_ENDSTOPS // Engage Z Servo endstop if enabled if (servo_endstops[Z_AXIS] >= 0) servo[servo_endstops[Z_AXIS]].move(servo_endstop_angles[Z_AXIS][0]); @@ -1412,7 +1412,7 @@ static void setup_for_endstop_move() { static void stow_z_probe(bool doRaise=true) { - #ifdef SERVO_ENDSTOPS + #if HAS_SERVO_ENDSTOPS // Retract Z Servo endstop if enabled if (servo_endstops[Z_AXIS] >= 0) { @@ -1676,7 +1676,7 @@ static void homeaxis(AxisEnum axis) { #endif - #ifdef SERVO_ENDSTOPS + #if HAS_SERVO_ENDSTOPS // Engage Servo endstop if enabled if (axis != Z_AXIS && servo_endstops[axis] >= 0) servo[servo_endstops[axis]].move(servo_endstop_angles[axis][0]); @@ -1778,7 +1778,7 @@ static void homeaxis(AxisEnum axis) { #endif { - #ifdef SERVO_ENDSTOPS + #if HAS_SERVO_ENDSTOPS // Retract Servo endstop if enabled if (servo_endstops[axis] >= 0) servo[servo_endstops[axis]].move(servo_endstop_angles[axis][1]); @@ -2778,7 +2778,7 @@ inline void gcode_G28() { // added here, it could be seen as a compensating factor for the Z probe. // current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z) - #if defined(SERVO_ENDSTOPS) || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) + #if HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) + Z_RAISE_AFTER_PROBING #endif ; @@ -4570,9 +4570,9 @@ inline void gcode_M303() { */ inline void gcode_M400() { st_synchronize(); } -#if defined(ENABLE_AUTO_BED_LEVELING) && !defined(Z_PROBE_SLED) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY)) +#if defined(ENABLE_AUTO_BED_LEVELING) && !defined(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || defined(Z_PROBE_ALLEN_KEY)) - #ifdef SERVO_ENDSTOPS + #if HAS_SERVO_ENDSTOPS void raise_z_for_servo() { float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_HOMING; z_dest += axis_known_position[Z_AXIS] ? zprobe_zoffset : zpos; @@ -4584,7 +4584,7 @@ inline void gcode_M400() { st_synchronize(); } * M401: Engage Z Servo endstop if available */ inline void gcode_M401() { - #ifdef SERVO_ENDSTOPS + #if HAS_SERVO_ENDSTOPS raise_z_for_servo(); #endif deploy_z_probe(); @@ -4594,13 +4594,13 @@ inline void gcode_M400() { st_synchronize(); } * M402: Retract Z Servo endstop if enabled */ inline void gcode_M402() { - #ifdef SERVO_ENDSTOPS + #if HAS_SERVO_ENDSTOPS raise_z_for_servo(); #endif stow_z_probe(false); } -#endif // ENABLE_AUTO_BED_LEVELING && (SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED +#endif // ENABLE_AUTO_BED_LEVELING && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED #ifdef FILAMENT_SENSOR @@ -5645,14 +5645,14 @@ void process_next_command() { gcode_M400(); break; - #if defined(ENABLE_AUTO_BED_LEVELING) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY)) && !defined(Z_PROBE_SLED) + #if defined(ENABLE_AUTO_BED_LEVELING) && (HAS_SERVO_ENDSTOPS || defined(Z_PROBE_ALLEN_KEY)) && !defined(Z_PROBE_SLED) case 401: gcode_M401(); break; case 402: gcode_M402(); break; - #endif // ENABLE_AUTO_BED_LEVELING && (SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED + #endif // ENABLE_AUTO_BED_LEVELING && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED #ifdef FILAMENT_SENSOR case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 867144c3e8..b6bd644b47 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -98,7 +98,7 @@ /** * Servo deactivation depends on servo endstops */ - #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && !defined(SERVO_ENDSTOPS) + #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && !HAS_SERVO_ENDSTOPS #error At least one of the ?_ENDSTOP_SERVO_NR is required for DEACTIVATE_SERVOS_AFTER_MOVE. #endif From edaaead7e0a7c443eb90a40e355b0e47091aceff Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Jul 2015 20:43:21 -0700 Subject: [PATCH 2/5] Fix comment about SERVO_ENDSTOP_ANGLES --- Marlin/Configuration.h | 2 +- Marlin/configurator/config/Configuration.h | 2 +- Marlin/example_configurations/Felix/Configuration.h | 2 +- Marlin/example_configurations/Felix/Configuration_DUAL.h | 2 +- Marlin/example_configurations/Hephestos/Configuration.h | 2 +- Marlin/example_configurations/K8200/Configuration.h | 2 +- .../RepRapWorld/Megatronics/Configuration.h | 2 +- Marlin/example_configurations/RigidBot/Configuration.h | 2 +- Marlin/example_configurations/SCARA/Configuration.h | 2 +- Marlin/example_configurations/WITBOX/Configuration.h | 2 +- Marlin/example_configurations/adafruit/ST7565/Configuration.h | 2 +- Marlin/example_configurations/delta/biv2.5/Configuration.h | 2 +- Marlin/example_configurations/delta/generic/Configuration.h | 2 +- Marlin/example_configurations/delta/kossel_mini/Configuration.h | 2 +- Marlin/example_configurations/delta/kossel_pro/Configuration.h | 2 +- Marlin/example_configurations/makibox/Configuration.h | 2 +- Marlin/example_configurations/tvrrug/Round2/Configuration.h | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 87578f8055..c441c24675 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -530,7 +530,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index 87578f8055..c441c24675 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -530,7 +530,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 0c85394f17..5d7918dc15 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -512,7 +512,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 93f5ca27bc..581a0ab483 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -473,7 +473,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 349a1edf3e..388a4671c6 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -522,7 +522,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index b41470df35..7af96c9ddd 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -518,7 +518,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 24c2108caf..78ec83e120 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -530,7 +530,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 6ec2b15d0e..af69f79e67 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -510,7 +510,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 5ee968a188..c889dd73f0 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -538,7 +538,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index ec36541dbb..2b01fd333f 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -522,7 +522,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index b2d56fea88..64896e8397 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -530,7 +530,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index a9a7d8ba0c..19c9612147 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -650,7 +650,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 6908ea9e47..40c85a51df 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -650,7 +650,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index fec90f295d..e51b46a85b 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -654,7 +654,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 6ba3f9af4d..05a9b8a903 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -639,7 +639,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index eb425026ae..13cc50002c 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -533,7 +533,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index cd60724141..d386936563 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -520,7 +520,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. - // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C Servo below. // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. From 1f632936247faf4e374c1dbf711225cb818a6122 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Jul 2015 20:46:36 -0700 Subject: [PATCH 3/5] servo_endstops -> servo_endstop_id --- Marlin/Conditionals.h | 2 +- Marlin/Marlin_main.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 464ead540c..3598dab2da 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -513,7 +513,6 @@ #define HAS_BUZZER ((defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER)) - #if defined( NUM_SERVOS ) && (NUM_SERVOS > 0) #ifndef X_ENDSTOP_SERVO_NR #define X_ENDSTOP_SERVO_NR -1 @@ -527,6 +526,7 @@ #if (X_ENDSTOP_SERVO_NR >= 0) || (Y_ENDSTOP_SERVO_NR >= 0) || (Z_ENDSTOP_SERVO_NR >= 0) #define SERVO_ENDSTOPS {X_ENDSTOP_SERVO_NR, Y_ENDSTOP_SERVO_NR, Z_ENDSTOP_SERVO_NR} #define HAS_SERVO_ENDSTOPS true + #define SERVO_ENDSTOP_IDS { X_ENDSTOP_SERVO_NR, Y_ENDSTOP_SERVO_NR, Z_ENDSTOP_SERVO_NR } #endif #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index ef439efd8a..8282429717 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -314,8 +314,8 @@ bool target_direction; }; #endif - const int servo_endstops[] = SERVO_ENDSTOPS; #if HAS_SERVO_ENDSTOPS + const int servo_endstop_id[] = SERVO_ENDSTOP_IDS; const int servo_endstop_angles[][2] = SERVO_ENDSTOP_ANGLES; #endif @@ -580,8 +580,8 @@ void servo_init() { // Set position of Servo Endstops that are defined #if HAS_SERVO_ENDSTOPS for (int i = 0; i < 3; i++) - if (servo_endstops[i] >= 0) - servo[servo_endstops[i]].move(servo_endstop_angles[i][1]); + if (servo_endstop_id[i] >= 0) + servo[servo_endstop_id[i]].move(servo_endstop_angles[i][1]); #endif } @@ -1325,7 +1325,7 @@ static void setup_for_endstop_move() { #if HAS_SERVO_ENDSTOPS // Engage Z Servo endstop if enabled - if (servo_endstops[Z_AXIS] >= 0) servo[servo_endstops[Z_AXIS]].move(servo_endstop_angles[Z_AXIS][0]); + if (servo_endstop_id[Z_AXIS] >= 0) servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angles[Z_AXIS][0]); #elif defined(Z_PROBE_ALLEN_KEY) feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE; @@ -1415,7 +1415,7 @@ static void setup_for_endstop_move() { #if HAS_SERVO_ENDSTOPS // Retract Z Servo endstop if enabled - if (servo_endstops[Z_AXIS] >= 0) { + if (servo_endstop_id[Z_AXIS] >= 0) { #if Z_RAISE_AFTER_PROBING > 0 if (doRaise) { @@ -1425,7 +1425,7 @@ static void setup_for_endstop_move() { #endif // Change the Z servo angle - servo[servo_endstops[Z_AXIS]].move(servo_endstop_angles[Z_AXIS][1]); + servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angles[Z_AXIS][1]); } #elif defined(Z_PROBE_ALLEN_KEY) @@ -1678,8 +1678,8 @@ static void homeaxis(AxisEnum axis) { #if HAS_SERVO_ENDSTOPS // Engage Servo endstop if enabled - if (axis != Z_AXIS && servo_endstops[axis] >= 0) - servo[servo_endstops[axis]].move(servo_endstop_angles[axis][0]); + if (axis != Z_AXIS && servo_endstop_id[axis] >= 0) + servo[servo_endstop_id[axis]].move(servo_endstop_angles[axis][0]); #endif // Set a flag for Z motor locking @@ -1780,8 +1780,8 @@ static void homeaxis(AxisEnum axis) { { #if HAS_SERVO_ENDSTOPS // Retract Servo endstop if enabled - if (servo_endstops[axis] >= 0) - servo[servo_endstops[axis]].move(servo_endstop_angles[axis][1]); + if (servo_endstop_id[axis] >= 0) + servo[servo_endstop_id[axis]].move(servo_endstop_angles[axis][1]); #endif } From 9334479aebb294f33adebdf1395e545705f6985f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Jul 2015 20:47:22 -0700 Subject: [PATCH 4/5] Minor cleanup of Conditionals.h --- Marlin/Conditionals.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 3598dab2da..c896f0f92f 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -513,7 +513,7 @@ #define HAS_BUZZER ((defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER)) - #if defined( NUM_SERVOS ) && (NUM_SERVOS > 0) + #if defined(NUM_SERVOS) && NUM_SERVOS > 0 #ifndef X_ENDSTOP_SERVO_NR #define X_ENDSTOP_SERVO_NR -1 #endif @@ -523,8 +523,7 @@ #ifndef Z_ENDSTOP_SERVO_NR #define Z_ENDSTOP_SERVO_NR -1 #endif - #if (X_ENDSTOP_SERVO_NR >= 0) || (Y_ENDSTOP_SERVO_NR >= 0) || (Z_ENDSTOP_SERVO_NR >= 0) - #define SERVO_ENDSTOPS {X_ENDSTOP_SERVO_NR, Y_ENDSTOP_SERVO_NR, Z_ENDSTOP_SERVO_NR} + #if X_ENDSTOP_SERVO_NR >= 0 || Y_ENDSTOP_SERVO_NR >= 0 || Z_ENDSTOP_SERVO_NR >= 0 #define HAS_SERVO_ENDSTOPS true #define SERVO_ENDSTOP_IDS { X_ENDSTOP_SERVO_NR, Y_ENDSTOP_SERVO_NR, Z_ENDSTOP_SERVO_NR } #endif From 9d151bb61b078e25f4c0f8555359421b9b893e90 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Jul 2015 20:57:27 -0700 Subject: [PATCH 5/5] servo_endstop_angles -> servo_endstop_angle --- Marlin/Marlin_main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 8282429717..f2863f4ec4 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -316,7 +316,7 @@ bool target_direction; #if HAS_SERVO_ENDSTOPS const int servo_endstop_id[] = SERVO_ENDSTOP_IDS; - const int servo_endstop_angles[][2] = SERVO_ENDSTOP_ANGLES; + const int servo_endstop_angle[][2] = SERVO_ENDSTOP_ANGLES; #endif #ifdef BARICUDA @@ -581,7 +581,7 @@ void servo_init() { #if HAS_SERVO_ENDSTOPS for (int i = 0; i < 3; i++) if (servo_endstop_id[i] >= 0) - servo[servo_endstop_id[i]].move(servo_endstop_angles[i][1]); + servo[servo_endstop_id[i]].move(servo_endstop_angle[i][1]); #endif } @@ -1325,7 +1325,7 @@ static void setup_for_endstop_move() { #if HAS_SERVO_ENDSTOPS // Engage Z Servo endstop if enabled - if (servo_endstop_id[Z_AXIS] >= 0) servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angles[Z_AXIS][0]); + if (servo_endstop_id[Z_AXIS] >= 0) servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angle[Z_AXIS][0]); #elif defined(Z_PROBE_ALLEN_KEY) feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE; @@ -1425,7 +1425,7 @@ static void setup_for_endstop_move() { #endif // Change the Z servo angle - servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angles[Z_AXIS][1]); + servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angle[Z_AXIS][1]); } #elif defined(Z_PROBE_ALLEN_KEY) @@ -1679,7 +1679,7 @@ static void homeaxis(AxisEnum axis) { #if HAS_SERVO_ENDSTOPS // Engage Servo endstop if enabled if (axis != Z_AXIS && servo_endstop_id[axis] >= 0) - servo[servo_endstop_id[axis]].move(servo_endstop_angles[axis][0]); + servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][0]); #endif // Set a flag for Z motor locking @@ -1781,7 +1781,7 @@ static void homeaxis(AxisEnum axis) { #if HAS_SERVO_ENDSTOPS // Retract Servo endstop if enabled if (servo_endstop_id[axis] >= 0) - servo[servo_endstop_id[axis]].move(servo_endstop_angles[axis][1]); + servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][1]); #endif }