Browse Source

arm auth: add parameters migration

should be reverted in v1.13
release/1.12
Nicolas Martin 4 years ago committed by Beat Küng
parent
commit
1965cd38ba
  1. 30
      src/lib/parameters/param_translation.cpp

30
src/lib/parameters/param_translation.cpp

@ -41,6 +41,36 @@ @@ -41,6 +41,36 @@
bool param_modify_on_import(bson_node_t node)
{
// migrate COM_ARM_AUTH -> COM_ARM_AUTH_ID, COM_ARM_AUTH_MET and COM_ARM_AUTH_TO (2020-11-06). This can be removed after the next release (current release=1.11)
if (node->type == BSON_INT32) {
if (strcmp("COM_ARM_AUTH", node->name) == 0) {
union {
struct {
uint8_t authorizer_system_id;
uint16_t auth_method_arm_timeout_msec;
uint8_t authentication_method;
} __attribute__((packed)) struct_value;
int32_t param_value;
} old_param;
old_param.param_value = node->i;
int32_t method = old_param.struct_value.authentication_method;
param_set_no_notification(param_find("COM_ARM_AUTH_MET"), &method);
float timeout = old_param.struct_value.auth_method_arm_timeout_msec / 1000.f;
param_set_no_notification(param_find("COM_ARM_AUTH_TO"), &timeout);
strcpy(node->name, "COM_ARM_AUTH_ID");
node->i = old_param.struct_value.authorizer_system_id;
PX4_INFO("migrating COM_ARM_AUTH: %d -> COM_ARM_AUTH_ID:%d, COM_ARM_AUTH_MET: %d and COM_ARM_AUTH_TO: %f",
old_param.param_value,
old_param.struct_value.authorizer_system_id,
method,
(double)timeout);
}
}
// migrate MPC_*_VEL_* -> MPC_*_VEL_*_ACC (2020-04-27). This can be removed after the next release (current release=1.10)
if (node->type == BSON_DOUBLE) {
param_migrate_velocity_gain(node, "MPC_XY_VEL_P");

Loading…
Cancel
Save