mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 23:33:57 -04:00
AP_Param: optionally return parameter flags in AP_Param::find(...)
This commit is contained in:
parent
70daf0010b
commit
2049e86dda
@ -825,7 +825,7 @@ AP_Param::find_group(const char *name, uint16_t vindex, ptrdiff_t group_offset,
|
||||
// Find a variable by name.
|
||||
//
|
||||
AP_Param *
|
||||
AP_Param::find(const char *name, enum ap_var_type *ptype)
|
||||
AP_Param::find(const char *name, enum ap_var_type *ptype, uint16_t *flags)
|
||||
{
|
||||
for (uint16_t i=0; i<_num_vars; i++) {
|
||||
uint8_t type = _var_info[i].type;
|
||||
@ -840,6 +840,9 @@ AP_Param::find(const char *name, enum ap_var_type *ptype)
|
||||
}
|
||||
AP_Param *ap = find_group(name + len, i, 0, group_info, ptype);
|
||||
if (ap != nullptr) {
|
||||
if (flags != nullptr) {
|
||||
*flags = group_info->flags;
|
||||
}
|
||||
return ap;
|
||||
}
|
||||
// we continue looking as we want to allow top level
|
||||
|
@ -252,10 +252,11 @@ public:
|
||||
/// If the variable has no name, it cannot be found by this interface.
|
||||
///
|
||||
/// @param name The full name of the variable to be found.
|
||||
/// @param flags If non-null will be filled with parameter flags
|
||||
/// @return A pointer to the variable, or nullptr if
|
||||
/// it does not exist.
|
||||
///
|
||||
static AP_Param * find(const char *name, enum ap_var_type *ptype);
|
||||
static AP_Param * find(const char *name, enum ap_var_type *ptype, uint16_t *flags = nullptr);
|
||||
|
||||
/// set a default value by name
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user