From ac44b73951c345b818bdd6177e667cf70e784051 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Feb 2012 10:51:57 +1100 Subject: [PATCH] AP_Param: fixed setting of CAM_P_G in ArduCopter the variable CAM_P_G has the same prefix as the CAM_P group. We want to allow for parameters having a common prefix with a group, so we need to keep searching after we've found a group that matches the prefix --- libraries/AP_Common/AP_Param.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Common/AP_Param.cpp b/libraries/AP_Common/AP_Param.cpp index 32081f92f7..da0ed84984 100644 --- a/libraries/AP_Common/AP_Param.cpp +++ b/libraries/AP_Common/AP_Param.cpp @@ -533,7 +533,13 @@ AP_Param::find(const char *name, enum ap_var_type *ptype) continue; } const struct GroupInfo *group_info = (const struct GroupInfo *)PGM_POINTER(&_var_info[i].group_info); - return find_group(name + len, i, group_info, ptype); + AP_Param *ap = find_group(name + len, i, group_info, ptype); + if (ap != NULL) { + return ap; + } + // we continue looking as we want to allow top level + // parameter to have the same prefix name as group + // parameters, for example CAM_P_G } else if (strcasecmp_P(name, _var_info[i].name) == 0) { *ptype = (enum ap_var_type)type; return (AP_Param *)PGM_POINTER(&_var_info[i].ptr);