Kaynağa Gözat

Merge pull request #5110 from thinkyhead/rc_z2_min_allowed

Support Z2 min in M119 report
Scott Lahteine 7 yıl önce
ebeveyn
işleme
43df9ace4e
4 değiştirilmiş dosya ile 12 ekleme ve 7 silme
  1. 5
    1
      Marlin/endstops.cpp
  2. 1
    1
      Marlin/endstops.h
  3. 1
    0
      Marlin/language.h
  4. 5
    5
      Marlin/stepper.cpp

+ 5
- 1
Marlin/endstops.cpp Dosyayı Görüntüle

@@ -201,6 +201,10 @@ void Endstops::M119() {
201 201
     SERIAL_PROTOCOLPGM(MSG_Z_MIN);
202 202
     SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
203 203
   #endif
204
+  #if HAS_Z2_MIN
205
+    SERIAL_PROTOCOLPGM(MSG_Z2_MIN);
206
+    SERIAL_PROTOCOLLN(((READ(Z2_MIN_PIN)^Z2_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
207
+  #endif
204 208
   #if HAS_Z_MAX
205 209
     SERIAL_PROTOCOLPGM(MSG_Z_MAX);
206 210
     SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
@@ -218,7 +222,7 @@ void Endstops::M119() {
218 222
 #if ENABLED(Z_DUAL_ENDSTOPS)
219 223
 
220 224
   // Pass the result of the endstop test
221
-  void Endstops::test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2) {
225
+  void Endstops::test_dual_z_endstops(const EndstopEnum es1, const EndstopEnum es2) {
222 226
     byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2
223 227
     if (z_test && stepper.current_block->steps[Z_AXIS] > 0) {
224 228
       SBI(endstop_hit_bits, Z_MIN);

+ 1
- 1
Marlin/endstops.h Dosyayı Görüntüle

@@ -86,7 +86,7 @@ class Endstops {
86 86
   private:
87 87
 
88 88
     #if ENABLED(Z_DUAL_ENDSTOPS)
89
-      static void test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2);
89
+      static void test_dual_z_endstops(const EndstopEnum es1, const EndstopEnum es2);
90 90
     #endif
91 91
 };
92 92
 

+ 1
- 0
Marlin/language.h Dosyayı Görüntüle

@@ -145,6 +145,7 @@
145 145
 #define MSG_Y_MAX                           "y_max: "
146 146
 #define MSG_Z_MIN                           "z_min: "
147 147
 #define MSG_Z_MAX                           "z_max: "
148
+#define MSG_Z2_MIN                          "z2_min: "
148 149
 #define MSG_Z2_MAX                          "z2_max: "
149 150
 #define MSG_Z_PROBE                         "z_probe: "
150 151
 #define MSG_ERR_MATERIAL_INDEX              "M145 S<index> out of range (0-1)"

+ 5
- 5
Marlin/stepper.cpp Dosyayı Görüntüle

@@ -162,14 +162,14 @@ volatile long Stepper::endstops_trigsteps[XYZ];
162 162
   #if ENABLED(Z_DUAL_ENDSTOPS)
163 163
     #define Z_APPLY_STEP(v,Q) \
164 164
     if (performing_homing) { \
165
-      if (Z_HOME_DIR > 0) {\
166
-        if (!(TEST(endstops.old_endstop_bits, Z_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
167
-        if (!(TEST(endstops.old_endstop_bits, Z2_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
168
-      } \
169
-      else { \
165
+      if (Z_HOME_DIR < 0) { \
170 166
         if (!(TEST(endstops.old_endstop_bits, Z_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
171 167
         if (!(TEST(endstops.old_endstop_bits, Z2_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
172 168
       } \
169
+      else { \
170
+        if (!(TEST(endstops.old_endstop_bits, Z_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
171
+        if (!(TEST(endstops.old_endstop_bits, Z2_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
172
+      } \
173 173
     } \
174 174
     else { \
175 175
       Z_STEP_WRITE(v); \

Loading…
İptal
Kaydet