param translation: remove old param translations (more than 1 release back)

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2022-11-24 09:47:59 +01:00
parent 3f773809c4
commit bd176241f8
-86
View File
@@ -42,92 +42,6 @@
bool param_modify_on_import(bson_node_t node)
{
// migrate MPC_SPOOLUP_TIME -> COM_SPOOLUP_TIME (2020-12-03). This can be removed after the next release (current release=1.11)
if (node->type == BSON_DOUBLE) {
if (strcmp("MPC_SPOOLUP_TIME", node->name) == 0) {
strcpy(node->name, "COM_SPOOLUP_TIME");
PX4_INFO("param migrating MPC_SPOOLUP_TIME (removed) -> COM_SPOOLUP_TIME: value=%.3f", node->d);
return true;
}
}
// 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->i32;
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->i32 = old_param.struct_value.authorizer_system_id;
PX4_INFO("migrating COM_ARM_AUTH: %" PRId32 " -> COM_ARM_AUTH_ID:%" PRId8 ", COM_ARM_AUTH_MET: %" PRId32
" and COM_ARM_AUTH_TO: %f",
old_param.param_value,
old_param.struct_value.authorizer_system_id,
method,
(double)timeout);
}
}
// 2021-08-27: translate LED_RGB_MAXBRT (0-15) to SYS_RGB_MAXBRT(0.f-1.f)
if (node->type == BSON_INT32) {
if (strcmp("LED_RGB_MAXBRT", node->name) == 0) {
// convert integer (0-15) to float percentage
node->d = math::constrain(static_cast<double>(node->i32) / 15., 0., 1.);
node->type = BSON_DOUBLE;
strcpy(node->name, "SYS_RGB_MAXBRT");
PX4_INFO("param migrating LED_RGB_MAXBRT (removed) -> SYS_RGB_MAXBRT: value=%.3f", node->d);
return true;
}
}
// 2020-08-23 (v1.12 alpha): translate GPS blending parameters from EKF2 -> SENS
{
if (strcmp("EKF2_GPS_MASK", node->name) == 0) {
strcpy(node->name, "SENS_GPS_MASK");
PX4_INFO("copying %s -> %s", "EKF2_GPS_MASK", "SENS_GPS_MASK");
return true;
}
if (strcmp("EKF2_GPS_TAU", node->name) == 0) {
strcpy(node->name, "SENS_GPS_TAU");
PX4_INFO("copying %s -> %s", "EKF2_GPS_TAU", "SENS_GPS_TAU");
return true;
}
}
// 2021-04-30: translate ASPD_STALL to FW_AIRSPD_STALL
{
if (strcmp("ASPD_STALL", node->name) == 0) {
strcpy(node->name, "FW_AIRSPD_STALL");
PX4_INFO("copying %s -> %s", "ASPD_STALL", "FW_AIRSPD_STALL");
return true;
}
}
// 2021-07-12: translate VT_DWN_PITCH_MAX to VT_PITCH_MIN
{
if (strcmp("VT_DWN_PITCH_MAX", node->name) == 0) {
strcpy(node->name, "VT_PITCH_MIN");
node->d *= -1;
PX4_INFO("copying and inverting sign %s -> %s", "VT_DWN_PITCH_MAX", "VT_PITCH_MIN");
return true;
}
}
// 2022-04-11: translate VT_PTCH_MIN to VT_PITCH_MIN
{
if (strcmp("VT_PTCH_MIN", node->name) == 0) {