Browse Source

Merge pull request #5110 from thinkyhead/rc_z2_min_allowed

Support Z2 min in M119 report
Scott Lahteine 8 years ago
parent
commit
43df9ace4e
4 changed files with 12 additions and 7 deletions
  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 View File

201
     SERIAL_PROTOCOLPGM(MSG_Z_MIN);
201
     SERIAL_PROTOCOLPGM(MSG_Z_MIN);
202
     SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
202
     SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
203
   #endif
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
   #if HAS_Z_MAX
208
   #if HAS_Z_MAX
205
     SERIAL_PROTOCOLPGM(MSG_Z_MAX);
209
     SERIAL_PROTOCOLPGM(MSG_Z_MAX);
206
     SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
210
     SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
218
 #if ENABLED(Z_DUAL_ENDSTOPS)
222
 #if ENABLED(Z_DUAL_ENDSTOPS)
219
 
223
 
220
   // Pass the result of the endstop test
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
     byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2
226
     byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2
223
     if (z_test && stepper.current_block->steps[Z_AXIS] > 0) {
227
     if (z_test && stepper.current_block->steps[Z_AXIS] > 0) {
224
       SBI(endstop_hit_bits, Z_MIN);
228
       SBI(endstop_hit_bits, Z_MIN);

+ 1
- 1
Marlin/endstops.h View File

86
   private:
86
   private:
87
 
87
 
88
     #if ENABLED(Z_DUAL_ENDSTOPS)
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
     #endif
90
     #endif
91
 };
91
 };
92
 
92
 

+ 1
- 0
Marlin/language.h View File

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

+ 5
- 5
Marlin/stepper.cpp View File

162
   #if ENABLED(Z_DUAL_ENDSTOPS)
162
   #if ENABLED(Z_DUAL_ENDSTOPS)
163
     #define Z_APPLY_STEP(v,Q) \
163
     #define Z_APPLY_STEP(v,Q) \
164
     if (performing_homing) { \
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
         if (!(TEST(endstops.old_endstop_bits, Z_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
166
         if (!(TEST(endstops.old_endstop_bits, Z_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
171
         if (!(TEST(endstops.old_endstop_bits, Z2_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
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
     else { \
174
     else { \
175
       Z_STEP_WRITE(v); \
175
       Z_STEP_WRITE(v); \

Loading…
Cancel
Save