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:
@@ -129,13 +129,17 @@ void Axes::init() {
|
|||||||
// certain motors need features to be turned on. Check them here
|
// certain motors need features to be turned on. Check them here
|
||||||
for (uint8_t axis = X_AXIS; axis < _numberAxis; axis++) {
|
for (uint8_t axis = X_AXIS; axis < _numberAxis; axis++) {
|
||||||
for (uint8_t gang_index = 0; gang_index < Axis::MAX_NUMBER_GANGED; gang_index++) {
|
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];
|
||||||
|
if (a) {
|
||||||
if (a == nullptr) {
|
auto g = a->_gangs[gang_index];
|
||||||
a = new Motors::Nullmotor();
|
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");
|
//info_serial("Read Settings");
|
||||||
for (uint8_t axis = X_AXIS; axis < _numberAxis; axis++) {
|
for (uint8_t axis = X_AXIS; axis < _numberAxis; axis++) {
|
||||||
for (uint8_t gang_index = 0; gang_index < Axis::MAX_NUMBER_GANGED; gang_index++) {
|
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];
|
||||||
a->read_settings();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user