HCoop
/
clinton
/
Smoothieware.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a46fdf5
)
protect against defining a homing endstop when the motor/actuator is not defined
author
Jim Morris
<morris@wolfman.com>
Wed, 11 Apr 2018 12:31:41 +0000
(13:31 +0100)
committer
Jim Morris
<morris@wolfman.com>
Wed, 11 Apr 2018 12:31:41 +0000
(13:31 +0100)
src/modules/tools/endstops/Endstops.cpp
patch
|
blob
|
blame
|
history
diff --git
a/src/modules/tools/endstops/Endstops.cpp
b/src/modules/tools/endstops/Endstops.cpp
index
5253e97
..
c21ccc8
100644
(file)
--- a/
src/modules/tools/endstops/Endstops.cpp
+++ b/
src/modules/tools/endstops/Endstops.cpp
@@
-274,6
+274,14
@@
bool Endstops::load_config()
continue;
}
continue;
}
+ // check we are not going above the number of defined actuators/axis
+ if(i >= THEROBOT->get_number_registered_motors()) {
+ // too many axis we only have configured n_motors
+ THEKERNEL->streams->printf("ERROR: endstop %d is greater than number of defined motors\n", i);
+ delete pin_info;
+ return false;
+ }
+
// keep track of the maximum index that has been defined
if(i > max_index) max_index= i;
// keep track of the maximum index that has been defined
if(i > max_index) max_index= i;
@@
-289,12
+297,6
@@
bool Endstops::load_config()
// enter into endstop array
endstops.push_back(pin_info);
// enter into endstop array
endstops.push_back(pin_info);
- // check we are not going above the number of defined actuators/axis
- if(i >= k_max_actuators) {
- // too many axis we only have configured k_max_actuators
- continue;
- }
-
// if set to none it means not used for homing (maybe limit only) so do not add to the homing array
string direction= THEKERNEL->config->value(endstop_checksum, cs, direction_checksum)->by_default("none")->as_string();
if(direction == "none") {
// if set to none it means not used for homing (maybe limit only) so do not add to the homing array
string direction= THEKERNEL->config->value(endstop_checksum, cs, direction_checksum)->by_default("none")->as_string();
if(direction == "none") {