Merge branch 'Development' into fixup_probing
Latest upstream commits
This commit is contained in:
@ -76,6 +76,7 @@ volatile long endstops_stepsTotal, endstops_stepsDone;
|
||||
static volatile bool endstop_x_hit = false;
|
||||
static volatile bool endstop_y_hit = false;
|
||||
static volatile bool endstop_z_hit = false;
|
||||
static volatile bool endstop_z_probe_hit = false; // Leaving this in even if Z_PROBE_ENDSTOP isn't defined, keeps code below cleaner. #ifdef it and usage below to save space.
|
||||
|
||||
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
bool abort_on_endstop_hit = false;
|
||||
@ -112,6 +113,10 @@ static volatile bool endstop_z_hit = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef Z_PROBE_ENDSTOP // No need to check for valid pin, SanityCheck.h already does this.
|
||||
static bool old_z_probe_endstop = false;
|
||||
#endif
|
||||
|
||||
static bool check_endstops = true;
|
||||
|
||||
volatile long count_position[NUM_AXIS] = { 0 };
|
||||
@ -254,11 +259,11 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
|
||||
#define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~BIT(OCIE1A)
|
||||
|
||||
void endstops_hit_on_purpose() {
|
||||
endstop_x_hit = endstop_y_hit = endstop_z_hit = false;
|
||||
endstop_x_hit = endstop_y_hit = endstop_z_hit = endstop_z_probe_hit = false; // #ifdef endstop_z_probe_hit = to save space if needed.
|
||||
}
|
||||
|
||||
void checkHitEndstops() {
|
||||
if (endstop_x_hit || endstop_y_hit || endstop_z_hit) {
|
||||
if (endstop_x_hit || endstop_y_hit || endstop_z_hit || endstop_z_probe_hit) { // #ifdef || endstop_z_probe_hit to save space if needed.
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
|
||||
if (endstop_x_hit) {
|
||||
@ -273,6 +278,12 @@ void checkHitEndstops() {
|
||||
SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
|
||||
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
|
||||
}
|
||||
#ifdef Z_PROBE_ENDSTOP
|
||||
if (endstop_z_probe_hit) {
|
||||
SERIAL_ECHOPAIR(" Z_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
|
||||
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
|
||||
}
|
||||
#endif
|
||||
SERIAL_EOL;
|
||||
|
||||
endstops_hit_on_purpose();
|
||||
@ -551,6 +562,19 @@ ISR(TIMER1_COMPA_vect) {
|
||||
|
||||
#endif // Z_MIN_PIN
|
||||
|
||||
#ifdef Z_PROBE_ENDSTOP
|
||||
UPDATE_ENDSTOP(z, Z, probe, PROBE);
|
||||
z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
|
||||
if(z_probe_endstop && old_z_probe_endstop)
|
||||
{
|
||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||
endstop_z_probe_hit=true;
|
||||
|
||||
// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
|
||||
}
|
||||
old_z_probe_endstop = z_probe_endstop;
|
||||
#endif
|
||||
|
||||
} // check_endstops
|
||||
|
||||
}
|
||||
@ -596,6 +620,18 @@ ISR(TIMER1_COMPA_vect) {
|
||||
#endif // !Z_DUAL_ENDSTOPS
|
||||
|
||||
#endif // Z_MAX_PIN
|
||||
|
||||
#ifdef Z_PROBE_ENDSTOP
|
||||
UPDATE_ENDSTOP(z, Z, probe, PROBE);
|
||||
z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
|
||||
if(z_probe_endstop && old_z_probe_endstop)
|
||||
{
|
||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||
endstop_z_probe_hit=true;
|
||||
// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
|
||||
}
|
||||
old_z_probe_endstop = z_probe_endstop;
|
||||
#endif
|
||||
|
||||
} // check_endstops
|
||||
|
||||
@ -679,7 +715,7 @@ ISR(TIMER1_COMPA_vect) {
|
||||
step_events_completed++;
|
||||
if (step_events_completed >= current_block->step_event_count) break;
|
||||
}
|
||||
// Calculare new timer value
|
||||
// Calculate new timer value
|
||||
unsigned short timer;
|
||||
unsigned short step_rate;
|
||||
if (step_events_completed <= (unsigned long int)current_block->accelerate_until) {
|
||||
@ -962,6 +998,13 @@ void st_init() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
|
||||
SET_INPUT(Z_PROBE_PIN);
|
||||
#ifdef ENDSTOPPULLUP_ZPROBE
|
||||
WRITE(Z_PROBE_PIN,HIGH);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define AXIS_INIT(axis, AXIS, PIN) \
|
||||
AXIS ##_STEP_INIT; \
|
||||
AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \
|
||||
|
Reference in New Issue
Block a user