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

Axis config sanity checking

This commit is contained in:
Mitch Bradley
2021-06-03 22:12:08 -10:00
parent 34ee18317b
commit 26204b84e6

View File

@@ -129,13 +129,17 @@ 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;
if (a == nullptr) {
a = new Motors::Nullmotor();
auto a = _axis[axis];
if (a) {
auto g = a->_gangs[gang_index];
if (g) {
auto m = g->_motor;
if (m == nullptr) {
m = new Motors::Nullmotor();
}
m->init();
}
}
a->init();
}
}
}
@@ -168,8 +172,21 @@ void Axes::read_settings() {
//info_serial("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;
a->read_settings();
auto a = _axis[axis];
if (!a) {
log_info("No specification for axis " << axis);
break;
}
auto g = a->_gangs[gang_index];
if (!g) {
log_info("No specification for axis " << axis << " gang " << gang_index);
break;
}
auto m = g->_motor;
if (!m) {
log_info("No motor for axis " << axis << " gang " << gang_index);
}
m->read_settings();
}
}
}