Browse Source

Some more servo code tweaks

Just set up the pin. Don't move to a random position.

Simplify servo::move()
* servo::move() does not need the pin parameter - The pin is set during servo_init() with attach().
* servo::move() does not need a return value.

SERVO_LEVELING is the wrong condition to deactivate the servos.

Remove some temporary (Servo *) variables.
SanityCheck for the servo indexes.
AnHardt 10 years ago
parent
commit
8b876241bd

+ 16
- 0
Marlin/Conditionals.h View File

511
 
511
 
512
   #define HAS_BUZZER ((defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER))
512
   #define HAS_BUZZER ((defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER))
513
 
513
 
514
+
515
+  #if defined( NUM_SERVOS ) && (NUM_SERVOS > 0)
516
+    #ifndef X_ENDSTOP_SERVO_NR
517
+      #define X_ENDSTOP_SERVO_NR -1
518
+    #endif
519
+    #ifndef Y_ENDSTOP_SERVO_NR
520
+      #define Y_ENDSTOP_SERVO_NR -1
521
+    #endif
522
+    #ifndef Z_ENDSTOP_SERVO_NR
523
+      #define Z_ENDSTOP_SERVO_NR -1
524
+    #endif
525
+    #if (X_ENDSTOP_SERVO_NR >= 0) || (Y_ENDSTOP_SERVO_NR >= 0) || (Z_ENDSTOP_SERVO_NR >= 0)
526
+      #define SERVO_ENDSTOPS {X_ENDSTOP_SERVO_NR, Y_ENDSTOP_SERVO_NR, Z_ENDSTOP_SERVO_NR}
527
+    #endif
528
+  #endif
529
+
514
 #endif //CONFIGURATION_LCD
530
 #endif //CONFIGURATION_LCD
515
 #endif //CONDITIONALS_H
531
 #endif //CONDITIONALS_H

+ 4
- 2
Marlin/Configuration.h View File

530
   // 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.
530
   // 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.
531
   // 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.
531
   // 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.
532
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
532
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
533
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
533
+  // 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.
534
   // 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
534
   // 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
535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
536
   // 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.
536
   // 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.
780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
781
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
781
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
782
 //
782
 //
783
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
783
+//#define X_ENDSTOP_SERVO_NR 1
784
+//#define Y_ENDSTOP_SERVO_NR 2
785
+//#define Z_ENDSTOP_SERVO_NR 0
784
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
786
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
785
 
787
 
786
 // Servo deactivation
788
 // Servo deactivation

+ 14
- 3
Marlin/SanityCheck.h View File

83
   #if NUM_SERVOS > 4
83
   #if NUM_SERVOS > 4
84
     #error The maximum number of SERVOS in Marlin is 4.
84
     #error The maximum number of SERVOS in Marlin is 4.
85
   #endif
85
   #endif
86
+  #if defined(NUM_SERVOS) && NUM_SERVOS > 0
87
+    #if X_ENDSTOP_SERVO_NR >= 0 || Y_ENDSTOP_SERVO_NR >= 0 || Z_ENDSTOP_SERVO_NR >= 0
88
+      #if X_ENDSTOP_SERVO_NR >= NUM_SERVOS
89
+        #error X_ENDSTOP_SERVO_NR must be smaller than NUM_SERVOS.
90
+      #elif Y_ENDSTOP_SERVO_NR >= NUM_SERVOS
91
+        #error Y_ENDSTOP_SERVO_NR must be smaller than NUM_SERVOS.
92
+      #elif Z_ENDSTOP_SERVO_NR >= NUM_SERVOS
93
+        #error Z_ENDSTOP_SERVO_NR must be smaller than NUM_SERVOS.
94
+      #endif
95
+    #endif
96
+  #endif
86
 
97
 
87
   /**
98
   /**
88
    * Servo deactivation depends on servo endstops
99
    * Servo deactivation depends on servo endstops
89
    */
100
    */
90
   #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && !defined(SERVO_ENDSTOPS)
101
   #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && !defined(SERVO_ENDSTOPS)
91
-    #error SERVO_ENDSTOPS is required for DEACTIVATE_SERVOS_AFTER_MOVE.
102
+    #error At least one of the ?_ENDSTOP_SERVO_NR is required for DEACTIVATE_SERVOS_AFTER_MOVE.
92
   #endif
103
   #endif
93
 
104
 
94
   /**
105
   /**
148
 //      #if defined(NUM_SERVOS) && NUM_SERVOS < 1
159
 //      #if defined(NUM_SERVOS) && NUM_SERVOS < 1
149
 //        #error You must have at least 1 servo defined for NUM_SERVOS to use Z_PROBE_ENDSTOP.
160
 //        #error You must have at least 1 servo defined for NUM_SERVOS to use Z_PROBE_ENDSTOP.
150
 //      #endif
161
 //      #endif
151
-//      #ifndef SERVO_ENDSTOPS
152
-//        #error You must have SERVO_ENDSTOPS defined and have the Z index set to at least 0 or above to use Z_PROBE_ENDSTOP.
162
+//      #if Z_ENDSTOP_SERVO_NR < 0
163
+//        #error You must have Z_ENDSTOP_SERVO_NR set to at least 0 or above to use Z_PROBE_ENDSTOP.
153
 //      #endif
164
 //      #endif
154
 //      #ifndef SERVO_ENDSTOP_ANGLES
165
 //      #ifndef SERVO_ENDSTOP_ANGLES
155
 //        #error You must have SERVO_ENDSTOP_ANGLES defined for Z Extend and Retract to use Z_PROBE_ENDSTOP.
166
 //        #error You must have SERVO_ENDSTOP_ANGLES defined for Z Extend and Retract to use Z_PROBE_ENDSTOP.

+ 4
- 2
Marlin/configurator/config/Configuration.h View File

530
   // 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.
530
   // 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.
531
   // 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.
531
   // 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.
532
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
532
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
533
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
533
+  // 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.
534
   // 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
534
   // 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
535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
536
   // 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.
536
   // 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.
780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
781
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
781
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
782
 //
782
 //
783
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
783
+//#define X_ENDSTOP_SERVO_NR 1
784
+//#define Y_ENDSTOP_SERVO_NR 2
785
+//#define Z_ENDSTOP_SERVO_NR 0
784
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
786
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
785
 
787
 
786
 // Servo deactivation
788
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/Felix/Configuration.h View File

512
   // 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.
512
   // 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.
513
   // 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.
513
   // 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.
514
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
514
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
515
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
515
+  // 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.
516
   // 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
516
   // 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
517
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
517
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
518
   // 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.
518
   // 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.
763
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
763
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
764
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
764
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
765
 //
765
 //
766
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
766
+//#define X_ENDSTOP_SERVO_NR 1
767
+//#define Y_ENDSTOP_SERVO_NR 2
768
+//#define Z_ENDSTOP_SERVO_NR 0
767
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
769
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
768
 
770
 
769
 // Servo deactivation
771
 // Servo deactivation

+ 16
- 5
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

449
 
449
 
450
   //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
450
   //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
451
   //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
451
   //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
452
-  // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
453
-
454
-//  #define PROBE_SERVO_DEACTIVATION_DELAY 300
455
 
452
 
456
 
453
 
457
 //If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
454
 //If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
476
   // 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.
473
   // 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.
477
   // 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.
474
   // 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.
478
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
475
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
479
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
476
+  // 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.
480
   // 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
477
   // 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
481
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
478
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
482
   // 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.
479
   // 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.
718
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
715
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
719
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
716
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
720
 //
717
 //
721
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
718
+//#define X_ENDSTOP_SERVO_NR 1
719
+//#define Y_ENDSTOP_SERVO_NR 2
720
+//#define Z_ENDSTOP_SERVO_NR 0
722
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
721
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
723
 
722
 
723
+// Servo deactivation
724
+//
725
+// With this option servos are powered only during movement, then turned off to prevent jitter.
726
+//#define DEACTIVATE_SERVOS_AFTER_MOVE
727
+
728
+#ifdef DEACTIVATE_SERVOS_AFTER_MOVE
729
+  // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
730
+  // 300ms is a good value but you can try less delay.
731
+  // If the servo can't reach the requested position, increase it.
732
+  #define SERVO_DEACTIVATION_DELAY 300
733
+#endif
734
+
724
 /**********************************************************************\
735
 /**********************************************************************\
725
  * Support for a filament diameter sensor
736
  * Support for a filament diameter sensor
726
  * Also allows adjustment of diameter at print time (vs  at slicing)
737
  * Also allows adjustment of diameter at print time (vs  at slicing)

+ 4
- 2
Marlin/example_configurations/Hephestos/Configuration.h View File

522
   // 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.
522
   // 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.
523
   // 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.
523
   // 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.
524
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
524
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
525
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
525
+  // 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.
526
   // 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
526
   // 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
527
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
527
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
528
   // 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.
528
   // 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.
772
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
772
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
773
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
773
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
774
 //
774
 //
775
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
775
+//#define X_ENDSTOP_SERVO_NR 1
776
+//#define Y_ENDSTOP_SERVO_NR 2
777
+//#define Z_ENDSTOP_SERVO_NR 0
776
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
778
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
777
 
779
 
778
 // Servo deactivation
780
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/K8200/Configuration.h View File

518
   // 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.
518
   // 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.
519
   // 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.
519
   // 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.
520
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
520
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
521
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
521
+  // 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.
522
   // 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
522
   // 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
523
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
523
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
524
   // 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.
524
   // 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.
768
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
768
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
769
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
769
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
770
 //
770
 //
771
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
771
+//#define X_ENDSTOP_SERVO_NR 1
772
+//#define Y_ENDSTOP_SERVO_NR 2
773
+//#define Z_ENDSTOP_SERVO_NR 0
772
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
774
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
773
 
775
 
774
 // Servo deactivation
776
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

530
   // 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.
530
   // 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.
531
   // 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.
531
   // 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.
532
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
532
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
533
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
533
+  // 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.
534
   // 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
534
   // 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
535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
536
   // 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.
536
   // 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.
780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
781
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
781
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
782
 //
782
 //
783
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
783
+//#define X_ENDSTOP_SERVO_NR 1
784
+//#define Y_ENDSTOP_SERVO_NR 2
785
+//#define Z_ENDSTOP_SERVO_NR 0
784
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
786
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
785
 
787
 
786
 // Servo deactivation
788
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/RigidBot/Configuration.h View File

510
   // 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.
510
   // 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.
511
   // 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.
511
   // 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.
512
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
512
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
513
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
513
+  // 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.
514
   // 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
514
   // 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
515
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
515
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
516
   // 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.
516
   // 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.
763
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
763
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
764
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
764
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
765
 //
765
 //
766
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
766
+//#define X_ENDSTOP_SERVO_NR 1
767
+//#define Y_ENDSTOP_SERVO_NR 2
768
+//#define Z_ENDSTOP_SERVO_NR 0
767
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
769
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
768
 
770
 
769
 // Servo deactivation
771
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/SCARA/Configuration.h View File

538
   // 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.
538
   // 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.
539
   // 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.
539
   // 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.
540
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
540
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
541
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
541
+  // 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.
542
   // 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
542
   // 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
543
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
543
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
544
   // 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.
544
   // 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.
788
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
788
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
789
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
789
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
790
 //
790
 //
791
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
791
+//#define X_ENDSTOP_SERVO_NR 1
792
+//#define Y_ENDSTOP_SERVO_NR 2
793
+//#define Z_ENDSTOP_SERVO_NR 0
792
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
794
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
793
 
795
 
794
 // Servo deactivation
796
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/WITBOX/Configuration.h View File

522
   // 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.
522
   // 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.
523
   // 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.
523
   // 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.
524
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
524
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
525
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
525
+  // 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.
526
   // 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
526
   // 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
527
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
527
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
528
   // 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.
528
   // 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.
772
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
772
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
773
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
773
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
774
 //
774
 //
775
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
775
+//#define X_ENDSTOP_SERVO_NR 1
776
+//#define Y_ENDSTOP_SERVO_NR 2
777
+//#define Z_ENDSTOP_SERVO_NR 0
776
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
778
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
777
 
779
 
778
 // Servo deactivation
780
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

530
   // 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.
530
   // 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.
531
   // 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.
531
   // 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.
532
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
532
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
533
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
533
+  // 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.
534
   // 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
534
   // 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
535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
536
   // 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.
536
   // 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.
780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
781
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
781
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
782
 //
782
 //
783
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
783
+//#define X_ENDSTOP_SERVO_NR 1
784
+//#define Y_ENDSTOP_SERVO_NR 2
785
+//#define Z_ENDSTOP_SERVO_NR 0
784
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
786
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
785
 
787
 
786
 // Servo deactivation
788
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

650
   // 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.
650
   // 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.
651
   // 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.
651
   // 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.
652
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
652
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
653
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
653
+  // 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.
654
   // 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
654
   // 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
655
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
655
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
656
   // 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.
656
   // 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.
903
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
903
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
904
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
904
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
905
 //
905
 //
906
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
906
+//#define X_ENDSTOP_SERVO_NR 1
907
+//#define Y_ENDSTOP_SERVO_NR 2
908
+//#define Z_ENDSTOP_SERVO_NR 0
907
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
909
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
908
 
910
 
909
 // Servo deactivation
911
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/delta/generic/Configuration.h View File

650
   // 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.
650
   // 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.
651
   // 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.
651
   // 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.
652
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
652
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
653
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
653
+  // 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.
654
   // 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
654
   // 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
655
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
655
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
656
   // 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.
656
   // 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.
907
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
907
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
908
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
908
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
909
 //
909
 //
910
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
910
+//#define X_ENDSTOP_SERVO_NR 1
911
+//#define Y_ENDSTOP_SERVO_NR 2
912
+//#define Z_ENDSTOP_SERVO_NR 0
911
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
913
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
912
 
914
 
913
 // Servo deactivation
915
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

654
   // 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.
654
   // 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.
655
   // 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.
655
   // 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.
656
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
656
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
657
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
657
+  // 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.
658
   // 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
658
   // 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
659
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
659
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
660
   // 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.
660
   // 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.
907
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
907
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
908
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
908
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
909
 //
909
 //
910
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
910
+//#define X_ENDSTOP_SERVO_NR 1
911
+//#define Y_ENDSTOP_SERVO_NR 2
912
+//#define Z_ENDSTOP_SERVO_NR 0
911
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
913
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
912
 
914
 
913
 // Servo deactivation
915
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

639
   // 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.
639
   // 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.
640
   // 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.
640
   // 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.
641
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
641
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
642
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
642
+  // 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.
643
   // 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
643
   // 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
644
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
644
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
645
   // 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.
645
   // 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.
902
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
902
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
903
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
903
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
904
 //
904
 //
905
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
905
+//#define X_ENDSTOP_SERVO_NR 1
906
+//#define Y_ENDSTOP_SERVO_NR 2
907
+//#define Z_ENDSTOP_SERVO_NR 0
906
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
908
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
907
 
909
 
908
 // Servo deactivation
910
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/makibox/Configuration.h View File

533
   // 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.
533
   // 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.
534
   // 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.
534
   // 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.
535
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
535
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
536
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
536
+  // 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.
537
   // 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
537
   // 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
538
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
538
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
539
   // 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.
539
   // 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.
783
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
783
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
784
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
784
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
785
 //
785
 //
786
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
786
+//#define X_ENDSTOP_SERVO_NR 1
787
+//#define Y_ENDSTOP_SERVO_NR 2
788
+//#define Z_ENDSTOP_SERVO_NR 0
787
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
789
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
788
 
790
 
789
 // Servo deactivation
791
 // Servo deactivation

+ 4
- 2
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

520
   // 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.
520
   // 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.
521
   // 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.
521
   // 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.
522
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
522
   // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
523
-  // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
523
+  // 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.
524
   // 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
524
   // 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
525
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
525
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
526
   // 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.
526
   // 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.
774
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
774
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
775
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
775
 // Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500.
776
 //
776
 //
777
-//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
777
+//#define X_ENDSTOP_SERVO_NR 1
778
+//#define Y_ENDSTOP_SERVO_NR 2
779
+//#define Z_ENDSTOP_SERVO_NR 0
778
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
780
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
779
 
781
 
780
 // Servo deactivation
782
 // Servo deactivation

+ 3
- 10
Marlin/servo.cpp View File

304
 
304
 
305
 bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; }
305
 bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; }
306
 
306
 
307
-int8_t Servo::move(int pin, int value) {
308
-  int8_t ret;
309
-  #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && (SERVO_DEACTIVATION_DELAY > 0)
310
-    ret = this->attach(pin);
311
-  #else
312
-    ret = this->servoIndex;
313
-  #endif
314
-  if (ret >= 0) {
307
+void Servo::move(int value) {
308
+  if (this->attach(0) >= 0) {
315
     this->write(value);
309
     this->write(value);
316
-    #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && (SERVO_DEACTIVATION_DELAY > 0)
310
+    #ifdef DEACTIVATE_SERVOS_AFTER_MOVE
317
       delay(SERVO_DEACTIVATION_DELAY);
311
       delay(SERVO_DEACTIVATION_DELAY);
318
       this->detach();
312
       this->detach();
319
     #endif
313
     #endif
320
   }
314
   }
321
-  return ret;
322
 }
315
 }
323
 
316
 
324
 #endif
317
 #endif

+ 8
- 8
Marlin/servo.h View File

37
    write()     - Sets the servo angle in degrees.  (invalid angle that is valid as pulse in microseconds is treated as microseconds)
37
    write()     - Sets the servo angle in degrees.  (invalid angle that is valid as pulse in microseconds is treated as microseconds)
38
    writeMicroseconds() - Sets the servo pulse width in microseconds
38
    writeMicroseconds() - Sets the servo pulse width in microseconds
39
    read()      - Gets the last written servo pulse width as an angle between 0 and 180.
39
    read()      - Gets the last written servo pulse width as an angle between 0 and 180.
40
-   readMicroseconds()   - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
40
+   readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
41
    attached()  - Returns true if there is a servo attached.
41
    attached()  - Returns true if there is a servo attached.
42
    detach()    - Stops an attached servos from pulsing its i/o pin.
42
    detach()    - Stops an attached servos from pulsing its i/o pin.
43
-   move(pin, angel) - Sequence of attach(pin), write(angel),
44
-                      With DEACTIVATE_SERVOS_AFTER_MOVE it waits SERVO_DEACTIVATION_DELAY and detaches.
43
+   move(angle) - Sequence of attach(0), write(angle),
44
+                   With DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DEACTIVATION_DELAY and detach.
45
  */
45
  */
46
 
46
 
47
 #ifndef servo_h
47
 #ifndef servo_h
117
 class Servo {
117
 class Servo {
118
   public:
118
   public:
119
     Servo();
119
     Servo();
120
-    int8_t attach(int pin);           // attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail)
120
+    int8_t attach(int pin);            // attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail)
121
     int8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
121
     int8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
122
     void detach();
122
     void detach();
123
     void write(int value);             // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
123
     void write(int value);             // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
124
-    void writeMicroseconds(int value); // Write pulse width in microseconds
125
-    int8_t move(int pin, int value);  // attach the given pin to the next free channel, set pinMode, return channel number (-1 if attach fails)
126
-                                       // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds.
127
-                                       // if DEACTIVATE_SERVOS_AFTER_MOVE is defined waits SERVO_DEACTIVATION_DELAY, than detaches.
124
+    void writeMicroseconds(int value); // write pulse width in microseconds
125
+    void move(int value);              // attach the servo, then move to value
126
+                                       // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
127
+                                       // if DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DEACTIVATION_DELAY, then detach
128
     int read();                        // returns current pulse width as an angle between 0 and 180 degrees
128
     int read();                        // returns current pulse width as an angle between 0 and 180 degrees
129
     int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
129
     int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
130
     bool attached();                   // return true if this servo is attached, otherwise false
130
     bool attached();                   // return true if this servo is attached, otherwise false

Loading…
Cancel
Save