Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

param import: don't fail on type mismatch #7659

Merged
merged 4 commits into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/configs/nuttx_px4fmu-v1_default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set(config_module_list
#drivers/ll40ls
drivers/trone
drivers/gps
drivers/pwm_out_sim
#drivers/pwm_out_sim
#drivers/hott
#drivers/hott/hott_telemetry
#drivers/hott/hott_sensors
Expand Down
12 changes: 8 additions & 4 deletions src/modules/systemlib/flashparams/flashparams.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)
switch (node->type) {
case BSON_INT32:
if (param_type(param) != PARAM_TYPE_INT32) {
debug("unexpected type for '%s", node->name);
PX4_WARN("unexpected type for %s", node->name);
result = 1; // just skip this entry
goto out;
}

Expand All @@ -241,7 +242,8 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)

case BSON_DOUBLE:
if (param_type(param) != PARAM_TYPE_FLOAT) {
debug("unexpected type for '%s", node->name);
PX4_WARN("unexpected type for %s", node->name);
result = 1; // just skip this entry
goto out;
}

Expand All @@ -251,12 +253,14 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)

case BSON_BINDATA:
if (node->subtype != BSON_BIN_BINARY) {
debug("unexpected subtype for '%s", node->name);
PX4_WARN("unexpected type for %s", node->name);
result = 1; // just skip this entry
goto out;
}

if (bson_decoder_data_pending(decoder) != param_size(param)) {
debug("bad size for '%s'", node->name);
PX4_WARN("bad size for '%s'", node->name);
result = 1; // just skip this entry
goto out;
}

Expand Down
12 changes: 8 additions & 4 deletions src/modules/systemlib/param/param.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,8 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)
switch (node->type) {
case BSON_INT32:
if (param_type(param) != PARAM_TYPE_INT32) {
debug("unexpected type for '%s", node->name);
PX4_WARN("unexpected type for %s", node->name);
result = 1; // just skip this entry
goto out;
}

Expand All @@ -1147,7 +1148,8 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)

case BSON_DOUBLE:
if (param_type(param) != PARAM_TYPE_FLOAT) {
debug("unexpected type for '%s", node->name);
PX4_WARN("unexpected type for %s", node->name);
result = 1; // just skip this entry
goto out;
}

Expand All @@ -1157,12 +1159,14 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)

case BSON_BINDATA:
if (node->subtype != BSON_BIN_BINARY) {
debug("unexpected subtype for '%s", node->name);
PX4_WARN("unexpected subtype for %s", node->name);
result = 1; // just skip this entry
goto out;
}

if (bson_decoder_data_pending(decoder) != param_size(param)) {
debug("bad size for '%s'", node->name);
PX4_WARN("bad size for '%s'", node->name);
result = 1; // just skip this entry
goto out;
}

Expand Down
12 changes: 8 additions & 4 deletions src/modules/systemlib/param/param_shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,8 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)
switch (node->type) {
case BSON_INT32:
if (param_type(param) != PARAM_TYPE_INT32) {
PX4_DEBUG("unexpected type for '%s", node->name);
PX4_WARN("unexpected type for %s", node->name);
result = 1; // just skip this entry
goto out;
}

Expand All @@ -1181,7 +1182,8 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)

case BSON_DOUBLE:
if (param_type(param) != PARAM_TYPE_FLOAT) {
PX4_DEBUG("unexpected type for '%s", node->name);
PX4_WARN("unexpected type for %s", node->name);
result = 1; // just skip this entry
goto out;
}

Expand All @@ -1192,12 +1194,14 @@ param_import_callback(bson_decoder_t decoder, void *private, bson_node_t node)

case BSON_BINDATA:
if (node->subtype != BSON_BIN_BINARY) {
PX4_DEBUG("unexpected subtype for '%s", node->name);
PX4_WARN("unexpected type for %s", node->name);
result = 1; // just skip this entry
goto out;
}

if (bson_decoder_data_pending(decoder) != param_size(param)) {
PX4_DEBUG("bad size for '%s'", node->name);
PX4_WARN("bad size for '%s'", node->name);
result = 1; // just skip this entry
goto out;
}

Expand Down