1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-01 10:23:19 +02:00

Added new limits_enable to avoid full re-init of limits after homing

thus suppressing unnessary messages.
This commit is contained in:
Mitch Bradley
2021-06-25 10:01:15 -10:00
parent ec89155860
commit 3c1ac49a17
3 changed files with 18 additions and 1 deletions

View File

@@ -351,6 +351,20 @@ void limits_disable() {
}
}
// Re-enables hard limits.
void limits_enable() {
auto n_axis = config->_axes->_numberAxis;
for (int axis = 0; axis < n_axis; axis++) {
for (int gang_index = 0; gang_index < 2; gang_index++) {
auto gangConfig = config->_axes->_axis[axis]->_gangs[gang_index];
if (gangConfig->_endstops != nullptr && gangConfig->_endstops->_dual.defined()) {
Pin& pin = gangConfig->_endstops->_dual;
pin.attachInterrupt(isr_limit_switches, CHANGE, nullptr);
}
}
}
}
// Returns limit state as a bit-wise uint8 variable. Each bit indicates an axis limit, where
// triggered is 1 and not triggered is 0. Invert mask is applied. Axes are defined by their
// number in bit position, i.e. Z_AXIS is bit(2), and Y_AXIS is bit(1).

View File

@@ -37,6 +37,9 @@ void limits_init();
// Disables hard limits.
void limits_disable();
// Re-enables hard limits.
void limits_enable();
// Returns limit state
AxisMask limits_get_state();

View File

@@ -413,7 +413,7 @@ void mc_homing_cycle(AxisMask axis_mask) {
// This give kinematics a chance to do something after normal homing
kinematics_post_homing();
// If hard limits feature enabled, re-enable hard limits pin change register after homing cycle.
limits_init();
limits_enable();
}
// Perform tool length probe cycle. Requires probe switch.