Changed Z_PROBE_AND_ENDSTOP to Z_PROBE_ENDSTOP.

Updated documentation in Configuration.h.
Cleaned up and commented some code relating to Z_PROBE_ENDSTOP.
Separated Z_MIN_ENDSTOP and Z_PROBE_ENDSTOP completely.
This commit is contained in:
Chris Roadfeldt
2015-04-01 02:14:55 -05:00
parent fdb4ddbdea
commit a508d835db
5 changed files with 49 additions and 40 deletions

View File

@ -76,7 +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;
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;
@ -113,7 +113,7 @@ static volatile bool endstop_z_probe_hit = false;
#endif
#endif
#ifdef Z_PROBE_AND_ENDSTOP
#ifdef Z_PROBE_ENDSTOP // No need to check for valid pin, SanityCheck.h already does this.
static bool old_z_probe_endstop = false;
#endif
@ -259,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 = endstop_z_probe_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 || endstop_z_probe_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) {
@ -278,10 +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();
@ -550,7 +552,7 @@ ISR(TIMER1_COMPA_vect) {
#endif
#endif
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
#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)
@ -597,7 +599,7 @@ ISR(TIMER1_COMPA_vect) {
#endif
#endif
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
#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)
@ -972,7 +974,7 @@ void st_init() {
#endif
#endif
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0
#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);