From b8b689dec25ab48e797ac3095d6c811e093cf985 Mon Sep 17 00:00:00 2001 From: Ahmet Burak Tektas <15087318+Abtektas@users.noreply.github.com> Date: Wed, 21 Oct 2026 00:42:55 +0200 Subject: [PATCH] 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_* 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> --- src/lib/parameters/param_translation.cpp | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/lib/parameters/param_translation.cpp b/src/lib/parameters/param_translation.cpp index 598dc204b47..3f48bb03f12 100644 --- a/src/lib/parameters/param_translation.cpp +++ b/src/lib/parameters/param_translation.cpp @@ -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). {