|
@@ -97,6 +97,9 @@ static bool old_x_min_endstop = false,
|
97
|
97
|
old_z2_min_endstop = false,
|
98
|
98
|
old_z2_max_endstop = false;
|
99
|
99
|
#endif
|
|
100
|
+ #if defined Z_PROBE_AND_ENDSTOP
|
|
101
|
+ old_z_probe_endstop = false;
|
|
102
|
+ #endif
|
100
|
103
|
|
101
|
104
|
static bool check_endstops = true;
|
102
|
105
|
|
|
@@ -520,6 +523,26 @@ ISR(TIMER1_COMPA_vect) {
|
520
|
523
|
old_z2_min_endstop = z2_min_endstop;
|
521
|
524
|
#endif
|
522
|
525
|
#endif
|
|
526
|
+
|
|
527
|
+ #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
|
|
528
|
+ UPDATE_ENDSTOP(z, Z, probe, PROBE);
|
|
529
|
+ bool z_probe_endstop(READ(Z_PROBE_PIN) != Z_MIN_ENDSTOP_INVERTING);
|
|
530
|
+ if(z_probe_endstop && old_z_probe_endstop)
|
|
531
|
+ {
|
|
532
|
+ endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
|
533
|
+ endstop_z_hit=true;
|
|
534
|
+
|
|
535
|
+// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+ if (!(performing_homing)) //if not performing home
|
|
539
|
+ {
|
|
540
|
+ step_events_completed = current_block->step_event_count;
|
|
541
|
+ }
|
|
542
|
+ }
|
|
543
|
+ old_z_probe_endstop = z_probe_endstop;
|
|
544
|
+ old_z2_probe_endstop = z2_probe_endstop;
|
|
545
|
+ #endif
|
523
|
546
|
}
|
524
|
547
|
}
|
525
|
548
|
else { // +direction
|
|
@@ -554,6 +577,26 @@ ISR(TIMER1_COMPA_vect) {
|
554
|
577
|
old_z2_max_endstop = z2_max_endstop;
|
555
|
578
|
#endif
|
556
|
579
|
#endif
|
|
580
|
+
|
|
581
|
+ #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
|
|
582
|
+ UPDATE_ENDSTOP(z, Z, probe, PROBE);
|
|
583
|
+ bool z_probe_endstop(READ(Z_PROBE_PIN) != Z_MAX_ENDSTOP_INVERTING);
|
|
584
|
+ if(z_probe_endstop && old_z_probe_endstop)
|
|
585
|
+ {
|
|
586
|
+ endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
|
587
|
+ endstop_z_hit=true;
|
|
588
|
+
|
|
589
|
+// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+ if (!(performing_homing)) //if not performing home
|
|
593
|
+ {
|
|
594
|
+ step_events_completed = current_block->step_event_count;
|
|
595
|
+ }
|
|
596
|
+ }
|
|
597
|
+ old_z_probe_endstop = z_probe_endstop;
|
|
598
|
+ old_z2_probe_endstop = z2_probe_endstop;
|
|
599
|
+ #endif
|
557
|
600
|
}
|
558
|
601
|
}
|
559
|
602
|
|
|
@@ -635,7 +678,7 @@ ISR(TIMER1_COMPA_vect) {
|
635
|
678
|
step_events_completed++;
|
636
|
679
|
if (step_events_completed >= current_block->step_event_count) break;
|
637
|
680
|
}
|
638
|
|
- // Calculare new timer value
|
|
681
|
+ // Calculate new timer value
|
639
|
682
|
unsigned short timer;
|
640
|
683
|
unsigned short step_rate;
|
641
|
684
|
if (step_events_completed <= (unsigned long int)current_block->accelerate_until) {
|
|
@@ -918,6 +961,13 @@ void st_init() {
|
918
|
961
|
#endif
|
919
|
962
|
#endif
|
920
|
963
|
|
|
964
|
+#if defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0
|
|
965
|
+ SET_INPUT(Z_PROBE_PIN);
|
|
966
|
+ #ifdef ENDSTOPPULLUP_ZPROBE
|
|
967
|
+ WRITE(Z_PROBE_PIN,HIGH);
|
|
968
|
+ #endif
|
|
969
|
+#endif
|
|
970
|
+
|
921
|
971
|
#define AXIS_INIT(axis, AXIS, PIN) \
|
922
|
972
|
AXIS ##_STEP_INIT; \
|
923
|
973
|
AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \
|