mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-21 11:47:34 +08:00
added unit test directive to switch out parameter storage
This commit is contained in:
committed by
Lorenz Meier
parent
13039f9e69
commit
5cccc01cd4
@@ -70,9 +70,16 @@
|
||||
/**
|
||||
* Array of static parameter info.
|
||||
*/
|
||||
struct param_info_s param_array[2];
|
||||
static const struct param_info_s *param_info_base = (struct param_info_s *) ¶m_array[0];
|
||||
static const struct param_info_s *param_info_limit = (struct param_info_s *) ¶m_array[1];
|
||||
#ifdef _UNIT_TEST
|
||||
extern struct param_info_s param_array[];
|
||||
extern struct param_info_s *param_info_base;
|
||||
extern struct param_info_s *param_info_limit;
|
||||
#else
|
||||
extern char __param_start, __param_end;
|
||||
static const struct param_info_s *param_info_base = (struct param_info_s *) &__param_start;
|
||||
static const struct param_info_s *param_info_limit = (struct param_info_s *) &__param_end;
|
||||
#endif
|
||||
|
||||
#define param_info_count ((unsigned)(param_info_limit - param_info_base))
|
||||
|
||||
/**
|
||||
@@ -200,14 +207,10 @@ param_notify_changes(void)
|
||||
param_t
|
||||
param_find(const char *name)
|
||||
{
|
||||
warn("debug info count %i\n", param_count());
|
||||
//warn("start: %i\n", __param_start);
|
||||
|
||||
param_t param;
|
||||
|
||||
/* perform a linear search of the known parameters */
|
||||
for (param = 0; handle_in_range(param); param++) {
|
||||
warn("param find: %s", param_info_base[param].name);
|
||||
if (!strcmp(param_info_base[param].name, name))
|
||||
return param;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user