mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-08 19:31:36 +08:00
param_export: add optional filter method
This commit is contained in:
@@ -76,7 +76,7 @@ struct param_wbuf_s {
|
||||
};
|
||||
|
||||
static int
|
||||
param_export_internal(bool only_unsaved)
|
||||
param_export_internal(bool only_unsaved, param_filter_func filter)
|
||||
{
|
||||
struct param_wbuf_s *s = nullptr;
|
||||
struct bson_encoder_s encoder;
|
||||
@@ -105,6 +105,10 @@ param_export_internal(bool only_unsaved)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filter && !filter(s->param)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
s->unsaved = false;
|
||||
|
||||
/* append the appropriate BSON type object */
|
||||
@@ -345,9 +349,9 @@ out:
|
||||
return result;
|
||||
}
|
||||
|
||||
int flash_param_save(bool only_unsaved)
|
||||
int flash_param_save(bool only_unsaved, param_filter_func filter)
|
||||
{
|
||||
return param_export_internal(only_unsaved);
|
||||
return param_export_internal(only_unsaved, filter);
|
||||
}
|
||||
|
||||
int flash_param_load()
|
||||
|
||||
Reference in New Issue
Block a user