Bug fixes for Z_PROBE_AND_ENDSTOP.

Code cleanup for Z_PROBE_AND_ENDSTOP.
Added Z_PROBE_PIN to pins_RAMPS_13.h
This commit is contained in:
Chris Roadfeldt 2015-03-29 02:16:09 -05:00
parent 059052889f
commit 324c14943b
4 changed files with 15 additions and 21 deletions

View file

@ -499,9 +499,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// As of 3-28-2015, there are NO Z Probe pins defined in any board config files. // 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 D32 pin in the Aux 4 section of the RAMPS board for the signal. // 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 D32 pin in the Aux 4 section of the RAMPS board for the signal.
// The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. The Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. The Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works.
// If you have RAMPS 1.3/1.4 and want to use the RAMPS D32 pin, set Z_PROBE_PIN to 32 and use ground and 5v next to it as needed. Check the RAMPS 1.3/1.4 pinout diagram for details. // D32 is currently selected in the RAMPS 1.3/1.4 pin file. Update the pins.h file for your control board to make use of this. Not doing so nullifies Z_PROBE_AND_ENDSTOP
// WARNING: Setting the wrong pin may have unexpected and disastrous outcomes. Use with caution and do your homework. // 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). // 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. const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.

View file

@ -1359,8 +1359,13 @@ static void retract_z_probe() {
st_synchronize(); st_synchronize();
#if defined(Z_PROBE_AND_ENDSTOP)
bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
if (z_probe_endstop)
#else
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
if (!z_min_endstop) if (z_min_endstop)
#endif
{ {
if (!Stopped) if (!Stopped)
{ {
@ -3516,7 +3521,7 @@ inline void gcode_M119() {
#endif #endif
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN >-1 #if defined(Z_PROBE_PIN) && Z_PROBE_PIN >-1
SERIAL_PROTOCOLPGM(MSG_Z_PROBE); SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
SERIALPROTOCOLLN(((READ(Z_PROBE_PIN)^72Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); SERIAL_PROTOCOLLN(((READ(Z_PROBE_PIN)^Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
} }

View file

@ -62,6 +62,11 @@
#define FILWIDTH_PIN 5 #define FILWIDTH_PIN 5
#endif #endif
#if defined(Z_PROBE_ANDENDSTOP)
// Define a pin to use as the signal pin on Arduino for the Z_PROBE endstop.
#define 32
#endif
#if defined(FILAMENT_RUNOUT_SENSOR) #if defined(FILAMENT_RUNOUT_SENSOR)
// define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
#define FILRUNOUT_PIN 4 #define FILRUNOUT_PIN 4

View file

@ -527,22 +527,15 @@ ISR(TIMER1_COMPA_vect) {
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1 #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
UPDATE_ENDSTOP(z, Z, probe, PROBE); UPDATE_ENDSTOP(z, Z, probe, PROBE);
bool z_probe_endstop(READ(Z_PROBE_PIN) != Z_MIN_ENDSTOP_INVERTING); z_probe_endstop=(READ(Z_PROBE_PIN) != Z_MIN_ENDSTOP_INVERTING);
if(z_probe_endstop && old_z_probe_endstop) if(z_probe_endstop && old_z_probe_endstop)
{ {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit=true; endstop_z_hit=true;
// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = 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_z_probe_endstop = z_probe_endstop;
old_z2_probe_endstop = z2_probe_endstop;
#endif #endif
} }
} }
@ -581,22 +574,14 @@ ISR(TIMER1_COMPA_vect) {
#if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1 #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
UPDATE_ENDSTOP(z, Z, probe, PROBE); UPDATE_ENDSTOP(z, Z, probe, PROBE);
bool z_probe_endstop(READ(Z_PROBE_PIN) != Z_MAX_ENDSTOP_INVERTING); z_probe_endstop=(READ(Z_PROBE_PIN) != Z_MAX_ENDSTOP_INVERTING);
if(z_probe_endstop && old_z_probe_endstop) if(z_probe_endstop && old_z_probe_endstop)
{ {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit=true; endstop_z_hit=true;
// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = 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_z_probe_endstop = z_probe_endstop;
old_z2_probe_endstop = z2_probe_endstop;
#endif #endif
} }
} }