mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 18:38:28 -04:00
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,9 +131,11 @@ AP_Var::~AP_Var(void)
|
|||||||
void AP_Var::copy_name(char *buffer, size_t buffer_size) const
|
void AP_Var::copy_name(char *buffer, size_t buffer_size) const
|
||||||
{
|
{
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
if (_group)
|
if (_name) {
|
||||||
_group->copy_name(buffer, buffer_size);
|
if (_group)
|
||||||
strlcat_P(buffer, _name, buffer_size);
|
_group->copy_name(buffer, buffer_size);
|
||||||
|
strlcat_P(buffer, _name, buffer_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find a variable by name.
|
// 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()) {
|
for (vp = AP_Var::first(); vp; vp = vp->next()) {
|
||||||
char name_buffer[32];
|
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
|
// get a displayable name for the variable
|
||||||
vp->copy_name(name_buffer, sizeof(name_buffer));
|
vp->copy_name(name_buffer, sizeof(name_buffer));
|
||||||
if (name_buffer[0] == 0) {
|
if (name_buffer[0] == 0) {
|
||||||
strcpy_P(name_buffer, PSTR("??"));
|
// without a name the variable is not displayable
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// print name and value
|
// print name and value
|
||||||
|
Loading…
Reference in New Issue
Block a user