AP_Rangefinder: fixed param handling for Wasp backends

This commit is contained in:
Andrew Tridgell 2018-05-17 09:05:50 +10:00 committed by Francisco Ferreira
parent b678302aed
commit 3b8d5ea4cf
2 changed files with 11 additions and 1 deletions

View File

@ -539,6 +539,8 @@ const AP_Param::GroupInfo RangeFinder::var_info[] = {
AP_GROUPEND
};
const AP_Param::GroupInfo *RangeFinder::backend_var_info[RANGEFINDER_MAX_INSTANCES];
RangeFinder::RangeFinder(AP_SerialManager &_serial_manager, enum Rotation orientation_default) :
num_instances(0),
estimated_terrain_height(0),
@ -739,6 +741,12 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance)
default:
break;
}
// if the backend has some local parameters then make those available in the tree
if (drivers[instance] && state[instance].var_info) {
backend_var_info[instance] = state[instance].var_info;
AP_Param::load_object_from_eeprom(drivers[instance], backend_var_info[instance]);
}
}
AP_RangeFinder_Backend *RangeFinder::get_backend(uint8_t id) const {

View File

@ -101,9 +101,11 @@ public:
AP_Int8 address;
AP_Vector3f pos_offset; // position offset in body frame
AP_Int8 orientation;
const struct AP_Param::GroupInfo *backend_var_info;
const struct AP_Param::GroupInfo *var_info;
};
static const struct AP_Param::GroupInfo *backend_var_info[RANGEFINDER_MAX_INSTANCES];
AP_Int16 _powersave_range;
// parameters for each instance