mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-09 05:40:46 +02:00
Made everything compile again after changing the structure to be able to handle limits etc.
This commit is contained in:
@@ -111,8 +111,8 @@ void limits_go_home(uint8_t cycle_mask) {
|
||||
// Initialize step pin masks
|
||||
step_pin[idx] = bit(idx);
|
||||
if (bit_istrue(cycle_mask, bit(idx))) {
|
||||
// Set target based on max_travel setting. Ensure homing switches engaged with search scalar.
|
||||
max_travel = MAX(max_travel, (HOMING_AXIS_SEARCH_SCALAR)*axis_settings[idx]->max_travel->get());
|
||||
// Set target based on max_travel setting. Ensure homing switches engaged with search scalar.
|
||||
max_travel = MAX(max_travel, (HOMING_AXIS_SEARCH_SCALAR)* MachineConfig::instance()->_axes->_axis[idx]->_maxTravel);
|
||||
}
|
||||
}
|
||||
// Set search mode with approach at seek rate to quickly engage the specified cycle_mask limit switches.
|
||||
|
@@ -73,9 +73,9 @@ Axis::~Axis() {
|
||||
}
|
||||
}
|
||||
|
||||
Axes::Axes() : axis_() {
|
||||
Axes::Axes() : _axis() {
|
||||
for (int i = 0; i < MAX_NUMBER_AXIS; ++i) {
|
||||
axis_[i] = nullptr;
|
||||
_axis[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ void Axes::init() {
|
||||
// certain motors need features to be turned on. Check them here
|
||||
for (uint8_t axis = X_AXIS; axis < _numberAxis; axis++) {
|
||||
for (uint8_t gang_index = 0; gang_index < Axis::MAX_NUMBER_GANGED; gang_index++) {
|
||||
auto& a = axis_[axis]->_gangs[gang_index]->_motor;
|
||||
auto& a = _axis[axis]->_gangs[gang_index]->_motor;
|
||||
|
||||
if (a == nullptr) {
|
||||
a = new Motors::Nullmotor();
|
||||
@@ -125,7 +125,7 @@ void Axes::set_disable(bool disable) {
|
||||
// now loop through all the motors to see if they can individually disable
|
||||
for (int axis = 0; axis < _numberAxis; axis++) {
|
||||
for (int gang_index = 0; gang_index < Axis::MAX_NUMBER_GANGED; gang_index++) {
|
||||
auto a = axis_[axis]->_gangs[gang_index]->_motor;
|
||||
auto a = _axis[axis]->_gangs[gang_index]->_motor;
|
||||
a->set_disable(disable);
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ void Axes::read_settings() {
|
||||
//grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Read Settings");
|
||||
for (uint8_t axis = X_AXIS; axis < _numberAxis; axis++) {
|
||||
for (uint8_t gang_index = 0; gang_index < Axis::MAX_NUMBER_GANGED; gang_index++) {
|
||||
auto a = axis_[axis]->_gangs[gang_index]->_motor;
|
||||
auto a = _axis[axis]->_gangs[gang_index]->_motor;
|
||||
a->read_settings();
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ uint8_t Axes::set_homing_mode(uint8_t homing_mask, bool isHoming) {
|
||||
|
||||
for (uint8_t axis = X_AXIS; axis < _numberAxis; axis++) {
|
||||
if (bitnum_istrue(homing_mask, axis)) {
|
||||
auto a = axis_[axis];
|
||||
auto a = _axis[axis];
|
||||
if (a != nullptr) {
|
||||
auto motor = a->_gangs[0]->_motor;
|
||||
|
||||
@@ -163,7 +163,7 @@ uint8_t Axes::set_homing_mode(uint8_t homing_mask, bool isHoming) {
|
||||
}
|
||||
|
||||
for (uint8_t gang_index = 1; gang_index < Axis::MAX_NUMBER_GANGED; gang_index++) {
|
||||
auto a2 = axis_[axis]->_gangs[gang_index]->_motor;
|
||||
auto a2 = _axis[axis]->_gangs[gang_index]->_motor;
|
||||
a2->set_homing_mode(isHoming);
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ void Axes::step(uint8_t step_mask, uint8_t dir_mask) {
|
||||
bool thisDir = bitnum_istrue(dir_mask, axis);
|
||||
|
||||
for (uint8_t gang_index = 0; gang_index < Axis::MAX_NUMBER_GANGED; gang_index++) {
|
||||
auto a = axis_[axis]->_gangs[gang_index]->_motor;
|
||||
auto a = _axis[axis]->_gangs[gang_index]->_motor;
|
||||
|
||||
if (a != nullptr) {
|
||||
a->set_direction(thisDir);
|
||||
@@ -203,7 +203,7 @@ void Axes::step(uint8_t step_mask, uint8_t dir_mask) {
|
||||
// Turn on step pulses for motors that are supposed to step now
|
||||
for (int axis = X_AXIS; axis < _numberAxis; axis++) {
|
||||
if (bitnum_istrue(step_mask, axis)) {
|
||||
auto a = axis_[axis]->_gangs[0]->_motor;
|
||||
auto a = _axis[axis]->_gangs[0]->_motor;
|
||||
|
||||
if ((ganged_mode == SquaringMode::Dual) || (ganged_mode == SquaringMode::A)) {
|
||||
a->step();
|
||||
@@ -216,7 +216,7 @@ void Axes::step(uint8_t step_mask, uint8_t dir_mask) {
|
||||
|
||||
for (uint8_t axis = X_AXIS; axis < n_axis; axis++) {
|
||||
if (bitnum_istrue(step_mask, axis)) {
|
||||
auto a = axis_[axis];
|
||||
auto a = _axis[axis];
|
||||
|
||||
if ((ganged_mode == SquaringMode::Dual) || (ganged_mode == SquaringMode::A)) {
|
||||
a->_gangs[0]->_motor->step();
|
||||
@@ -232,7 +232,7 @@ void Axes::unstep() {
|
||||
auto n_axis = _numberAxis;
|
||||
for (uint8_t axis = X_AXIS; axis < n_axis; axis++) {
|
||||
for (uint8_t gang_index = 0; gang_index < Axis::MAX_NUMBER_GANGED; gang_index++) {
|
||||
auto a = axis_[axis]->_gangs[gang_index]->_motor;
|
||||
auto a = _axis[axis]->_gangs[gang_index]->_motor;
|
||||
a->unstep();
|
||||
a->unstep();
|
||||
}
|
||||
@@ -244,7 +244,7 @@ void Axes::unstep() {
|
||||
size_t Axes::findAxisIndex(const Motors::Motor* const motor) const {
|
||||
for (int i = 0; i < _numberAxis; ++i) {
|
||||
for (int j = 0; j < Axis::MAX_NUMBER_GANGED; ++j) {
|
||||
if (axis_[i] != nullptr && axis_[i]->hasMotor(motor)) {
|
||||
if (_axis[i] != nullptr && _axis[i]->hasMotor(motor)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -256,9 +256,9 @@ size_t Axes::findAxisIndex(const Motors::Motor* const motor) const {
|
||||
|
||||
size_t Axes::findAxisGanged(const Motors::Motor* const motor) const {
|
||||
for (int i = 0; i < _numberAxis; ++i) {
|
||||
if (axis_[i] != nullptr && axis_[i]->hasMotor(motor)) {
|
||||
if (_axis[i] != nullptr && _axis[i]->hasMotor(motor)) {
|
||||
for (int j = 0; j < Axis::MAX_NUMBER_GANGED; ++j) {
|
||||
if (axis_[i]->_gangs[j]->_motor == motor) {
|
||||
if (_axis[i]->_gangs[j]->_motor == motor) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
@@ -285,14 +285,14 @@ void Axes::handle(Configuration::HandlerBase& handler) {
|
||||
tmp[1] = '\0';
|
||||
|
||||
if (handler.handlerType() == Configuration::HandlerType::Runtime || handler.handlerType() == Configuration::HandlerType::Parser) {
|
||||
handler.handle(tmp, axis_[a]);
|
||||
handler.handle(tmp, _axis[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Axes::~Axes() {
|
||||
for (int i = 0; i < MAX_NUMBER_AXIS; ++i) {
|
||||
delete axis_[i];
|
||||
delete _axis[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -95,12 +95,11 @@ public:
|
||||
class Axes : public Configuration::Configurable {
|
||||
static const int MAX_NUMBER_AXIS = 6;
|
||||
|
||||
Axis* axis_[MAX_NUMBER_AXIS];
|
||||
|
||||
public:
|
||||
Axes();
|
||||
|
||||
int _numberAxis = 3;
|
||||
Axis* _axis[MAX_NUMBER_AXIS];
|
||||
|
||||
// Some small helpers to find the axis index and axis ganged index for a given motor. This
|
||||
// is helpful for some motors that need this info, as well as debug information.
|
||||
|
Reference in New Issue
Block a user