Enabled separate Z Probe and Z Axis endstop use at same time.
Typo fixes in comments in existing code.
This commit is contained in:
parent
b14be7235e
commit
9f3ff14008
@ -317,6 +317,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
|
||||
const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
|
||||
//#define DISABLE_MAX_ENDSTOPS
|
||||
//#define DISABLE_MIN_ENDSTOPS
|
||||
|
||||
@ -483,6 +484,33 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
|
||||
|
||||
#endif
|
||||
|
||||
// If you have are a Z Probe in addition to endstop(s) for Z Homing, uncomment the #define Z_PROBE_AND_ENDSTOP line below and configure Z Probe settings.
|
||||
// Only use this if you have both a Z PROBE and Z HOMING ENDSTOP(S). If you are using Z_SAFE_HOMING above, then you probably don't need this unless you want to make use of
|
||||
// a non-default pin for your Z Probe.
|
||||
// Note: It's expected that your Z Probe triggers in the direction towards your bed. If your Z Probe does not trigger when traveling towards you bed, it will trigger when it's moving
|
||||
// away from the bed.
|
||||
|
||||
// #define Z_PROBE_AND_ENDSTOP
|
||||
|
||||
#ifdef Z_PROBE_AND_ENDSTOP
|
||||
|
||||
// As of 3-28-2015, there are NO Z Probe pins defined in any board config files.
|
||||
// Z_PROBE_PIN is for the signal pin only. RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D1 pin in the Aux 1 section of the RAMPS board for the signal.
|
||||
// The D1 pin in Aux 1 on RAMPS maps to the Arduino D1 pin. The Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D1 pin on the RAMPS maps to D1 on Arduino, this works.
|
||||
// If you have RAMPS 1.3/1.4 and want to use the RAMPS D1 pin, set Z_PROBE_PIN to 1 and use ground and 5v next to it as needed. Check the RAMPS 1.3/1.4 pinout diagram for details.
|
||||
// WARNING: Setting the wrong pin may have unexpected and disastrous outcomes. Use with caution and do your homework.
|
||||
#define Z_PROBE_PIN -1
|
||||
|
||||
// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
|
||||
const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
|
||||
// The pullups are needed if you directly connect a mechanical endstop between the signal and ground pins.
|
||||
#define ENDSTOPPULLUP_ZPROBE
|
||||
|
||||
// If you want to enable the Z Probe pin, but disable its use, uncomment the line below.
|
||||
// #define DISABLE_Z_PROBE_ENDSTOP
|
||||
#endif
|
||||
|
||||
#endif // ENABLE_AUTO_BED_LEVELING
|
||||
|
||||
|
||||
|
@ -178,6 +178,10 @@
|
||||
#define Z_MIN_PIN -1
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_Z_PROBE_ENDSTOP
|
||||
#define Z_PROBE_PIN -1
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_XMAX_ENDSTOP
|
||||
#undef X_MAX_PIN
|
||||
#define X_MAX_PIN -1
|
||||
|
@ -34,6 +34,7 @@
|
||||
#define Z_ENABLE_PIN 62
|
||||
#define Z_MIN_PIN 18
|
||||
#define Z_MAX_PIN 19
|
||||
#define Z_PROBE_PIN -1
|
||||
|
||||
#define Y2_STEP_PIN 36
|
||||
#define Y2_DIR_PIN 34
|
||||
|
@ -97,6 +97,9 @@ static bool old_x_min_endstop = false,
|
||||
old_z2_min_endstop = false,
|
||||
old_z2_max_endstop = false;
|
||||
#endif
|
||||
#if defined Z_PROBE_AND_ENDSTOP
|
||||
old_z_probe_endstop = false;
|
||||
#endif
|
||||
|
||||
static bool check_endstops = true;
|
||||
|
||||
@ -520,6 +523,26 @@ ISR(TIMER1_COMPA_vect) {
|
||||
old_z2_min_endstop = z2_min_endstop;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
|
||||
UPDATE_ENDSTOP(z, Z, probe, PROBE);
|
||||
bool z_probe_endstop(READ(Z_PROBE_PIN) != Z_MIN_ENDSTOP_INVERTING);
|
||||
if(z_probe_endstop && old_z_probe_endstop)
|
||||
{
|
||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||
endstop_z_hit=true;
|
||||
|
||||
// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
|
||||
|
||||
|
||||
if (!(performing_homing)) //if not performing home
|
||||
{
|
||||
step_events_completed = current_block->step_event_count;
|
||||
}
|
||||
}
|
||||
old_z_probe_endstop = z_probe_endstop;
|
||||
old_z2_probe_endstop = z2_probe_endstop;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else { // +direction
|
||||
@ -554,6 +577,26 @@ ISR(TIMER1_COMPA_vect) {
|
||||
old_z2_max_endstop = z2_max_endstop;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
|
||||
UPDATE_ENDSTOP(z, Z, probe, PROBE);
|
||||
bool z_probe_endstop(READ(Z_PROBE_PIN) != Z_MAX_ENDSTOP_INVERTING);
|
||||
if(z_probe_endstop && old_z_probe_endstop)
|
||||
{
|
||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||
endstop_z_hit=true;
|
||||
|
||||
// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
|
||||
|
||||
|
||||
if (!(performing_homing)) //if not performing home
|
||||
{
|
||||
step_events_completed = current_block->step_event_count;
|
||||
}
|
||||
}
|
||||
old_z_probe_endstop = z_probe_endstop;
|
||||
old_z2_probe_endstop = z2_probe_endstop;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -635,7 +678,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) {
|
||||
@ -918,6 +961,13 @@ void st_init() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0
|
||||
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); \
|
||||
|
Loading…
Reference in New Issue
Block a user