Quellcode durchsuchen

Overridable Options - Part 8 (PR#2560)

Apply `ENABLED` / `DISABLED` macros to stepper-related files.
Scott Lahteine vor 9 Jahren
Ursprung
Commit
c35fb88094
4 geänderte Dateien mit 149 neuen und 149 gelöschten Zeilen
  1. 47
    47
      Marlin/stepper.cpp
  2. 4
    4
      Marlin/stepper.h
  3. 76
    76
      Marlin/stepper_indirection.cpp
  4. 22
    22
      Marlin/stepper_indirection.h

+ 47
- 47
Marlin/stepper.cpp Datei anzeigen

@@ -49,7 +49,7 @@ block_t *current_block;  // A pointer to the block currently being traced
49 49
 static unsigned char out_bits = 0;        // The next stepping-bits to be output
50 50
 static unsigned int cleaning_buffer_counter;
51 51
 
52
-#ifdef Z_DUAL_ENDSTOPS
52
+#if ENABLED(Z_DUAL_ENDSTOPS)
53 53
   static bool performing_homing = false, 
54 54
               locked_z_motor = false, 
55 55
               locked_z2_motor = false;
@@ -59,7 +59,7 @@ static unsigned int cleaning_buffer_counter;
59 59
 static long counter_x, counter_y, counter_z, counter_e;
60 60
 volatile static unsigned long step_events_completed; // The number of step events executed in the current block
61 61
 
62
-#ifdef ADVANCE
62
+#if ENABLED(ADVANCE)
63 63
   static long advance_rate, advance, final_advance = 0;
64 64
   static long old_advance = 0;
65 65
   static long e_steps[4];
@@ -76,18 +76,18 @@ volatile long endstops_trigsteps[3] = { 0 };
76 76
 volatile long endstops_stepsTotal, endstops_stepsDone;
77 77
 static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value
78 78
 
79
-#ifndef Z_DUAL_ENDSTOPS
79
+#if DISABLED(Z_DUAL_ENDSTOPS)
80 80
   static byte
81 81
 #else
82 82
   static uint16_t
83 83
 #endif
84 84
   old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
85 85
 
86
-#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
86
+#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
87 87
   bool abort_on_endstop_hit = false;
88 88
 #endif
89 89
 
90
-#ifdef MOTOR_CURRENT_PWM_XY_PIN
90
+#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
91 91
   int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT;
92 92
 #endif
93 93
 
@@ -101,7 +101,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
101 101
 //================================ functions ================================
102 102
 //===========================================================================
103 103
 
104
-#ifdef DUAL_X_CARRIAGE
104
+#if ENABLED(DUAL_X_CARRIAGE)
105 105
   #define X_APPLY_DIR(v,ALWAYS) \
106 106
     if (extruder_duplication_enabled || ALWAYS) { \
107 107
       X_DIR_WRITE(v); \
@@ -123,7 +123,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
123 123
   #define X_APPLY_STEP(v,Q) X_STEP_WRITE(v)
124 124
 #endif
125 125
 
126
-#ifdef Y_DUAL_STEPPER_DRIVERS
126
+#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
127 127
   #define Y_APPLY_DIR(v,Q) { Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); }
128 128
   #define Y_APPLY_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); }
129 129
 #else
@@ -131,9 +131,9 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
131 131
   #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v)
132 132
 #endif
133 133
 
134
-#ifdef Z_DUAL_STEPPER_DRIVERS
134
+#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
135 135
   #define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }
136
-  #ifdef Z_DUAL_ENDSTOPS
136
+  #if ENABLED(Z_DUAL_ENDSTOPS)
137 137
     #define Z_APPLY_STEP(v,Q) \
138 138
     if (performing_homing) { \
139 139
       if (Z_HOME_DIR > 0) {\
@@ -263,17 +263,17 @@ void checkHitEndstops() {
263 263
       SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
264 264
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
265 265
     }
266
-    #ifdef Z_PROBE_ENDSTOP
267
-    if (endstop_hit_bits & BIT(Z_PROBE)) {
268
-      SERIAL_ECHOPAIR(" Z_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
269
-      LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
270
-    }
266
+    #if ENABLED(Z_PROBE_ENDSTOP)
267
+      if (endstop_hit_bits & BIT(Z_PROBE)) {
268
+        SERIAL_ECHOPAIR(" Z_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
269
+        LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
270
+      }
271 271
     #endif
272 272
     SERIAL_EOL;
273 273
 
274 274
     endstops_hit_on_purpose();
275 275
 
276
-    #if defined(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && defined(SDSUPPORT)
276
+    #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT)
277 277
       if (abort_on_endstop_hit) {
278 278
         card.sdprinting = false;
279 279
         card.closefile();
@@ -556,7 +556,7 @@ void set_stepper_direction() {
556 556
     count_direction[Z_AXIS] = 1;
557 557
   }
558 558
   
559
-  #ifndef ADVANCE
559
+  #if DISABLED(ADVANCE)
560 560
     if (TEST(out_bits, E_AXIS)) {
561 561
       REV_E_DIR();
562 562
       count_direction[E_AXIS] = -1;
@@ -577,7 +577,7 @@ FORCE_INLINE void trapezoid_generator_reset() {
577 577
     set_stepper_direction();
578 578
   }
579 579
   
580
-  #ifdef ADVANCE
580
+  #if ENABLED(ADVANCE)
581 581
     advance = current_block->initial_advance;
582 582
     final_advance = current_block->final_advance;
583 583
     // Do E steps + advance steps
@@ -630,7 +630,7 @@ ISR(TIMER1_COMPA_vect) {
630 630
       counter_y = counter_z = counter_e = counter_x;
631 631
       step_events_completed = 0;
632 632
 
633
-      #ifdef Z_LATE_ENABLE
633
+      #if ENABLED(Z_LATE_ENABLE)
634 634
         if (current_block->steps[Z_AXIS] > 0) {
635 635
           enable_z();
636 636
           OCR1A = 2000; //1ms wait
@@ -638,7 +638,7 @@ ISR(TIMER1_COMPA_vect) {
638 638
         }
639 639
       #endif
640 640
 
641
-      // #ifdef ADVANCE
641
+      // #if ENABLED(ADVANCE)
642 642
       //   e_steps[current_block->active_extruder] = 0;
643 643
       // #endif
644 644
     }
@@ -658,7 +658,7 @@ ISR(TIMER1_COMPA_vect) {
658 658
         MSerial.checkRx(); // Check for serial chars.
659 659
       #endif
660 660
 
661
-      #ifdef ADVANCE
661
+      #if ENABLED(ADVANCE)
662 662
         counter_e += current_block->steps[E_AXIS];
663 663
         if (counter_e > 0) {
664 664
           counter_e -= current_block->step_event_count;
@@ -677,7 +677,7 @@ ISR(TIMER1_COMPA_vect) {
677 677
       STEP_ADD(x,X);
678 678
       STEP_ADD(y,Y);
679 679
       STEP_ADD(z,Z);
680
-      #ifndef ADVANCE
680
+      #if DISABLED(ADVANCE)
681 681
         STEP_ADD(e,E);
682 682
       #endif
683 683
 
@@ -691,7 +691,7 @@ ISR(TIMER1_COMPA_vect) {
691 691
       STEP_IF_COUNTER(x, X);
692 692
       STEP_IF_COUNTER(y, Y);
693 693
       STEP_IF_COUNTER(z, Z);
694
-      #ifndef ADVANCE
694
+      #if DISABLED(ADVANCE)
695 695
         STEP_IF_COUNTER(e, E);
696 696
       #endif
697 697
 
@@ -714,7 +714,7 @@ ISR(TIMER1_COMPA_vect) {
714 714
       timer = calc_timer(acc_step_rate);
715 715
       OCR1A = timer;
716 716
       acceleration_time += timer;
717
-      #ifdef ADVANCE
717
+      #if ENABLED(ADVANCE)
718 718
         for(int8_t i=0; i < step_loops; i++) {
719 719
           advance += advance_rate;
720 720
         }
@@ -743,7 +743,7 @@ ISR(TIMER1_COMPA_vect) {
743 743
       timer = calc_timer(step_rate);
744 744
       OCR1A = timer;
745 745
       deceleration_time += timer;
746
-      #ifdef ADVANCE
746
+      #if ENABLED(ADVANCE)
747 747
         for(int8_t i=0; i < step_loops; i++) {
748 748
           advance -= advance_rate;
749 749
         }
@@ -767,7 +767,7 @@ ISR(TIMER1_COMPA_vect) {
767 767
   }
768 768
 }
769 769
 
770
-#ifdef ADVANCE
770
+#if ENABLED(ADVANCE)
771 771
   unsigned char old_OCR0A;
772 772
   // Timer interrupt for E. e_steps is set in the main routine;
773 773
   // Timer 0 is shared with millies
@@ -845,11 +845,11 @@ void st_init() {
845 845
   microstep_init(); //Initialize Microstepping Pins
846 846
 
847 847
   // initialise TMC Steppers
848
-  #ifdef HAVE_TMCDRIVER
848
+  #if ENABLED(HAVE_TMCDRIVER)
849 849
     tmc_init();
850 850
   #endif
851 851
     // initialise L6470 Steppers
852
-  #ifdef HAVE_L6470DRIVER
852
+  #if ENABLED(HAVE_L6470DRIVER)
853 853
     L6470_init();
854 854
   #endif
855 855
 
@@ -862,13 +862,13 @@ void st_init() {
862 862
   #endif
863 863
   #if HAS_Y_DIR
864 864
     Y_DIR_INIT;
865
-    #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
865
+    #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
866 866
       Y2_DIR_INIT;
867 867
     #endif
868 868
   #endif
869 869
   #if HAS_Z_DIR
870 870
     Z_DIR_INIT;
871
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR
871
+    #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR
872 872
       Z2_DIR_INIT;
873 873
     #endif
874 874
   #endif
@@ -899,7 +899,7 @@ void st_init() {
899 899
     Y_ENABLE_INIT;
900 900
     if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
901 901
 
902
-  #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
902
+  #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
903 903
     Y2_ENABLE_INIT;
904 904
     if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
905 905
   #endif
@@ -908,7 +908,7 @@ void st_init() {
908 908
     Z_ENABLE_INIT;
909 909
     if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH);
910 910
 
911
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE
911
+    #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE
912 912
       Z2_ENABLE_INIT;
913 913
       if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
914 914
     #endif
@@ -934,56 +934,56 @@ void st_init() {
934 934
 
935 935
   #if HAS_X_MIN
936 936
     SET_INPUT(X_MIN_PIN);
937
-    #ifdef ENDSTOPPULLUP_XMIN
937
+    #if ENABLED(ENDSTOPPULLUP_XMIN)
938 938
       WRITE(X_MIN_PIN,HIGH);
939 939
     #endif
940 940
   #endif
941 941
 
942 942
   #if HAS_Y_MIN
943 943
     SET_INPUT(Y_MIN_PIN);
944
-    #ifdef ENDSTOPPULLUP_YMIN
944
+    #if ENABLED(ENDSTOPPULLUP_YMIN)
945 945
       WRITE(Y_MIN_PIN,HIGH);
946 946
     #endif
947 947
   #endif
948 948
 
949 949
   #if HAS_Z_MIN
950 950
     SET_INPUT(Z_MIN_PIN);
951
-    #ifdef ENDSTOPPULLUP_ZMIN
951
+    #if ENABLED(ENDSTOPPULLUP_ZMIN)
952 952
       WRITE(Z_MIN_PIN,HIGH);
953 953
     #endif
954 954
   #endif
955 955
 
956 956
   #if HAS_X_MAX
957 957
     SET_INPUT(X_MAX_PIN);
958
-    #ifdef ENDSTOPPULLUP_XMAX
958
+    #if ENABLED(ENDSTOPPULLUP_XMAX)
959 959
       WRITE(X_MAX_PIN,HIGH);
960 960
     #endif
961 961
   #endif
962 962
 
963 963
   #if HAS_Y_MAX
964 964
     SET_INPUT(Y_MAX_PIN);
965
-    #ifdef ENDSTOPPULLUP_YMAX
965
+    #if ENABLED(ENDSTOPPULLUP_YMAX)
966 966
       WRITE(Y_MAX_PIN,HIGH);
967 967
     #endif
968 968
   #endif
969 969
 
970 970
   #if HAS_Z_MAX
971 971
     SET_INPUT(Z_MAX_PIN);
972
-    #ifdef ENDSTOPPULLUP_ZMAX
972
+    #if ENABLED(ENDSTOPPULLUP_ZMAX)
973 973
       WRITE(Z_MAX_PIN,HIGH);
974 974
     #endif
975 975
   #endif
976 976
 
977 977
   #if HAS_Z2_MAX
978 978
     SET_INPUT(Z2_MAX_PIN);
979
-    #ifdef ENDSTOPPULLUP_ZMAX
979
+    #if ENABLED(ENDSTOPPULLUP_ZMAX)
980 980
       WRITE(Z2_MAX_PIN,HIGH);
981 981
     #endif
982 982
   #endif
983 983
 
984
-  #if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
984
+  #if HAS_Z_PROBE && ENABLED(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
985 985
     SET_INPUT(Z_PROBE_PIN);
986
-    #ifdef ENDSTOPPULLUP_ZPROBE
986
+    #if ENABLED(ENDSTOPPULLUP_ZPROBE)
987 987
       WRITE(Z_PROBE_PIN,HIGH);
988 988
     #endif
989 989
   #endif
@@ -1007,14 +1007,14 @@ void st_init() {
1007 1007
     AXIS_INIT(x, X2, X);
1008 1008
   #endif
1009 1009
   #if HAS_Y_STEP
1010
-    #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP
1010
+    #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP
1011 1011
       Y2_STEP_INIT;
1012 1012
       Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
1013 1013
     #endif
1014 1014
     AXIS_INIT(y, Y, Y);
1015 1015
   #endif
1016 1016
   #if HAS_Z_STEP
1017
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP
1017
+    #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP
1018 1018
       Z2_STEP_INIT;
1019 1019
       Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
1020 1020
     #endif
@@ -1054,7 +1054,7 @@ void st_init() {
1054 1054
   TCNT1 = 0;
1055 1055
   ENABLE_STEPPER_DRIVER_INTERRUPT();
1056 1056
 
1057
-  #ifdef ADVANCE
1057
+  #if ENABLED(ADVANCE)
1058 1058
     #if defined(TCCR0A) && defined(WGM01)
1059 1059
       TCCR0A &= ~BIT(WGM01);
1060 1060
       TCCR0A &= ~BIT(WGM00);
@@ -1113,7 +1113,7 @@ void quickStop() {
1113 1113
   ENABLE_STEPPER_DRIVER_INTERRUPT();
1114 1114
 }
1115 1115
 
1116
-#ifdef BABYSTEPPING
1116
+#if ENABLED(BABYSTEPPING)
1117 1117
 
1118 1118
   // MUST ONLY BE CALLED BY AN ISR,
1119 1119
   // No other ISR should ever interrupt this!
@@ -1146,7 +1146,7 @@ void quickStop() {
1146 1146
  
1147 1147
       case Z_AXIS: {
1148 1148
 
1149
-        #ifndef DELTA
1149
+        #if DISABLED(DELTA)
1150 1150
 
1151 1151
           BABYSTEP_AXIS(z, Z, BABYSTEP_INVERT_Z);
1152 1152
 
@@ -1272,7 +1272,7 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) {
1272 1272
     case 1: digitalWrite(Y_MS2_PIN, ms2); break;
1273 1273
     case 2: digitalWrite(Z_MS2_PIN, ms2); break;
1274 1274
     case 3: digitalWrite(E0_MS2_PIN, ms2); break;
1275
-    #if defined(E1_MS2_PIN) && E1_MS2_PIN >= 0
1275
+    #if PIN_EXISTS(E1_MS2)
1276 1276
       case 4: digitalWrite(E1_MS2_PIN, ms2); break;
1277 1277
     #endif
1278 1278
   }
@@ -1309,7 +1309,7 @@ void microstep_readings() {
1309 1309
   #endif
1310 1310
 }
1311 1311
 
1312
-#ifdef Z_DUAL_ENDSTOPS
1312
+#if ENABLED(Z_DUAL_ENDSTOPS)
1313 1313
   void In_Homing_Process(bool state) { performing_homing = state; }
1314 1314
   void Lock_z_motor(bool state) { locked_z_motor = state; }
1315 1315
   void Lock_z2_motor(bool state) { locked_z2_motor = state; }

+ 4
- 4
Marlin/stepper.h Datei anzeigen

@@ -33,7 +33,7 @@
33 33
   #define NORM_E_DIR() { if(current_block->active_extruder == 2) { E2_DIR_WRITE(!INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}}
34 34
   #define REV_E_DIR() { if(current_block->active_extruder == 2) { E2_DIR_WRITE(INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}}
35 35
 #elif EXTRUDERS > 1
36
-  #ifndef DUAL_X_CARRIAGE
36
+  #if DISABLED(DUAL_X_CARRIAGE)
37 37
     #define E_STEP_WRITE(v) { if(current_block->active_extruder == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
38 38
     #define NORM_E_DIR() { if(current_block->active_extruder == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
39 39
     #define REV_E_DIR() { if(current_block->active_extruder == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}
@@ -49,7 +49,7 @@
49 49
   #define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
50 50
 #endif
51 51
 
52
-#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
52
+#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
53 53
   extern bool abort_on_endstop_hit;
54 54
 #endif
55 55
 
@@ -95,13 +95,13 @@ void digipot_current(uint8_t driver, int current);
95 95
 void microstep_init();
96 96
 void microstep_readings();
97 97
 
98
-#ifdef Z_DUAL_ENDSTOPS
98
+#if ENABLED(Z_DUAL_ENDSTOPS)
99 99
   void In_Homing_Process(bool state);
100 100
   void Lock_z_motor(bool state);
101 101
   void Lock_z2_motor(bool state);
102 102
 #endif
103 103
 
104
-#ifdef BABYSTEPPING
104
+#if ENABLED(BABYSTEPPING)
105 105
   void babystep(const uint8_t axis,const bool direction); // perform a short step with a single stepper motor, outside of any convention
106 106
 #endif
107 107
      

+ 76
- 76
Marlin/stepper_indirection.cpp Datei anzeigen

@@ -22,203 +22,203 @@
22 22
 #include "stepper_indirection.h"
23 23
 #include "Configuration.h"
24 24
 
25
-#ifdef HAVE_TMCDRIVER
26
-#include <SPI.h>
27
-#include <TMC26XStepper.h>
25
+#if ENABLED(HAVE_TMCDRIVER)
26
+  #include <SPI.h>
27
+  #include <TMC26XStepper.h>
28 28
 #endif
29 29
 
30 30
 // Stepper objects of TMC steppers used
31
-#ifdef X_IS_TMC
31
+#if ENABLED(X_IS_TMC)
32 32
 	TMC26XStepper stepperX(200,X_ENABLE_PIN,X_STEP_PIN,X_DIR_PIN,X_MAX_CURRENT,X_SENSE_RESISTOR);
33 33
 #endif
34
-#ifdef X2_IS_TMC
34
+#if ENABLED(X2_IS_TMC)
35 35
 	TMC26XStepper stepperX2(200,X2_ENABLE_PIN,X2_STEP_PIN,X2_DIR_PIN,X2_MAX_CURRENT,X2_SENSE_RESISTOR);
36 36
 #endif
37
-#ifdef Y_IS_TMC
37
+#if ENABLED(Y_IS_TMC)
38 38
 	TMC26XStepper stepperY(200,Y_ENABLE_PIN,Y_STEP_PIN,Y_DIR_PIN,Y_MAX_CURRENT,Y_SENSE_RESISTOR);
39 39
 #endif
40
-#ifdef Y2_IS_TMC
40
+#if ENABLED(Y2_IS_TMC)
41 41
 	TMC26XStepper stepperY2(200,Y2_ENABLE_PIN,Y2_STEP_PIN,Y2_DIR_PIN,Y2_MAX_CURRENT,Y2_SENSE_RESISTOR);
42 42
 #endif
43
-#ifdef Z_IS_TMC
43
+#if ENABLED(Z_IS_TMC)
44 44
 	TMC26XStepper stepperZ(200,Z_ENABLE_PIN,Z_STEP_PIN,Z_DIR_PIN,Z_MAX_CURRENT,Z_SENSE_RESISTOR);
45 45
 #endif
46
-#ifdef Z2_IS_TMC
46
+#if ENABLED(Z2_IS_TMC)
47 47
 	TMC26XStepper stepperZ2(200,Z2_ENABLE_PIN,Z2_STEP_PIN,Z2_DIR_PIN,Z2_MAX_CURRENT,Z2_SENSE_RESISTOR);
48 48
 #endif
49
-#ifdef E0_IS_TMC
49
+#if ENABLED(E0_IS_TMC)
50 50
 	TMC26XStepper stepperE0(200,E0_ENABLE_PIN,E0_STEP_PIN,E0_DIR_PIN,E0_MAX_CURRENT,E0_SENSE_RESISTOR);
51 51
 #endif
52
-#ifdef E1_IS_TMC
52
+#if ENABLED(E1_IS_TMC)
53 53
 	TMC26XStepper stepperE1(200,E1_ENABLE_PIN,E1_STEP_PIN,E1_DIR_PIN,E1_MAX_CURRENT,E1_SENSE_RESISTOR);
54 54
 #endif
55
-#ifdef E2_IS_TMC
55
+#if ENABLED(E2_IS_TMC)
56 56
 	TMC26XStepper stepperE2(200,E2_ENABLE_PIN,E2_STEP_PIN,E2_DIR_PIN,E2_MAX_CURRENT,E2_SENSE_RESISTOR);
57 57
 #endif
58
-#ifdef E3_IS_TMC
58
+#if ENABLED(E3_IS_TMC)
59 59
 	TMC26XStepper stepperE3(200,E3_ENABLE_PIN,E3_STEP_PIN,E3_DIR_PIN,E3_MAX_CURRENT,E3_SENSE_RESISTOR);
60 60
 #endif	
61 61
 
62
-#ifdef HAVE_TMCDRIVER
62
+#if ENABLED(HAVE_TMCDRIVER)
63 63
 void tmc_init()
64 64
 {
65
-#ifdef X_IS_TMC
65
+  #if ENABLED(X_IS_TMC)
66 66
 	stepperX.setMicrosteps(X_MICROSTEPS);
67 67
 	stepperX.start();
68
-#endif
69
-#ifdef X2_IS_TMC
68
+  #endif
69
+  #if ENABLED(X2_IS_TMC)
70 70
 	stepperX2.setMicrosteps(X2_MICROSTEPS);
71 71
 	stepperX2.start();
72
-#endif
73
-#ifdef Y_IS_TMC
72
+  #endif
73
+  #if ENABLED(Y_IS_TMC)
74 74
 	stepperY.setMicrosteps(Y_MICROSTEPS);
75 75
 	stepperY.start();
76
-#endif
77
-#ifdef Y2_IS_TMC
76
+  #endif
77
+  #if ENABLED(Y2_IS_TMC)
78 78
 	stepperY2.setMicrosteps(Y2_MICROSTEPS);
79 79
 	stepperY2.start();
80
-#endif
81
-#ifdef Z_IS_TMC
80
+  #endif
81
+  #if ENABLED(Z_IS_TMC)
82 82
 	stepperZ.setMicrosteps(Z_MICROSTEPS);
83 83
 	stepperZ.start();
84
-#endif
85
-#ifdef Z2_IS_TMC
84
+  #endif
85
+  #if ENABLED(Z2_IS_TMC)
86 86
 	stepperZ2.setMicrosteps(Z2_MICROSTEPS);
87 87
 	stepperZ2.start();
88
-#endif
89
-#ifdef E0_IS_TMC
88
+  #endif
89
+  #if ENABLED(E0_IS_TMC)
90 90
 	stepperE0.setMicrosteps(E0_MICROSTEPS);
91 91
 	stepperE0.start();
92
-#endif
93
-#ifdef E1_IS_TMC
92
+  #endif
93
+  #if ENABLED(E1_IS_TMC)
94 94
 	stepperE1.setMicrosteps(E1_MICROSTEPS);
95 95
 	stepperE1.start();
96
-#endif
97
-#ifdef E2_IS_TMC
96
+  #endif
97
+  #if ENABLED(E2_IS_TMC)
98 98
 	stepperE2.setMicrosteps(E2_MICROSTEPS);
99 99
 	stepperE2.start();
100
-#endif
101
-#ifdef E3_IS_TMC
100
+  #endif
101
+  #if ENABLED(E3_IS_TMC)
102 102
 	stepperE3.setMicrosteps(E3_MICROSTEPS);
103 103
 	stepperE3.start();
104
-#endif
104
+  #endif
105 105
 }
106 106
 #endif
107 107
 
108 108
 // L6470 Driver objects and inits
109 109
 
110
-#ifdef HAVE_L6470DRIVER
110
+#if ENABLED(HAVE_L6470DRIVER)
111 111
 #include <SPI.h>
112 112
 #include <L6470.h>
113 113
 #endif
114 114
 
115 115
 // L6470 Stepper objects
116
-#ifdef X_IS_L6470
116
+  #if ENABLED(X_IS_L6470)
117 117
 	L6470 stepperX(X_ENABLE_PIN);
118
-#endif
119
-#ifdef X2_IS_L6470
118
+  #endif
119
+  #if ENABLED(X2_IS_L6470)
120 120
 	L6470 stepperX2(X2_ENABLE_PIN);
121
-#endif
122
-#ifdef Y_IS_L6470
121
+  #endif
122
+  #if ENABLED(Y_IS_L6470)
123 123
 	L6470 stepperY(Y_ENABLE_PIN);
124
-#endif
125
-#ifdef Y2_IS_L6470
124
+  #endif
125
+  #if ENABLED(Y2_IS_L6470)
126 126
 	L6470 stepperY2(Y2_ENABLE_PIN);
127
-#endif
128
-#ifdef Z_IS_L6470
127
+  #endif
128
+  #if ENABLED(Z_IS_L6470)
129 129
 	L6470 stepperZ(Z_ENABLE_PIN);
130
-#endif
131
-#ifdef Z2_IS_L6470
130
+  #endif
131
+  #if ENABLED(Z2_IS_L6470)
132 132
 	L6470 stepperZ2(Z2_ENABLE_PIN);
133
-#endif
134
-#ifdef E0_IS_L6470
133
+  #endif
134
+  #if ENABLED(E0_IS_L6470)
135 135
 	L6470 stepperE0(E0_ENABLE_PIN);
136
-#endif
137
-#ifdef E1_IS_L6470
136
+  #endif
137
+  #if ENABLED(E1_IS_L6470)
138 138
 	L6470 stepperE1(E1_ENABLE_PIN);
139
-#endif
140
-#ifdef E2_IS_L6470
139
+  #endif
140
+  #if ENABLED(E2_IS_L6470)
141 141
 	L6470 stepperE2(E2_ENABLE_PIN);
142
-#endif
143
-#ifdef E3_IS_L6470
142
+  #endif
143
+  #if ENABLED(E3_IS_L6470)
144 144
 	L6470 stepperE3(E3_ENABLE_PIN);
145
-#endif	
145
+  #endif	
146 146
 
147 147
 
148 148
 // init routine
149
-#ifdef HAVE_L6470DRIVER
149
+#if ENABLED(HAVE_L6470DRIVER)
150 150
 void L6470_init()
151 151
 {
152
-#ifdef X_IS_L6470
152
+  #if ENABLED(X_IS_L6470)
153 153
 	stepperX.init(X_K_VAL);
154 154
 	stepperX.softFree();
155 155
 	stepperX.setMicroSteps(X_MICROSTEPS);
156 156
     stepperX.setOverCurrent(X_OVERCURRENT); //set overcurrent protection
157 157
     stepperX.setStallCurrent(X_STALLCURRENT);
158
-#endif
159
-#ifdef X2_IS_L6470
158
+  #endif
159
+  #if ENABLED(X2_IS_L6470)
160 160
 	stepperX2.init(X2_K_VAL);
161 161
 	stepperX2.softFree();
162 162
 	stepperX2.setMicroSteps(X2_MICROSTEPS);
163 163
     stepperX2.setOverCurrent(X2_OVERCURRENT); //set overcurrent protection
164 164
     stepperX2.setStallCurrent(X2_STALLCURRENT);
165
-#endif
166
-#ifdef Y_IS_L6470
165
+  #endif
166
+  #if ENABLED(Y_IS_L6470)
167 167
 	stepperY.init(Y_K_VAL);
168 168
 	stepperY.softFree();
169 169
 	stepperY.setMicroSteps(Y_MICROSTEPS);
170 170
     stepperY.setOverCurrent(Y_OVERCURRENT); //set overcurrent protection
171 171
     stepperY.setStallCurrent(Y_STALLCURRENT);
172
-#endif
173
-#ifdef Y2_IS_L6470
172
+  #endif
173
+  #if ENABLED(Y2_IS_L6470)
174 174
 	stepperY2.init(Y2_K_VAL);
175 175
 	stepperY2.softFree();
176 176
 	stepperY2.setMicroSteps(Y2_MICROSTEPS);
177 177
     stepperY2.setOverCurrent(Y2_OVERCURRENT); //set overcurrent protection
178 178
     stepperY2.setStallCurrent(Y2_STALLCURRENT);
179
-#endif
180
-#ifdef Z_IS_L6470
179
+  #endif
180
+  #if ENABLED(Z_IS_L6470)
181 181
 	stepperZ.init(Z_K_VAL);
182 182
 	stepperZ.softFree();
183 183
 	stepperZ.setMicroSteps(Z_MICROSTEPS);
184 184
     stepperZ.setOverCurrent(Z_OVERCURRENT); //set overcurrent protection
185 185
     stepperZ.setStallCurrent(Z_STALLCURRENT);
186
-#endif
187
-#ifdef Z2_IS_L6470
186
+  #endif
187
+  #if ENABLED(Z2_IS_L6470)
188 188
 	stepperZ2.init(Z2_K_VAL);
189 189
 	stepperZ2.softFree();
190 190
 	stepperZ2.setMicroSteps(Z2_MICROSTEPS);
191 191
     stepperZ2.setOverCurrent(Z2_OVERCURRENT); //set overcurrent protection
192 192
     stepperZ2.setStallCurrent(Z2_STALLCURRENT);
193
-#endif
194
-#ifdef E0_IS_L6470
193
+  #endif
194
+  #if ENABLED(E0_IS_L6470)
195 195
 	stepperE0.init(E0_K_VAL);
196 196
 	stepperE0.softFree();
197 197
 	stepperE0.setMicroSteps(E0_MICROSTEPS);
198 198
     stepperE0.setOverCurrent(E0_OVERCURRENT); //set overcurrent protection
199 199
     stepperE0.setStallCurrent(E0_STALLCURRENT);
200
-#endif
201
-#ifdef E1_IS_L6470
200
+  #endif
201
+  #if ENABLED(E1_IS_L6470)
202 202
 	stepperE1.init(E1_K_VAL);
203 203
 	stepperE1.softFree();
204 204
 	stepperE1.setMicroSteps(E1_MICROSTEPS);
205 205
     stepperE1.setOverCurrent(E1_OVERCURRENT); //set overcurrent protection
206 206
     stepperE1.setStallCurrent(E1_STALLCURRENT);
207
-#endif
208
-#ifdef E2_IS_L6470
207
+  #endif
208
+  #if ENABLED(E2_IS_L6470)
209 209
 	stepperE2.init(E2_K_VAL);
210 210
 	stepperE2.softFree();
211 211
 	stepperE2.setMicroSteps(E2_MICROSTEPS);
212 212
     stepperE2.setOverCurrent(E2_OVERCURRENT); //set overcurrent protection
213 213
     stepperE2.setStallCurrent(E2_STALLCURRENT);
214
-#endif
215
-#ifdef E3_IS_L6470
214
+  #endif
215
+  #if ENABLED(E3_IS_L6470)
216 216
 	stepperE3.init(E3_K_VAL);
217 217
 	stepperE3.softFree();
218 218
 	stepperE3.setMicroSteps(E3_MICROSTEPS);
219 219
     stepperE3.setOverCurrent(E3_OVERCURRENT); //set overcurrent protection
220 220
     stepperE3.setStallCurrent(E3_STALLCURRENT);
221
-#endif	
221
+  #endif	
222 222
 }
223 223
 #endif
224 224
 

+ 22
- 22
Marlin/stepper_indirection.h Datei anzeigen

@@ -158,12 +158,12 @@
158 158
 // Pin redefines for TMC drivers. 
159 159
 // TMC26X drivers have step and dir on normal pins, but everything else via SPI
160 160
 //////////////////////////////////
161
-#ifdef HAVE_TMCDRIVER
161
+#if ENABLED(HAVE_TMCDRIVER)
162 162
 #include <SPI.h>
163 163
 #include <TMC26XStepper.h>
164 164
 
165 165
   void tmc_init();
166
-#ifdef X_IS_TMC
166
+#if ENABLED(X_IS_TMC)
167 167
    extern TMC26XStepper stepperX;
168 168
    #undef X_ENABLE_INIT 
169 169
    #define X_ENABLE_INIT ((void)0)
@@ -175,7 +175,7 @@
175 175
    #define X_ENABLE_READ stepperX.isEnabled()
176 176
    
177 177
 #endif
178
-#ifdef X2_IS_TMC
178
+#if ENABLED(X2_IS_TMC)
179 179
    extern TMC26XStepper stepperX2;
180 180
    #undef X2_ENABLE_INIT
181 181
    #define X2_ENABLE_INIT ((void)0)
@@ -186,7 +186,7 @@
186 186
    #undef X2_ENABLE_READ
187 187
    #define X2_ENABLE_READ stepperX2.isEnabled()   
188 188
 #endif
189
-#ifdef Y_IS_TMC
189
+#if ENABLED(Y_IS_TMC)
190 190
    extern TMC26XStepper stepperY;
191 191
    #undef Y_ENABLE_INIT
192 192
    #define Y_ENABLE_INIT ((void)0)
@@ -197,7 +197,7 @@
197 197
    #undef Y_ENABLE_READ
198 198
    #define Y_ENABLE_READ stepperY.isEnabled()   
199 199
 #endif
200
-#ifdef Y2_IS_TMC
200
+#if ENABLED(Y2_IS_TMC)
201 201
    extern TMC26XStepper stepperY2;
202 202
    #undef Y2_ENABLE_INIT
203 203
    #define Y2_ENABLE_INIT ((void)0)
@@ -208,7 +208,7 @@
208 208
    #undef Y2_ENABLE_READ
209 209
    #define Y2_ENABLE_READ stepperY2.isEnabled()     
210 210
 #endif
211
-#ifdef Z_IS_TMC
211
+#if ENABLED(Z_IS_TMC)
212 212
    extern TMC26XStepper stepperZ;
213 213
    #undef Z_ENABLE_INIT
214 214
    #define Z_ENABLE_INIT ((void)0)
@@ -219,7 +219,7 @@
219 219
    #undef Z_ENABLE_READ
220 220
    #define Z_ENABLE_READ stepperZ.isEnabled()       
221 221
 #endif
222
-#ifdef Z2_IS_TMC
222
+#if ENABLED(Z2_IS_TMC)
223 223
    extern TMC26XStepper stepperZ2;
224 224
    #undef Z2_ENABLE_INIT
225 225
    #define Z2_ENABLE_INIT ((void)0)
@@ -230,7 +230,7 @@
230 230
    #undef Z2_ENABLE_READ
231 231
    #define Z2_ENABLE_READ stepperZ2.isEnabled()   
232 232
 #endif
233
-#ifdef E0_IS_TMC
233
+#if ENABLED(E0_IS_TMC)
234 234
    extern TMC26XStepper stepperE0;
235 235
    #undef E0_ENABLE_INIT
236 236
    #define E0_ENABLE_INIT ((void)0)
@@ -241,7 +241,7 @@
241 241
    #undef E0_ENABLE_READ
242 242
    #define E0_ENABLE_READ stepperE0.isEnabled()   
243 243
 #endif
244
-#ifdef E1_IS_TMC
244
+#if ENABLED(E1_IS_TMC)
245 245
    extern TMC26XStepper stepperE1;
246 246
    #undef E1_ENABLE_INIT
247 247
    #define E1_ENABLE_INIT ((void)0)
@@ -252,7 +252,7 @@
252 252
    #undef E1_ENABLE_READ
253 253
    #define E1_ENABLE_READ stepperE1.isEnabled()   
254 254
 #endif
255
-#ifdef E2_IS_TMC
255
+#if ENABLED(E2_IS_TMC)
256 256
    extern TMC26XStepper stepperE2;
257 257
    #undef E2_ENABLE_INIT
258 258
    #define E2_ENABLE_INIT ((void)0)
@@ -263,7 +263,7 @@
263 263
    #undef E2_ENABLE_READ
264 264
    #define E2_ENABLE_READ stepperE2.isEnabled()   
265 265
 #endif
266
-#ifdef E3_IS_TMC
266
+#if ENABLED(E3_IS_TMC)
267 267
    extern TMC26XStepper stepperE3;
268 268
    #undef E3_ENABLE_INIT
269 269
    #define E3_ENABLE_INIT ((void)0)
@@ -281,13 +281,13 @@
281 281
 // Pin redefines for L6470 drivers. 
282 282
 // L640 drivers have step on normal pins, but dir and everything else via SPI
283 283
 //////////////////////////////////
284
-#ifdef HAVE_L6470DRIVER
284
+#if ENABLED(HAVE_L6470DRIVER)
285 285
 
286 286
 #include <SPI.h>
287 287
 #include <L6470.h>
288 288
 
289 289
   void L6470_init();
290
-#ifdef X_IS_L6470
290
+#if ENABLED(X_IS_L6470)
291 291
    extern L6470 stepperX;
292 292
    #undef X_ENABLE_INIT 
293 293
    #define X_ENABLE_INIT ((void)0)
@@ -308,7 +308,7 @@
308 308
    #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
309 309
    
310 310
 #endif
311
-#ifdef X2_IS_L6470
311
+#if ENABLED(X2_IS_L6470)
312 312
    extern L6470 stepperX2;
313 313
    #undef X2_ENABLE_INIT
314 314
    #define X2_ENABLE_INIT ((void)0)
@@ -328,7 +328,7 @@
328 328
    #undef X2_DIR_READ
329 329
    #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
330 330
 #endif
331
-#ifdef Y_IS_L6470
331
+#if ENABLED(Y_IS_L6470)
332 332
    extern L6470 stepperY;
333 333
    #undef Y_ENABLE_INIT
334 334
    #define Y_ENABLE_INIT ((void)0)
@@ -348,7 +348,7 @@
348 348
    #undef Y_DIR_READ
349 349
    #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)  
350 350
 #endif
351
-#ifdef Y2_IS_L6470
351
+#if ENABLED(Y2_IS_L6470)
352 352
    extern L6470 stepperY2;
353 353
    #undef Y2_ENABLE_INIT
354 354
    #define Y2_ENABLE_INIT ((void)0)
@@ -368,7 +368,7 @@
368 368
    #undef Y2_DIR_READ
369 369
    #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)   
370 370
 #endif
371
-#ifdef Z_IS_L6470
371
+#if ENABLED(Z_IS_L6470)
372 372
    extern L6470 stepperZ;
373 373
    #undef Z_ENABLE_INIT
374 374
    #define Z_ENABLE_INIT ((void)0)
@@ -388,7 +388,7 @@
388 388
    #undef Y_DIR_READ
389 389
    #define Y_DIR_READ (stepperZ.getStatus() & STATUS_DIR)      
390 390
 #endif
391
-#ifdef Z2_IS_L6470
391
+#if ENABLED(Z2_IS_L6470)
392 392
    extern L6470 stepperZ2;
393 393
    #undef Z2_ENABLE_INIT
394 394
    #define Z2_ENABLE_INIT ((void)0)
@@ -408,7 +408,7 @@
408 408
    #undef Y2_DIR_READ
409 409
    #define Y2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)       
410 410
 #endif
411
-#ifdef E0_IS_L6470
411
+#if ENABLED(E0_IS_L6470)
412 412
    extern L6470 stepperE0;
413 413
    #undef E0_ENABLE_INIT
414 414
    #define E0_ENABLE_INIT ((void)0)
@@ -428,7 +428,7 @@
428 428
    #undef E0_DIR_READ
429 429
    #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)    
430 430
 #endif
431
-#ifdef E1_IS_L6470
431
+#if ENABLED(E1_IS_L6470)
432 432
    extern L6470 stepperE1;
433 433
    #undef E1_ENABLE_INIT
434 434
    #define E1_ENABLE_INIT ((void)0)
@@ -448,7 +448,7 @@
448 448
    #undef E1_DIR_READ
449 449
    #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)  
450 450
 #endif
451
-#ifdef E2_IS_L6470
451
+#if ENABLED(E2_IS_L6470)
452 452
    extern L6470 stepperE2;
453 453
    #undef E2_ENABLE_INIT
454 454
    #define E2_ENABLE_INIT ((void)0)
@@ -468,7 +468,7 @@
468 468
    #undef E2_DIR_READ
469 469
    #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)  
470 470
 #endif
471
-#ifdef E3_IS_L6470
471
+#if ENABLED(E3_IS_L6470)
472 472
    extern L6470 stepperE3;
473 473
    #undef E3_ENABLE_INIT
474 474
    #define E3_ENABLE_INIT ((void)0)

Laden…
Abbrechen
Speichern