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 8 years ago
parent
commit
8b876241bd

+ 16
- 0
Marlin/Conditionals.h View File

@@ -511,5 +511,21 @@
511 511
 
512 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 530
 #endif //CONFIGURATION_LCD
515 531
 #endif //CONDITIONALS_H

+ 4
- 2
Marlin/Configuration.h View File

@@ -530,7 +530,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
530 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 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 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 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 535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
536 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,7 +780,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
780 780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
781 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 786
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
785 787
 
786 788
 // Servo deactivation

+ 14
- 3
Marlin/SanityCheck.h View File

@@ -83,12 +83,23 @@
83 83
   #if NUM_SERVOS > 4
84 84
     #error The maximum number of SERVOS in Marlin is 4.
85 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 99
    * Servo deactivation depends on servo endstops
89 100
    */
90 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 103
   #endif
93 104
 
94 105
   /**
@@ -148,8 +159,8 @@
148 159
 //      #if defined(NUM_SERVOS) && NUM_SERVOS < 1
149 160
 //        #error You must have at least 1 servo defined for NUM_SERVOS to use Z_PROBE_ENDSTOP.
150 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 164
 //      #endif
154 165
 //      #ifndef SERVO_ENDSTOP_ANGLES
155 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,7 +530,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
530 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 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 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 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 535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
536 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,7 +780,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
780 780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
781 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 786
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
785 787
 
786 788
 // Servo deactivation

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

@@ -512,7 +512,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
512 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 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 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 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 517
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
518 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,7 +763,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
763 763
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
764 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 769
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
768 770
 
769 771
 // Servo deactivation

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

@@ -449,9 +449,6 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
449 449
 
450 450
   //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
451 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 454
 //If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
@@ -476,7 +473,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
476 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 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 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 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 478
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
482 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,9 +715,23 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
718 715
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
719 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 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 736
  * Support for a filament diameter sensor
726 737
  * Also allows adjustment of diameter at print time (vs  at slicing)

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

@@ -522,7 +522,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
522 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 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 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 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 527
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
528 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,7 +772,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
772 772
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
773 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 778
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
777 779
 
778 780
 // Servo deactivation

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

@@ -518,7 +518,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
518 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 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 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 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 523
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
524 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,7 +768,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
768 768
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
769 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 774
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
773 775
 
774 776
 // Servo deactivation

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

@@ -530,7 +530,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
530 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 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 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 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 535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
536 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,7 +780,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
780 780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
781 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 786
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
785 787
 
786 788
 // Servo deactivation

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

@@ -510,7 +510,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
510 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 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 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 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 515
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
516 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,7 +763,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
763 763
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
764 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 769
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
768 770
 
769 771
 // Servo deactivation

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

@@ -538,7 +538,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
538 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 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 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 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 543
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
544 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,7 +788,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
788 788
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
789 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 794
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
793 795
 
794 796
 // Servo deactivation

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

@@ -522,7 +522,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
522 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 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 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 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 527
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
528 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,7 +772,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
772 772
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
773 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 778
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
777 779
 
778 780
 // Servo deactivation

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

@@ -530,7 +530,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
530 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 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 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 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 535
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
536 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,7 +780,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
780 780
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
781 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 786
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
785 787
 
786 788
 // Servo deactivation

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

@@ -650,7 +650,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
650 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 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 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 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 655
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
656 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,7 +903,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
903 903
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
904 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 909
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
908 910
 
909 911
 // Servo deactivation

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

@@ -650,7 +650,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
650 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 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 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 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 655
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
656 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,7 +907,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
907 907
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
908 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 913
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
912 914
 
913 915
 // Servo deactivation

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

@@ -654,7 +654,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
654 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 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 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 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 659
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
660 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,7 +907,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
907 907
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
908 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 913
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
912 914
 
913 915
 // Servo deactivation

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

@@ -639,7 +639,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
639 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 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 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 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 644
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
645 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,7 +902,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
902 902
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
903 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 908
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
907 909
 
908 910
 // Servo deactivation

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

@@ -533,7 +533,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
533 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 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 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 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 538
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
539 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,7 +783,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
783 783
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
784 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 789
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
788 790
 
789 791
 // Servo deactivation

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

@@ -520,7 +520,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
520 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 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 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 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 525
   // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
526 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,7 +774,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic
774 774
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
775 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 780
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
779 781
 
780 782
 // Servo deactivation

+ 3
- 10
Marlin/servo.cpp View File

@@ -304,21 +304,14 @@ int Servo::readMicroseconds() {
304 304
 
305 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 309
     this->write(value);
316
-    #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && (SERVO_DEACTIVATION_DELAY > 0)
310
+    #ifdef DEACTIVATE_SERVOS_AFTER_MOVE
317 311
       delay(SERVO_DEACTIVATION_DELAY);
318 312
       this->detach();
319 313
     #endif
320 314
   }
321
-  return ret;
322 315
 }
323 316
 
324 317
 #endif

+ 8
- 8
Marlin/servo.h View File

@@ -37,11 +37,11 @@
37 37
    write()     - Sets the servo angle in degrees.  (invalid angle that is valid as pulse in microseconds is treated as microseconds)
38 38
    writeMicroseconds() - Sets the servo pulse width in microseconds
39 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 41
    attached()  - Returns true if there is a servo attached.
42 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 47
 #ifndef servo_h
@@ -117,14 +117,14 @@ typedef struct {
117 117
 class Servo {
118 118
   public:
119 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 121
     int8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
122 122
     void detach();
123 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 128
     int read();                        // returns current pulse width as an angle between 0 and 180 degrees
129 129
     int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
130 130
     bool attached();                   // return true if this servo is attached, otherwise false

Loading…
Cancel
Save