mirror of https://github.com/ArduPilot/ardupilot
Don't return a name for a variable if it has no name, even if it's in a group that does have a name.
When displaying variables, don't display variables with no name, or that are groups. git-svn-id: https://arducopter.googlecode.com/svn/trunk@1656 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
b750e2b006
commit
a8d6b839a5
|
@ -131,10 +131,12 @@ AP_Var::~AP_Var(void)
|
|||
void AP_Var::copy_name(char *buffer, size_t buffer_size) const
|
||||
{
|
||||
buffer[0] = '\0';
|
||||
if (_name) {
|
||||
if (_group)
|
||||
_group->copy_name(buffer, buffer_size);
|
||||
strlcat_P(buffer, _name, buffer_size);
|
||||
}
|
||||
}
|
||||
|
||||
// Find a variable by name.
|
||||
//
|
||||
|
|
|
@ -111,10 +111,16 @@ AP_Var_menu_show(uint8_t argc, const Menu::arg *argv)
|
|||
for (vp = AP_Var::first(); vp; vp = vp->next()) {
|
||||
char name_buffer[32];
|
||||
|
||||
// groups should not be displayed
|
||||
if (vp->meta_type_id() == AP_Var::k_typeid_group) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// get a displayable name for the variable
|
||||
vp->copy_name(name_buffer, sizeof(name_buffer));
|
||||
if (name_buffer[0] == 0) {
|
||||
strcpy_P(name_buffer, PSTR("??"));
|
||||
// without a name the variable is not displayable
|
||||
continue;
|
||||
}
|
||||
|
||||
// print name and value
|
||||
|
|
Loading…
Reference in New Issue