Преглед на файлове

Add HAS_SERVO_ENDSTOPS to simplify conditonals

Scott Lahteine преди 10 години
родител
ревизия
ed4a6371ad
променени са 3 файла, в които са добавени 16 реда и са изтрити 15 реда
  1. 1
    0
      Marlin/Conditionals.h
  2. 14
    14
      Marlin/Marlin_main.cpp
  3. 1
    1
      Marlin/SanityCheck.h

+ 1
- 0
Marlin/Conditionals.h Целия файл

@@ -526,6 +526,7 @@
526 526
     #endif
527 527
     #if (X_ENDSTOP_SERVO_NR >= 0) || (Y_ENDSTOP_SERVO_NR >= 0) || (Z_ENDSTOP_SERVO_NR >= 0)
528 528
       #define SERVO_ENDSTOPS {X_ENDSTOP_SERVO_NR, Y_ENDSTOP_SERVO_NR, Z_ENDSTOP_SERVO_NR}
529
+      #define HAS_SERVO_ENDSTOPS true
529 530
     #endif
530 531
   #endif
531 532
 

+ 14
- 14
Marlin/Marlin_main.cpp Целия файл

@@ -314,8 +314,8 @@ bool target_direction;
314 314
   };
315 315
 #endif
316 316
 
317
-#ifdef SERVO_ENDSTOPS
318 317
   const int servo_endstops[] = SERVO_ENDSTOPS;
318
+#if HAS_SERVO_ENDSTOPS
319 319
   const int servo_endstop_angles[][2] = SERVO_ENDSTOP_ANGLES;
320 320
 #endif
321 321
 
@@ -578,7 +578,7 @@ void servo_init() {
578 578
   #endif
579 579
 
580 580
   // Set position of Servo Endstops that are defined
581
-  #ifdef SERVO_ENDSTOPS
581
+  #if HAS_SERVO_ENDSTOPS
582 582
     for (int i = 0; i < 3; i++)
583 583
       if (servo_endstops[i] >= 0)
584 584
         servo[servo_endstops[i]].move(servo_endstop_angles[i][1]);
@@ -1322,7 +1322,7 @@ static void setup_for_endstop_move() {
1322 1322
 
1323 1323
   static void deploy_z_probe() {
1324 1324
 
1325
-    #ifdef SERVO_ENDSTOPS
1325
+    #if HAS_SERVO_ENDSTOPS
1326 1326
 
1327 1327
       // Engage Z Servo endstop if enabled
1328 1328
       if (servo_endstops[Z_AXIS] >= 0) servo[servo_endstops[Z_AXIS]].move(servo_endstop_angles[Z_AXIS][0]);
@@ -1412,7 +1412,7 @@ static void setup_for_endstop_move() {
1412 1412
 
1413 1413
   static void stow_z_probe(bool doRaise=true) {
1414 1414
 
1415
-    #ifdef SERVO_ENDSTOPS
1415
+    #if HAS_SERVO_ENDSTOPS
1416 1416
 
1417 1417
       // Retract Z Servo endstop if enabled
1418 1418
       if (servo_endstops[Z_AXIS] >= 0) {
@@ -1676,7 +1676,7 @@ static void homeaxis(AxisEnum axis) {
1676 1676
 
1677 1677
     #endif
1678 1678
 
1679
-    #ifdef SERVO_ENDSTOPS
1679
+    #if HAS_SERVO_ENDSTOPS
1680 1680
       // Engage Servo endstop if enabled
1681 1681
       if (axis != Z_AXIS && servo_endstops[axis] >= 0)
1682 1682
         servo[servo_endstops[axis]].move(servo_endstop_angles[axis][0]);
@@ -1778,7 +1778,7 @@ static void homeaxis(AxisEnum axis) {
1778 1778
     #endif
1779 1779
 
1780 1780
     {
1781
-      #ifdef SERVO_ENDSTOPS
1781
+      #if HAS_SERVO_ENDSTOPS
1782 1782
         // Retract Servo endstop if enabled
1783 1783
         if (servo_endstops[axis] >= 0)
1784 1784
           servo[servo_endstops[axis]].move(servo_endstop_angles[axis][1]);
@@ -2778,7 +2778,7 @@ inline void gcode_G28() {
2778 2778
         //      added here, it could be seen as a compensating factor for the Z probe.
2779 2779
         //
2780 2780
         current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z)
2781
-          #if defined(SERVO_ENDSTOPS) || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
2781
+          #if HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED)
2782 2782
              + Z_RAISE_AFTER_PROBING
2783 2783
           #endif
2784 2784
           ;
@@ -4570,9 +4570,9 @@ inline void gcode_M303() {
4570 4570
  */
4571 4571
 inline void gcode_M400() { st_synchronize(); }
4572 4572
 
4573
-#if defined(ENABLE_AUTO_BED_LEVELING) && !defined(Z_PROBE_SLED) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY))
4573
+#if defined(ENABLE_AUTO_BED_LEVELING) && !defined(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || defined(Z_PROBE_ALLEN_KEY))
4574 4574
 
4575
-  #ifdef SERVO_ENDSTOPS
4575
+  #if HAS_SERVO_ENDSTOPS
4576 4576
     void raise_z_for_servo() {
4577 4577
       float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_HOMING;
4578 4578
       z_dest += axis_known_position[Z_AXIS] ? zprobe_zoffset : zpos;
@@ -4584,7 +4584,7 @@ inline void gcode_M400() { st_synchronize(); }
4584 4584
    * M401: Engage Z Servo endstop if available
4585 4585
    */
4586 4586
   inline void gcode_M401() {
4587
-    #ifdef SERVO_ENDSTOPS
4587
+    #if HAS_SERVO_ENDSTOPS
4588 4588
       raise_z_for_servo();
4589 4589
     #endif
4590 4590
     deploy_z_probe();
@@ -4594,13 +4594,13 @@ inline void gcode_M400() { st_synchronize(); }
4594 4594
    * M402: Retract Z Servo endstop if enabled
4595 4595
    */
4596 4596
   inline void gcode_M402() {
4597
-    #ifdef SERVO_ENDSTOPS
4597
+    #if HAS_SERVO_ENDSTOPS
4598 4598
       raise_z_for_servo();
4599 4599
     #endif
4600 4600
     stow_z_probe(false);
4601 4601
   }
4602 4602
 
4603
-#endif // ENABLE_AUTO_BED_LEVELING && (SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
4603
+#endif // ENABLE_AUTO_BED_LEVELING && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
4604 4604
 
4605 4605
 #ifdef FILAMENT_SENSOR
4606 4606
 
@@ -5645,14 +5645,14 @@ void process_next_command() {
5645 5645
         gcode_M400();
5646 5646
         break;
5647 5647
 
5648
-      #if defined(ENABLE_AUTO_BED_LEVELING) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY)) && !defined(Z_PROBE_SLED)
5648
+      #if defined(ENABLE_AUTO_BED_LEVELING) && (HAS_SERVO_ENDSTOPS || defined(Z_PROBE_ALLEN_KEY)) && !defined(Z_PROBE_SLED)
5649 5649
         case 401:
5650 5650
           gcode_M401();
5651 5651
           break;
5652 5652
         case 402:
5653 5653
           gcode_M402();
5654 5654
           break;
5655
-      #endif // ENABLE_AUTO_BED_LEVELING && (SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
5655
+      #endif // ENABLE_AUTO_BED_LEVELING && (HAS_SERVO_ENDSTOPS || Z_PROBE_ALLEN_KEY) && !Z_PROBE_SLED
5656 5656
 
5657 5657
       #ifdef FILAMENT_SENSOR
5658 5658
         case 404:  //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width

+ 1
- 1
Marlin/SanityCheck.h Целия файл

@@ -98,7 +98,7 @@
98 98
   /**
99 99
    * Servo deactivation depends on servo endstops
100 100
    */
101
-  #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && !defined(SERVO_ENDSTOPS)
101
+  #if defined(DEACTIVATE_SERVOS_AFTER_MOVE) && !HAS_SERVO_ENDSTOPS
102 102
     #error At least one of the ?_ENDSTOP_SERVO_NR is required for DEACTIVATE_SERVOS_AFTER_MOVE.
103 103
   #endif
104 104
 

Loading…
Отказ
Запис