mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-23 00:59:54 +08:00
Fix motor subtree being unreachable from ASCII protocol
When get_direct_child() was invoked on an Axis Instrospectable with the
string "motor" it instead returned an Introspectable for
"motor_thermistor".
This is because strncmp("motor", "motor_thermistor", 5) compares to 0.
This commit is contained in:
@@ -96,7 +96,7 @@ public:
|
||||
private:
|
||||
Introspectable get_direct_child(const char * name, size_t length) const {
|
||||
for (size_t i = 0; i < type_info_->property_table_length_; ++i) {
|
||||
if (!strncmp(name, type_info_->property_table_[i].name, length)) {
|
||||
if (!strncmp(name, type_info_->property_table_[i].name, length) && (length == strlen(type_info_->property_table_[i].name))) {
|
||||
Introspectable result;
|
||||
result.storage_ = type_info_->get_child(storage_, i);
|
||||
result.type_info_ = type_info_->property_table_[i].type_info;
|
||||
|
||||
Reference in New Issue
Block a user