|
@@ -193,6 +193,21 @@ void Endstops::M119() {
|
193
|
193
|
#endif
|
194
|
194
|
} // Endstops::M119
|
195
|
195
|
|
|
196
|
+#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
197
|
+
|
|
198
|
+ // Pass the result of the endstop test
|
|
199
|
+ void Endstops::test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2) {
|
|
200
|
+ byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2
|
|
201
|
+ if (stepper.current_block->steps[Z_AXIS] > 0) {
|
|
202
|
+ stepper.endstop_triggered(Z_AXIS);
|
|
203
|
+ SBI(endstop_hit_bits, Z_MIN);
|
|
204
|
+ if (!stepper.performing_homing || (z_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
|
|
205
|
+ stepper.kill_current_block();
|
|
206
|
+ }
|
|
207
|
+ }
|
|
208
|
+
|
|
209
|
+#endif
|
|
210
|
+
|
196
|
211
|
// Check endstops - Called from ISR!
|
197
|
212
|
void Endstops::update() {
|
198
|
213
|
|
|
@@ -290,14 +305,7 @@ void Endstops::update() {
|
290
|
305
|
COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN);
|
291
|
306
|
#endif
|
292
|
307
|
|
293
|
|
- byte z_test = TEST_ENDSTOP(Z_MIN) | (TEST_ENDSTOP(Z2_MIN) << 1); // bit 0 for Z, bit 1 for Z2
|
294
|
|
-
|
295
|
|
- if (z_test && stepper.current_block->steps[Z_AXIS] > 0) { // z_test = Z_MIN || Z2_MIN
|
296
|
|
- stepper.endstop_triggered(Z_AXIS);
|
297
|
|
- SBI(endstop_hit_bits, Z_MIN);
|
298
|
|
- if (!performing_homing || (z_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
|
299
|
|
- stepper.kill_current_block();
|
300
|
|
- }
|
|
308
|
+ test_dual_z_endstops(Z_MIN, Z2_MIN);
|
301
|
309
|
|
302
|
310
|
#else // !Z_DUAL_ENDSTOPS
|
303
|
311
|
|
|
@@ -330,14 +338,7 @@ void Endstops::update() {
|
330
|
338
|
COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX);
|
331
|
339
|
#endif
|
332
|
340
|
|
333
|
|
- byte z_test = TEST_ENDSTOP(Z_MAX) | (TEST_ENDSTOP(Z2_MAX) << 1); // bit 0 for Z, bit 1 for Z2
|
334
|
|
-
|
335
|
|
- if (z_test && stepper.current_block->steps[Z_AXIS] > 0) { // t_test = Z_MAX || Z2_MAX
|
336
|
|
- stepper.endstop_triggered(Z_AXIS);
|
337
|
|
- SBI(endstop_hit_bits, Z_MIN);
|
338
|
|
- if (!performing_homing || (z_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
|
339
|
|
- stepper.kill_current_block();
|
340
|
|
- }
|
|
341
|
+ test_dual_z_endstops(Z_MAX, Z2_MAX);
|
341
|
342
|
|
342
|
343
|
#else // !Z_DUAL_ENDSTOPS
|
343
|
344
|
|
|
@@ -349,5 +350,7 @@ void Endstops::update() {
|
349
|
350
|
#if ENABLED(COREXZ)
|
350
|
351
|
}
|
351
|
352
|
#endif
|
|
353
|
+
|
352
|
354
|
old_endstop_bits = current_endstop_bits;
|
|
355
|
+
|
353
|
356
|
} // Endstops::update()
|