1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-31 18:11:48 +02:00

Only start the limits task if there are limit switches

Also added an "Initializing endstops..." message.
This commit is contained in:
Mitch Bradley
2021-06-23 14:00:36 -10:00
parent 93fefa43b0
commit 7fd1391712

View File

@@ -296,11 +296,16 @@ uint8_t limit_mask = 0;
void limits_init() {
limit_mask = 0;
bool hasLimits = false;
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()) {
if (!hasLimits) {
info_serial("Initializing endstops...");
hasLimits = true;
}
Pin& pin = gangConfig->_endstops->_dual;
pin.setAttr(Pin::Attr::Input | Pin::Attr::ISR);
@@ -316,6 +321,7 @@ void limits_init() {
}
}
if (hasLimits) {
if (limit_sw_queue == NULL && config->_softwareDebounceMs != 0) {
// setup task used for debouncing
if (limit_sw_queue == NULL) {
@@ -328,6 +334,7 @@ void limits_init() {
NULL);
}
}
}
}
// Disables hard limits.