mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 02:42:36 +02:00
Only start the limits task if there are limit switches
Also added an "Initializing endstops..." message.
This commit is contained in:
@@ -296,11 +296,16 @@ uint8_t limit_mask = 0;
|
|||||||
void limits_init() {
|
void limits_init() {
|
||||||
limit_mask = 0;
|
limit_mask = 0;
|
||||||
|
|
||||||
|
bool hasLimits = false;
|
||||||
auto n_axis = config->_axes->_numberAxis;
|
auto n_axis = config->_axes->_numberAxis;
|
||||||
for (int axis = 0; axis < n_axis; axis++) {
|
for (int axis = 0; axis < n_axis; axis++) {
|
||||||
for (int gang_index = 0; gang_index < 2; gang_index++) {
|
for (int gang_index = 0; gang_index < 2; gang_index++) {
|
||||||
auto gangConfig = config->_axes->_axis[axis]->_gangs[gang_index];
|
auto gangConfig = config->_axes->_axis[axis]->_gangs[gang_index];
|
||||||
if (gangConfig->_endstops != nullptr && gangConfig->_endstops->_dual.defined()) {
|
if (gangConfig->_endstops != nullptr && gangConfig->_endstops->_dual.defined()) {
|
||||||
|
if (!hasLimits) {
|
||||||
|
info_serial("Initializing endstops...");
|
||||||
|
hasLimits = true;
|
||||||
|
}
|
||||||
Pin& pin = gangConfig->_endstops->_dual;
|
Pin& pin = gangConfig->_endstops->_dual;
|
||||||
|
|
||||||
pin.setAttr(Pin::Attr::Input | Pin::Attr::ISR);
|
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) {
|
if (limit_sw_queue == NULL && config->_softwareDebounceMs != 0) {
|
||||||
// setup task used for debouncing
|
// setup task used for debouncing
|
||||||
if (limit_sw_queue == NULL) {
|
if (limit_sw_queue == NULL) {
|
||||||
@@ -329,6 +335,7 @@ void limits_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Disables hard limits.
|
// Disables hard limits.
|
||||||
void limits_disable() {
|
void limits_disable() {
|
||||||
|
Reference in New Issue
Block a user