Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Ardupilot
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
Ardupilot
Commits
0922b82d
Commit
0922b82d
authored
12 years ago
by
Andrew Tridgell
Browse files
Options
Downloads
Patches
Plain Diff
AP_Param: added find_by_index()
parent
e28ddb0f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/AP_Common/AP_Param.cpp
+16
-0
16 additions, 0 deletions
libraries/AP_Common/AP_Param.cpp
libraries/AP_Common/AP_Param.h
+9
-0
9 additions, 0 deletions
libraries/AP_Common/AP_Param.h
with
25 additions
and
0 deletions
libraries/AP_Common/AP_Param.cpp
+
16
−
0
View file @
0922b82d
...
@@ -579,6 +579,22 @@ AP_Param::find(const char *name, enum ap_var_type *ptype)
...
@@ -579,6 +579,22 @@ AP_Param::find(const char *name, enum ap_var_type *ptype)
return
NULL
;
return
NULL
;
}
}
// Find a variable by index. Note that this is quite slow.
//
AP_Param
*
AP_Param
::
find_by_index
(
uint16_t
idx
,
enum
ap_var_type
*
ptype
)
{
ParamToken
token
;
AP_Param
*
ap
;
uint16_t
count
=
0
;
for
(
ap
=
AP_Param
::
first
(
&
token
,
ptype
);
ap
&&
count
<
idx
;
ap
=
AP_Param
::
next_scalar
(
&
token
,
ptype
))
{
count
++
;
}
return
ap
;
}
// Save the variable to EEPROM, if supported
// Save the variable to EEPROM, if supported
//
//
bool
AP_Param
::
save
(
void
)
bool
AP_Param
::
save
(
void
)
...
...
This diff is collapsed.
Click to expand it.
libraries/AP_Common/AP_Param.h
+
9
−
0
View file @
0922b82d
...
@@ -132,6 +132,15 @@ public:
...
@@ -132,6 +132,15 @@ public:
///
///
static
AP_Param
*
find
(
const
char
*
name
,
enum
ap_var_type
*
ptype
);
static
AP_Param
*
find
(
const
char
*
name
,
enum
ap_var_type
*
ptype
);
/// Find a variable by index.
///
///
/// @param idx The index of the variable
/// @return A pointer to the variable, or NULL if
/// it does not exist.
///
static
AP_Param
*
find_by_index
(
uint16_t
idx
,
enum
ap_var_type
*
ptype
);
/// Save the current value of the variable to EEPROM.
/// Save the current value of the variable to EEPROM.
///
///
/// @return True if the variable was saved successfully.
/// @return True if the variable was saved successfully.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment