Browse Source

AP_Rangefinder: fixed param handling for Wasp backends

master
Andrew Tridgell 7 years ago committed by Francisco Ferreira
parent
commit
3b8d5ea4cf
  1. 8
      libraries/AP_RangeFinder/RangeFinder.cpp
  2. 4
      libraries/AP_RangeFinder/RangeFinder.h

8
libraries/AP_RangeFinder/RangeFinder.cpp

@ -539,6 +539,8 @@ const AP_Param::GroupInfo RangeFinder::var_info[] = { @@ -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) @@ -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 {

4
libraries/AP_RangeFinder/RangeFinder.h

@ -101,9 +101,11 @@ public: @@ -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

Loading…
Cancel
Save