enumerate for axis endstop
This commit is contained in:
parent
ccbcbc5ab4
commit
3b13eb342f
13
dda.c
13
dda.c
|
|
@ -21,6 +21,7 @@
|
|||
#include "sersendf.h"
|
||||
#include "pinio.h"
|
||||
#include "memory_barrier.h"
|
||||
#include "home.h"
|
||||
//#include "graycode.c"
|
||||
|
||||
#ifdef DC_EXTRUDER
|
||||
|
|
@ -767,7 +768,7 @@ void dda_clock() {
|
|||
// endstop search, but as part of normal operations.
|
||||
if (dda->endstop_check && ! move_state.endstop_stop) {
|
||||
#ifdef X_MIN_PIN
|
||||
if (dda->endstop_check & 0x01) {
|
||||
if (dda->endstop_check & X_MIN_ENDSTOP) {
|
||||
if (x_min() == dda->endstop_stop_cond)
|
||||
move_state.debounce_count_x++;
|
||||
else
|
||||
|
|
@ -776,7 +777,7 @@ void dda_clock() {
|
|||
}
|
||||
#endif
|
||||
#ifdef X_MAX_PIN
|
||||
if (dda->endstop_check & 0x02) {
|
||||
if (dda->endstop_check & X_MAX_ENDSTOP) {
|
||||
if (x_max() == dda->endstop_stop_cond)
|
||||
move_state.debounce_count_x++;
|
||||
else
|
||||
|
|
@ -786,7 +787,7 @@ void dda_clock() {
|
|||
#endif
|
||||
|
||||
#ifdef Y_MIN_PIN
|
||||
if (dda->endstop_check & 0x04) {
|
||||
if (dda->endstop_check & Y_MIN_ENDSTOP) {
|
||||
if (y_min() == dda->endstop_stop_cond)
|
||||
move_state.debounce_count_y++;
|
||||
else
|
||||
|
|
@ -795,7 +796,7 @@ void dda_clock() {
|
|||
}
|
||||
#endif
|
||||
#ifdef Y_MAX_PIN
|
||||
if (dda->endstop_check & 0x08) {
|
||||
if (dda->endstop_check & Y_MAX_ENDSTOP) {
|
||||
if (y_max() == dda->endstop_stop_cond)
|
||||
move_state.debounce_count_y++;
|
||||
else
|
||||
|
|
@ -805,7 +806,7 @@ void dda_clock() {
|
|||
#endif
|
||||
|
||||
#ifdef Z_MIN_PIN
|
||||
if (dda->endstop_check & 0x10) {
|
||||
if (dda->endstop_check & Z_MIN_ENDSTOP) {
|
||||
if (z_min() == dda->endstop_stop_cond)
|
||||
move_state.debounce_count_z++;
|
||||
else
|
||||
|
|
@ -814,7 +815,7 @@ void dda_clock() {
|
|||
}
|
||||
#endif
|
||||
#ifdef Z_MAX_PIN
|
||||
if (dda->endstop_check & 0x20) {
|
||||
if (dda->endstop_check & Z_MAX_ENDSTOP) {
|
||||
if (z_max() == dda->endstop_stop_cond)
|
||||
move_state.debounce_count_z++;
|
||||
else
|
||||
|
|
|
|||
26
home.c
26
home.c
|
|
@ -66,7 +66,7 @@ static const uint32_t PROGMEM search_feedrate_P[3] = {
|
|||
};
|
||||
|
||||
uint8_t get_endstop_check(enum axis_e n, int8_t dir);
|
||||
void home_axis(enum axis_e n, int8_t dir);
|
||||
void home_axis(enum axis_e n, int8_t dir, enum axis_endstop_e endstop_check);
|
||||
void set_axis_home_position(enum axis_e n, int8_t dir);
|
||||
|
||||
/// home all 3 axes
|
||||
|
|
@ -97,7 +97,7 @@ void home() {
|
|||
/// find X MIN endstop
|
||||
void home_x_negative() {
|
||||
#if defined X_MIN_PIN
|
||||
home_axis(X, -1);
|
||||
home_axis(X, -1, X_MIN_ENDSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -107,14 +107,14 @@ void home_x_positive() {
|
|||
#warning X_MAX_PIN defined, but not X_MAX. home_x_positive() disabled.
|
||||
#endif
|
||||
#if defined X_MAX_PIN && defined X_MAX
|
||||
home_axis(X, 1);
|
||||
home_axis(X, 1, X_MAX_ENDSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// fund Y MIN endstop
|
||||
void home_y_negative() {
|
||||
#if defined Y_MIN_PIN
|
||||
home_axis(Y, -1);
|
||||
home_axis(Y, -1, Y_MIN_ENDSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -124,14 +124,14 @@ void home_y_positive() {
|
|||
#warning Y_MAX_PIN defined, but not Y_MAX. home_y_positive() disabled.
|
||||
#endif
|
||||
#if defined Y_MAX_PIN && defined Y_MAX
|
||||
home_axis(Y, 1);
|
||||
home_axis(Y, 1, Y_MAX_ENDSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// find Z MIN endstop
|
||||
void home_z_negative() {
|
||||
#if defined Z_MIN_PIN
|
||||
home_axis(Z, -1);
|
||||
home_axis(Z, -1, Z_MIN_ENDSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -141,23 +141,13 @@ void home_z_positive() {
|
|||
#warning Z_MAX_PIN defined, but not Z_MAX. home_z_positive() disabled.
|
||||
#endif
|
||||
#if defined Z_MAX_PIN && defined Z_MAX
|
||||
home_axis(Z, 1);
|
||||
home_axis(Z, 1, Z_MAX_ENDSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t get_endstop_check(enum axis_e n, int8_t dir) {
|
||||
uint8_t endstop_check;
|
||||
if (dir < 0)
|
||||
endstop_check = 1 << (n * 2);
|
||||
else
|
||||
endstop_check = 1 << (n * 2 + 1);
|
||||
return endstop_check;
|
||||
}
|
||||
|
||||
void home_axis(enum axis_e n, int8_t dir) {
|
||||
void home_axis(enum axis_e n, int8_t dir, enum axis_endstop_e endstop_check) {
|
||||
TARGET t = startpoint;
|
||||
startpoint.axis[n] = 0;
|
||||
uint8_t endstop_check = get_endstop_check(n, dir);
|
||||
|
||||
t.axis[n] = dir * MAX_DELTA_UM;
|
||||
t.F = pgm_read_dword(&fast_feedrate_P[n]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue