fix(parameters): migrate SENS_IMU_TEMP* and SENS_TEMP_ID to HEATER1_* (#29354)

The multi-instance heater driver (#26325) replaced the single heater's
SENS_IMU_TEMP, SENS_IMU_TEMP_FF/_I/_P and SENS_TEMP_ID with HEATER<n>_*
parameters without a translation, so values stored by v1.17 are dropped
on upgrade and the heater runs with the defaults.

The controller is unchanged, so the values carry over to heater 1 as they
are. SENS_TEMP_ID 0 kept the heater from starting, while HEATER1_SENS_ID 0
selects a sensor automatically, so 0 becomes -1 (disabled).

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: A.Burak Tektas <15087318+Abtektas@users.noreply.github.com>
This commit is contained in:
Ahmet Burak Tektas authored and GitHub committed 2026-10-20 16:42:55 -06:00
1 parent e3229f9645
commit b8b689dec2
1 file changed
+29
+29
View File
@@ -270,6 +270,35 @@ param_modify_on_import_ret param_modify_on_import(bson_node_t node)
}
}
// 2026-10-20: the single heater's SENS_* parameters became those of heater instance 1
{
static constexpr const char *kRenames[][2] {
{"SENS_IMU_TEMP", "HEATER1_TEMP"},
{"SENS_IMU_TEMP_FF", "HEATER1_TEMP_FF"},
{"SENS_IMU_TEMP_I", "HEATER1_TEMP_I"},
{"SENS_IMU_TEMP_P", "HEATER1_TEMP_P"},
};
for (const auto &rename : kRenames) {
if (strcmp(rename[0], node->name) == 0) {
strcpy(node->name, rename[1]);
PX4_INFO("migrating %s -> %s", rename[0], rename[1]);
return param_modify_on_import_ret::PARAM_MODIFIED;
}
}
// SENS_TEMP_ID 0 kept the heater from starting, while HEATER1_SENS_ID 0 selects a sensor and -1 disables it
if ((node->type == bson_type_t::BSON_INT32) && (strcmp("SENS_TEMP_ID", node->name) == 0)) {
if (node->i32 == 0) {
node->i32 = -1;
}
strcpy(node->name, "HEATER1_SENS_ID");
PX4_INFO("migrating %s -> %s", "SENS_TEMP_ID", "HEATER1_SENS_ID");
return param_modify_on_import_ret::PARAM_MODIFIED;
}
}
// 2026-06-29: MPC_LAND_RC_HELP replaced by the MPC_AUTO_NUDGING bitmask (landing nudging = bit 1).
// The old in-Hold yaw nudge is not migrated; it now lives in bit 0 (yaw nudging in all auto modes).
{