mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 22:58:10 +08:00
parameters: export empty BSON document even if there are no parameters to save
- otherwise a 'param reset_all' won't be saved until a parameter is changed
This commit is contained in:
@@ -1371,11 +1371,6 @@ static int param_verify(int fd)
|
||||
int
|
||||
param_export(int fd, param_filter_func filter)
|
||||
{
|
||||
/* no modified parameters -> we are done */
|
||||
if (param_values == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int result = -1;
|
||||
perf_begin(param_export_perf);
|
||||
|
||||
@@ -1410,6 +1405,12 @@ param_export(int fd, param_filter_func filter)
|
||||
goto out;
|
||||
}
|
||||
|
||||
// no modified parameters, export empty BSON document
|
||||
if (param_values == nullptr) {
|
||||
result = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
while ((s = (struct param_wbuf_s *)utarray_next(param_values, s)) != nullptr) {
|
||||
if (filter && !filter(s->param)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user