1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-29 17:19:50 +02:00

Adjust homing mask according to extant motors

This commit is contained in:
Mitch Bradley
2021-07-24 15:44:57 -10:00
parent f20506d726
commit 92ba726f7f
4 changed files with 7 additions and 5 deletions

View File

@@ -243,8 +243,7 @@ static void limits_go_home(uint8_t cycle_mask, uint32_t n_locate_cycles) {
// XXX we need to include gang1 in the remaining mask
// The following might fail if only one gang has limit switches. Anaylze me.
uint32_t remainingMotors = cycle_mask | (cycle_mask << 16);
//uint32_t remainingMotors = cycle_mask; // this works!!! but not for squaring
uint32_t remainingMotors = (cycle_mask | (cycle_mask << 16)) & Machine::Axes::motorMask;
uint32_t old = 0;
@@ -252,7 +251,6 @@ static void limits_go_home(uint8_t cycle_mask, uint32_t n_locate_cycles) {
if (approach) {
// Check limit state. Lock out cycle axes when they change.
// XXX do we check only the switch in the direction of motion?
//uint32_t limitedAxes = limits_check(-1);
uint32_t limitedAxes = Machine::Axes::posLimitMask | Machine::Axes::negLimitMask;
if (old != remainingMotors) {
@@ -453,9 +451,8 @@ void limits_init() {
// Return a mask of the switches that are engaged.
AxisMask limits_check(AxisMask check_mask) {
// Expand the bitmask to include both gangs
bit_true(check_mask, check_mask << 16);
return (Machine::Axes::posLimitMask & check_mask) | (Machine::Axes::negLimitMask & check_mask);
return (Machine::Axes::posLimitMask | Machine::Axes::negLimitMask) & check_mask;
}
// Returns limit state as a bit-wise uint8 variable. Each bit indicates an axis limit, where

View File

@@ -12,6 +12,7 @@ namespace Machine {
uint32_t Axes::negLimitMask = 0;
uint32_t Axes::homingMask = 0;
uint32_t Axes::limitMask = 0;
uint32_t Axes::motorMask = 0;
Axes::Axes() : _axis() {
for (int i = 0; i < MAX_N_AXIS; ++i) {

View File

@@ -43,6 +43,7 @@ namespace Machine {
static uint32_t negLimitMask;
static uint32_t homingMask;
static uint32_t limitMask;
static uint32_t motorMask;
inline char axisName(int index) { return index < MAX_N_AXIS ? _names[index] : '?'; }

View File

@@ -35,6 +35,9 @@ namespace Machine {
}
void Gang::init() {
if (strcmp(_motor->name, "null_motor") != 0) {
bitnum_istrue(Axes::motorMask, _axis + 16 * i);
}
_motor->init();
if (_endstops) {
_endstops->init();