mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-08 19:31:36 +08:00
parameters use bitset for mark_unsaved
This commit is contained in:
@@ -72,11 +72,10 @@
|
||||
struct param_wbuf_s {
|
||||
union param_value_u val;
|
||||
param_t param;
|
||||
bool unsaved;
|
||||
};
|
||||
|
||||
static int
|
||||
param_export_internal(bool only_unsaved, param_filter_func filter)
|
||||
param_export_internal(param_filter_func filter)
|
||||
{
|
||||
struct param_wbuf_s *s = nullptr;
|
||||
bson_encoder_s encoder{};
|
||||
@@ -97,20 +96,10 @@ param_export_internal(bool only_unsaved, param_filter_func filter)
|
||||
int32_t i;
|
||||
float f;
|
||||
|
||||
/*
|
||||
* If we are only saving values changed since last save, and this
|
||||
* one hasn't, then skip it
|
||||
*/
|
||||
if (only_unsaved && !s->unsaved) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filter && !filter(s->param)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
s->unsaved = false;
|
||||
|
||||
/* append the appropriate BSON type object */
|
||||
|
||||
switch (param_type(s->param)) {
|
||||
@@ -310,9 +299,9 @@ out:
|
||||
return result;
|
||||
}
|
||||
|
||||
int flash_param_save(bool only_unsaved, param_filter_func filter)
|
||||
int flash_param_save(param_filter_func filter)
|
||||
{
|
||||
return param_export_internal(only_unsaved, filter);
|
||||
return param_export_internal(filter);
|
||||
}
|
||||
|
||||
int flash_param_load()
|
||||
|
||||
Reference in New Issue
Block a user