Browse Source

New Feature: Z_DUAL_ENDSTOPS

Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z
steppers - Let's call them Z stepper and Z2 stepper.
That way the machine is capable to align the bed during home, since both
Z steppers are homed.
There is also an implementation of M666 (software endstops adjustment)
to this feature.
After Z homing, this adjustment is applied to just one of the steppers
in order to align the bed.
One just need to home the Z axis and measure the distance difference
between both Z axis and apply the math: Z adjust = Z - Z2.
If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it
is.. think about it) and the Z adjust would be positive.
Play a little bit with small adjustments (0.5mm) and check the
behaviour.
The M119 (endstops report) will start reporting the Z2 Endstop as well.
alexborro 9 years ago
parent
commit
0ce3576685
8 changed files with 228 additions and 19 deletions
  1. 22
    0
      Marlin/ConfigurationStore.cpp
  2. 26
    1
      Marlin/Configuration_adv.h
  3. 2
    0
      Marlin/Marlin.h
  4. 48
    3
      Marlin/Marlin_main.cpp
  5. 1
    0
      Marlin/language.h
  6. 29
    0
      Marlin/pins.h
  7. 94
    15
      Marlin/stepper.cpp
  8. 6
    0
      Marlin/stepper.h

+ 22
- 0
Marlin/ConfigurationStore.cpp View File

@@ -67,6 +67,9 @@
67 67
  *
68 68
  *  filament_size (x4)
69 69
  *
70
+ * Z_DUAL_ENDSTOPS
71
+ *  z_endstop_adj
72
+ *
70 73
  */
71 74
 #include "Marlin.h"
72 75
 #include "language.h"
@@ -165,6 +168,10 @@ void Config_StoreSettings()  {
165 168
     EEPROM_WRITE_VAR(i, delta_radius);              // 1 float
166 169
     EEPROM_WRITE_VAR(i, delta_diagonal_rod);        // 1 float
167 170
     EEPROM_WRITE_VAR(i, delta_segments_per_second); // 1 float
171
+  #elif defined(Z_DUAL_ENDSTOPS)
172
+    EEPROM_WRITE_VAR(i, z_endstop_adj);            // 1 floats
173
+    dummy = 0.0f;
174
+    for (int q=5; q--;) EEPROM_WRITE_VAR(i, dummy);
168 175
   #else
169 176
     dummy = 0.0f;
170 177
     for (int q=6; q--;) EEPROM_WRITE_VAR(i, dummy);
@@ -326,7 +333,12 @@ void Config_RetrieveSettings() {
326 333
       EEPROM_READ_VAR(i, delta_radius);               // 1 float
327 334
       EEPROM_READ_VAR(i, delta_diagonal_rod);         // 1 float
328 335
       EEPROM_READ_VAR(i, delta_segments_per_second);  // 1 float
336
+    #elif defined(Z_DUAL_ENDSTOPS)
337
+      EEPROM_READ_VAR(i, z_endstop_adj);
338
+      dummy = 0.0f;
339
+      for (int q=5; q--;) EEPROM_READ_VAR(i, dummy);
329 340
     #else
341
+      dummy = 0.0f;
330 342
       for (int q=6; q--;) EEPROM_READ_VAR(i, dummy);
331 343
     #endif
332 344
 
@@ -459,6 +471,8 @@ void Config_ResetDefault() {
459 471
     delta_diagonal_rod =  DELTA_DIAGONAL_ROD;
460 472
     delta_segments_per_second =  DELTA_SEGMENTS_PER_SECOND;
461 473
     recalc_delta_settings(delta_radius, delta_diagonal_rod);
474
+  #elif defined(Z_DUAL_ENDSTOPS)
475
+    z_endstop_adj = 0;
462 476
   #endif
463 477
 
464 478
   #ifdef ULTIPANEL
@@ -629,6 +643,14 @@ void Config_PrintSettings(bool forReplay) {
629 643
     SERIAL_ECHOPAIR(" R", delta_radius );
630 644
     SERIAL_ECHOPAIR(" S", delta_segments_per_second );
631 645
     SERIAL_EOL;
646
+  #elif defined(Z_DUAL_ENDSTOPS)
647
+    SERIAL_ECHO_START;
648
+    if (!forReplay) {
649
+      SERIAL_ECHOLNPGM("Z2 Endstop adjustement (mm):");
650
+      SERIAL_ECHO_START;
651
+    }
652
+    SERIAL_ECHOPAIR("  M666 Z", z_endstop_adj );
653
+    SERIAL_EOL;  
632 654
   #endif // DELTA
633 655
 
634 656
   #ifdef PIDTEMP

+ 26
- 1
Marlin/Configuration_adv.h View File

@@ -98,7 +98,32 @@
98 98
 // Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used
99 99
 // to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards.
100 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
101
-//#define Z_DUAL_STEPPER_DRIVERS
101
+#define Z_DUAL_STEPPER_DRIVERS
102
+
103
+#ifdef Z_DUAL_STEPPER_DRIVERS
104
+
105
+// Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper.
106
+// That way the machine is capable to align the bed during home, since both Z steppers are homed. 
107
+// There is also an implementation of M666 (software endstops adjustment) to this feature.
108
+// After Z homing, this adjustment is applied to just one of the steppers in order to align the bed.
109
+// One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2.
110
+// If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive.
111
+// Play a little bit with small adjustments (0.5mm) and check the behaviour.
112
+// The M119 (endstops report) will start reporting the Z2 Endstop as well.
113
+
114
+#define Z_DUAL_ENDSTOPS
115
+
116
+#ifdef Z_DUAL_ENDSTOPS
117
+  #define Z2_STEP_PIN E2_STEP_PIN           // Stepper to be used to Z2 axis.
118
+  #define Z2_DIR_PIN E2_DIR_PIN
119
+  #define Z2_ENABLE_PIN E2_ENABLE_PIN
120
+  #define Z2_MAX_PIN 36                     //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36)
121
+  const bool Z2_MAX_ENDSTOP_INVERTING = false;
122
+  #define DISABLE_XMAX_ENDSTOP              //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis.
123
+#endif
124
+
125
+
126
+#endif
102 127
 
103 128
 // Same again but for Y Axis.
104 129
 //#define Y_DUAL_STEPPER_DRIVERS

+ 2
- 0
Marlin/Marlin.h View File

@@ -242,6 +242,8 @@ extern float home_offset[3];
242 242
   extern float delta_diagonal_rod;
243 243
   extern float delta_segments_per_second;
244 244
   void recalc_delta_settings(float radius, float diagonal_rod);
245
+#elif defined(Z_DUAL_ENDSTOPS)
246
+extern float z_endstop_adj;
245 247
 #endif
246 248
 #ifdef SCARA
247 249
   extern float axis_scaling[3];  // Build size scaling

+ 48
- 3
Marlin/Marlin_main.cpp View File

@@ -248,6 +248,8 @@ float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
248 248
 float home_offset[3] = { 0, 0, 0 };
249 249
 #ifdef DELTA
250 250
   float endstop_adj[3] = { 0, 0, 0 };
251
+#elif defined(Z_DUAL_ENDSTOPS)
252
+  float z_endstop_adj = 0;
251 253
 #endif
252 254
 
253 255
 float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
@@ -973,7 +975,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir,  HOME_DIR);
973 975
 
974 976
   static float x_home_pos(int extruder) {
975 977
     if (extruder == 0)
976
-      return base_home_pos(X_AXIS) + add_homing[X_AXIS];
978
+    return base_home_pos(X_AXIS) + home_offset[X_AXIS];
977 979
     else
978 980
       // In dual carriage mode the extruder offset provides an override of the
979 981
       // second X-carriage offset when homed - otherwise X2_HOME_POS is used.
@@ -1487,6 +1489,9 @@ static void homeaxis(int axis) {
1487 1489
       }
1488 1490
     #endif
1489 1491
 #endif // Z_PROBE_SLED
1492
+    #ifdef Z_DUAL_ENDSTOPS
1493
+      if (axis==Z_AXIS) In_Homing_Process(true);
1494
+    #endif
1490 1495
     destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
1491 1496
     feedrate = homing_feedrate[axis];
1492 1497
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
@@ -1512,6 +1517,27 @@ static void homeaxis(int axis) {
1512 1517
 
1513 1518
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
1514 1519
     st_synchronize();
1520
+    #ifdef Z_DUAL_ENDSTOPS
1521
+      if (axis==Z_AXIS)
1522
+      {
1523
+        feedrate = homing_feedrate[axis];
1524
+        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1525
+        if (axis_home_dir > 0)
1526
+        {
1527
+          destination[axis] = (-1) * fabs(z_endstop_adj);
1528
+          if (z_endstop_adj > 0) Lock_z_motor(true); else Lock_z2_motor(true);
1529
+        } else {
1530
+          destination[axis] = fabs(z_endstop_adj);
1531
+          if (z_endstop_adj < 0) Lock_z_motor(true); else Lock_z2_motor(true);        
1532
+        }
1533
+        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
1534
+        st_synchronize();
1535
+        Lock_z_motor(false);
1536
+        Lock_z2_motor(false);
1537
+        In_Homing_Process(false);
1538
+      }
1539
+    #endif
1540
+
1515 1541
 #ifdef DELTA
1516 1542
     // retrace by the amount specified in endstop_adj
1517 1543
     if (endstop_adj[axis] * axis_home_dir < 0) {
@@ -1754,7 +1780,7 @@ inline void gcode_G28() {
1754 1780
 
1755 1781
   enable_endstops(true);
1756 1782
 
1757
-  for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = current_position[i];
1783
+  for (int i = X_AXIS; i <= NUM_AXIS; i++) destination[i] = current_position[i];
1758 1784
 
1759 1785
   feedrate = 0.0;
1760 1786
 
@@ -1944,7 +1970,7 @@ inline void gcode_G28() {
1944 1970
     if (code_seen(axis_codes[Z_AXIS]) && code_value_long() != 0)
1945 1971
       current_position[Z_AXIS] = code_value() + home_offset[Z_AXIS];
1946 1972
 
1947
-    #ifdef ENABLE_AUTO_BED_LEVELING
1973
+    #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0)
1948 1974
       if (home_all_axis || code_seen(axis_codes[Z_AXIS]))
1949 1975
         current_position[Z_AXIS] += zprobe_zoffset;  //Add Z_Probe offset (the distance is negative)
1950 1976
     #endif
@@ -3452,6 +3478,11 @@ inline void gcode_M119() {
3452 3478
     SERIAL_PROTOCOLPGM(MSG_Z_MAX);
3453 3479
     SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3454 3480
   #endif
3481
+  #if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1
3482
+    SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
3483
+    SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3484
+  #endif
3485
+  
3455 3486
 }
3456 3487
 
3457 3488
 /**
@@ -3645,6 +3676,16 @@ inline void gcode_M206() {
3645 3676
       }
3646 3677
     }
3647 3678
   }
3679
+#elif defined(Z_DUAL_ENDSTOPS)
3680
+  /**
3681
+   * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
3682
+   */
3683
+  inline void gcode_M666() {
3684
+   if (code_seen('Z')) z_endstop_adj = code_value();
3685
+   SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj );
3686
+   SERIAL_EOL;
3687
+  }
3688
+  
3648 3689
 #endif // DELTA
3649 3690
 
3650 3691
 #ifdef FWRETRACT
@@ -4894,6 +4935,10 @@ void process_commands() {
4894 4935
         case 666: // M666 set delta endstop adjustment
4895 4936
           gcode_M666();
4896 4937
           break;
4938
+      #elif defined(Z_DUAL_ENDSTOPS)
4939
+        case 666: // M666 set delta endstop adjustment
4940
+          gcode_M666();
4941
+          break;
4897 4942
       #endif // DELTA
4898 4943
 
4899 4944
       #ifdef FWRETRACT

+ 1
- 0
Marlin/language.h View File

@@ -128,6 +128,7 @@
128 128
 #define MSG_Y_MAX                           "y_max: "
129 129
 #define MSG_Z_MIN                           "z_min: "
130 130
 #define MSG_Z_MAX                           "z_max: "
131
+#define MSG_Z2_MAX                          "z2_max: "
131 132
 #define MSG_M119_REPORT                     "Reporting endstop status"
132 133
 #define MSG_ENDSTOP_HIT                     "TRIGGERED"
133 134
 #define MSG_ENDSTOP_OPEN                    "open"

+ 29
- 0
Marlin/pins.h View File

@@ -178,6 +178,35 @@
178 178
   #define Z_MIN_PIN          -1
179 179
 #endif
180 180
 
181
+#ifdef DISABLE_XMAX_ENDSTOP
182
+  #undef X_MAX_PIN
183
+  #define X_MAX_PIN          -1
184
+#endif
185
+
186
+#ifdef DISABLE_XMIN_ENDSTOP
187
+  #undef X_MIN_PIN 
188
+  #define X_MIN_PIN          -1
189
+#endif
190
+
191
+#ifdef DISABLE_YMAX_ENDSTOP
192
+  #define Y_MAX_PIN          -1
193
+#endif
194
+
195
+#ifdef DISABLE_YMIN_ENDSTOP
196
+  #undef Y_MIN_PIN
197
+  #define Y_MIN_PIN          -1
198
+#endif
199
+
200
+#ifdef DISABLE_ZMAX_ENDSTOP
201
+  #undef Z_MAX_PIN
202
+  #define Z_MAX_PIN          -1
203
+#endif
204
+
205
+#ifdef DISABLE_ZMIN_ENDSTOP
206
+  #undef Z_MIN_PIN 
207
+  #define Z_MIN_PIN          -1
208
+#endif
209
+
181 210
 #define SENSITIVE_PINS { 0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, PS_ON_PIN, \
182 211
                         HEATER_BED_PIN, FAN_PIN, \
183 212
                         _E0_PINS _E1_PINS _E2_PINS _E3_PINS \

+ 94
- 15
Marlin/stepper.cpp View File

@@ -48,6 +48,12 @@ block_t *current_block;  // A pointer to the block currently being traced
48 48
 static unsigned char out_bits;        // The next stepping-bits to be output
49 49
 static unsigned int cleaning_buffer_counter;  
50 50
 
51
+#ifdef Z_DUAL_ENDSTOPS
52
+  static bool performing_homing = false, 
53
+              locked_z_motor = false, 
54
+              locked_z2_motor = false;
55
+#endif
56
+
51 57
 // Counter variables for the bresenham line tracer
52 58
 static long counter_x, counter_y, counter_z, counter_e;
53 59
 volatile static unsigned long step_events_completed; // The number of step events executed in the current block
@@ -84,7 +90,13 @@ static bool old_x_min_endstop = false,
84 90
             old_y_min_endstop = false,
85 91
             old_y_max_endstop = false,
86 92
             old_z_min_endstop = false,
93
+            #ifndef Z_DUAL_ENDSTOPS
87 94
             old_z_max_endstop = false;
95
+            #else
96
+              old_z_max_endstop = false,
97
+              old_z2_min_endstop = false,
98
+              old_z2_max_endstop = false;
99
+            #endif
88 100
 
89 101
 static bool check_endstops = true;
90 102
 
@@ -128,7 +140,23 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
128 140
 
129 141
 #ifdef Z_DUAL_STEPPER_DRIVERS
130 142
   #define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }
131
-  #define Z_APPLY_STEP(v,Q) { Z_STEP_WRITE(v); Z2_STEP_WRITE(v); }
143
+  #ifdef Z_DUAL_ENDSTOPS
144
+    #define Z_APPLY_STEP(v,Q) \
145
+    if (performing_homing) { \
146
+      if (Z_HOME_DIR > 0) {\
147
+        if (!(old_z_max_endstop && (count_direction[Z_AXIS] > 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
148
+        if (!(old_z2_max_endstop && (count_direction[Z_AXIS] > 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
149
+      } else {\
150
+        if (!(old_z_min_endstop && (count_direction[Z_AXIS] < 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
151
+        if (!(old_z2_min_endstop && (count_direction[Z_AXIS] < 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
152
+      } \
153
+    } else { \
154
+      Z_STEP_WRITE(v); \
155
+      Z2_STEP_WRITE(v); \
156
+    }
157
+  #else
158
+    #define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v), Z2_STEP_WRITE(v)
159
+  #endif
132 160
 #else
133 161
   #define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v)
134 162
   #define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v)
@@ -465,28 +493,66 @@ ISR(TIMER1_COMPA_vect) {
465 493
     }
466 494
 
467 495
     if (TEST(out_bits, Z_AXIS)) {   // -direction
468
-      Z_DIR_WRITE(INVERT_Z_DIR);
469
-      #ifdef Z_DUAL_STEPPER_DRIVERS
470
-        Z2_DIR_WRITE(INVERT_Z_DIR);
471
-      #endif
472
-
496
+      Z_APPLY_DIR(INVERT_Z_DIR,0);
473 497
       count_direction[Z_AXIS] = -1;
474
-      if (check_endstops) {
475
-        #if defined(Z_MIN_PIN) && Z_MIN_PIN >= 0
476
-          UPDATE_ENDSTOP(z, Z, min, MIN);
498
+      if (check_endstops) 
499
+      {
500
+        #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
501
+          #ifndef Z_DUAL_ENDSTOPS
502
+            UPDATE_ENDSTOP(z, Z, min, MIN);
503
+          #else
504
+            bool z_min_endstop=(READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
505
+            #if defined(Z2_MIN_PIN) && Z2_MIN_PIN > -1
506
+              bool z2_min_endstop=(READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING);
507
+            #else
508
+              bool z2_min_endstop=z_min_endstop;
509
+            #endif
510
+            if(((z_min_endstop && old_z_min_endstop) || (z2_min_endstop && old_z2_min_endstop)) && (current_block->steps[Z_AXIS] > 0))
511
+            {
512
+              endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
513
+              endstop_z_hit=true;
514
+              if (!(performing_homing) || ((performing_homing)&&(z_min_endstop && old_z_min_endstop)&&(z2_min_endstop && old_z2_min_endstop))) //if not performing home or if both endstops were trigged during homing...
515
+              {
516
+                step_events_completed = current_block->step_event_count;
517
+              } 
518
+            }
519
+            old_z_min_endstop = z_min_endstop;
520
+            old_z2_min_endstop = z2_min_endstop;
521
+          #endif
477 522
         #endif
478 523
       }
479 524
     }
480 525
     else { // +direction
481
-      Z_DIR_WRITE(!INVERT_Z_DIR);
482
-      #ifdef Z_DUAL_STEPPER_DRIVERS
483
-        Z2_DIR_WRITE(!INVERT_Z_DIR);
484
-      #endif
485
-
526
+      Z_APPLY_DIR(!INVERT_Z_DIR,0);
486 527
       count_direction[Z_AXIS] = 1;
487 528
       if (check_endstops) {
488 529
         #if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
489
-          UPDATE_ENDSTOP(z, Z, max, MAX);
530
+          #ifndef Z_DUAL_ENDSTOPS
531
+            UPDATE_ENDSTOP(z, Z, max, MAX);
532
+          #else
533
+            bool z_max_endstop=(READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING);
534
+            #if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1
535
+              bool z2_max_endstop=(READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING);
536
+            #else
537
+              bool z2_max_endstop=z_max_endstop;
538
+            #endif
539
+            if(((z_max_endstop && old_z_max_endstop) || (z2_max_endstop && old_z2_max_endstop)) && (current_block->steps[Z_AXIS] > 0))
540
+            {
541
+              endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
542
+              endstop_z_hit=true;
543
+
544
+//              if (z_max_endstop && old_z_max_endstop) SERIAL_ECHOLN("z_max_endstop = true");
545
+//              if (z2_max_endstop && old_z2_max_endstop) SERIAL_ECHOLN("z2_max_endstop = true");
546
+
547
+            
548
+              if (!(performing_homing) || ((performing_homing)&&(z_max_endstop && old_z_max_endstop)&&(z2_max_endstop && old_z2_max_endstop))) //if not performing home or if both endstops were trigged during homing...
549
+              {
550
+                step_events_completed = current_block->step_event_count;
551
+              } 
552
+            }
553
+            old_z_max_endstop = z_max_endstop;
554
+            old_z2_max_endstop = z2_max_endstop;
555
+          #endif
490 556
         #endif
491 557
       }
492 558
     }
@@ -845,6 +911,13 @@ void st_init() {
845 911
     #endif
846 912
   #endif
847 913
 
914
+  #if defined(Z2_MAX_PIN) && Z2_MAX_PIN >= 0
915
+    SET_INPUT(Z2_MAX_PIN);
916
+    #ifdef ENDSTOPPULLUP_ZMAX
917
+      WRITE(Z2_MAX_PIN,HIGH);
918
+    #endif
919
+  #endif  
920
+  
848 921
   #define AXIS_INIT(axis, AXIS, PIN) \
849 922
     AXIS ##_STEP_INIT; \
850 923
     AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \
@@ -1174,3 +1247,9 @@ void microstep_readings() {
1174 1247
     SERIAL_PROTOCOLLN(digitalRead(E1_MS2_PIN));
1175 1248
   #endif
1176 1249
 }
1250
+
1251
+#ifdef Z_DUAL_ENDSTOPS
1252
+  void In_Homing_Process(bool state) { performing_homing = state; }
1253
+  void Lock_z_motor(bool state) { locked_z_motor = state; }
1254
+  void Lock_z2_motor(bool state) { locked_z2_motor = state; }
1255
+#endif

+ 6
- 0
Marlin/stepper.h View File

@@ -97,6 +97,12 @@ void digipot_current(uint8_t driver, int current);
97 97
 void microstep_init();
98 98
 void microstep_readings();
99 99
 
100
+#ifdef Z_DUAL_ENDSTOPS
101
+  void In_Homing_Process(bool state);
102
+  void Lock_z_motor(bool state);
103
+  void Lock_z2_motor(bool state);
104
+#endif
105
+
100 106
 #ifdef BABYSTEPPING
101 107
   void babystep(const uint8_t axis,const bool direction); // perform a short step with a single stepper motor, outside of any convention
102 108
 #endif

Loading…
Cancel
Save