mirror of https://github.com/ArduPilot/ardupilot
AP_Param: added get_param_by_index
useful for parameter conversion within an object
This commit is contained in:
parent
5ef31a1801
commit
7b98ab0f12
|
@ -1034,6 +1034,21 @@ bool AP_Param::find_top_level_key_by_pointer(const void *ptr, uint16_t &key)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
fetch a parameter value based on the index within a group. This
|
||||||
|
is used to find the old value of a parameter that has been
|
||||||
|
removed from an object.
|
||||||
|
*/
|
||||||
|
bool AP_Param::get_param_by_index(void *obj_ptr, uint8_t idx, ap_var_type old_ptype, void *pvalue)
|
||||||
|
{
|
||||||
|
uint16_t key;
|
||||||
|
if (!find_top_level_key_by_pointer(obj_ptr, key)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const ConversionInfo type_info = {key, idx, old_ptype, nullptr };
|
||||||
|
return AP_Param::find_old_parameter(&type_info, (AP_Param *)pvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Find a object by name.
|
// Find a object by name.
|
||||||
//
|
//
|
||||||
|
|
|
@ -440,6 +440,13 @@ public:
|
||||||
static void convert_parent_class(uint8_t param_key, void *object_pointer,
|
static void convert_parent_class(uint8_t param_key, void *object_pointer,
|
||||||
const struct AP_Param::GroupInfo *group_info);
|
const struct AP_Param::GroupInfo *group_info);
|
||||||
|
|
||||||
|
/*
|
||||||
|
fetch a parameter value based on the index within a group. This
|
||||||
|
is used to find the old value of a parameter that has been
|
||||||
|
removed from an object.
|
||||||
|
*/
|
||||||
|
static bool get_param_by_index(void *obj_ptr, uint8_t idx, ap_var_type old_ptype, void *pvalue);
|
||||||
|
|
||||||
/// Erase all variables in EEPROM.
|
/// Erase all variables in EEPROM.
|
||||||
///
|
///
|
||||||
static void erase_all(void);
|
static void erase_all(void);
|
||||||
|
|
Loading…
Reference in New Issue