From 9e219fba0c80b39e0ceefb21cbeb6f9e5871e458 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Thu, 2 Feb 2017 20:55:40 +1100 Subject: [PATCH] events: make required temp rise for calibration adjustable --- src/modules/events/temperature_accel_calibration.cpp | 10 +++++++--- src/modules/events/temperature_baro_calibration.cpp | 10 +++++++--- src/modules/events/temperature_gyro_calibration.cpp | 9 ++++++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/modules/events/temperature_accel_calibration.cpp b/src/modules/events/temperature_accel_calibration.cpp index d3f02af277..2a6f25efc8 100644 --- a/src/modules/events/temperature_accel_calibration.cpp +++ b/src/modules/events/temperature_accel_calibration.cpp @@ -206,6 +206,10 @@ void Tempcalaccel::task_main() } } + // get required temperature swing + int32_t min_temp_rise = 24; + param_get(param_find("SYS_CAL_TEMP"), &min_temp_rise); + while (!_force_task_exit) { int ret = px4_poll(fds, num_accel, 1000); @@ -237,7 +241,7 @@ void Tempcalaccel::task_main() if (!cold_soaked[uorb_index]) { cold_soaked[uorb_index] = true; low_temp[uorb_index] = accel_sample_filt[uorb_index][3]; //Record the low temperature - ref_temp[uorb_index] = accel_sample_filt[uorb_index][3] + 12.0f; + ref_temp[uorb_index] = accel_sample_filt[uorb_index][3] + 0.5f * (float)min_temp_rise; } num_samples[uorb_index]++; @@ -257,8 +261,8 @@ void Tempcalaccel::task_main() continue; } - //TODO: Hot Soak Saturation - if (hot_soak_sat[sensor_index] == 10 || (high_temp[sensor_index] - low_temp[sensor_index]) > 24.0f) { + //TODO: Detect when temperature has stopped rising for more than TBD seconds + if (hot_soak_sat[sensor_index] == 10 || (high_temp[sensor_index] - low_temp[sensor_index]) > float(min_temp_rise)) { hot_soaked[sensor_index] = true; } diff --git a/src/modules/events/temperature_baro_calibration.cpp b/src/modules/events/temperature_baro_calibration.cpp index cbb2d798c0..14545b43d3 100644 --- a/src/modules/events/temperature_baro_calibration.cpp +++ b/src/modules/events/temperature_baro_calibration.cpp @@ -172,6 +172,10 @@ void Tempcalbaro::task_main() char param_str[30]; int num_completed = 0; // number of completed sensors + // get required temperature swing + int32_t min_temp_rise = 24; + param_get(param_find("SYS_CAL_TEMP"), &min_temp_rise); + while (!_force_task_exit) { int ret = px4_poll(fds, num_baro, 1000); @@ -201,7 +205,7 @@ void Tempcalbaro::task_main() if (!cold_soaked[uorb_index]) { cold_soaked[uorb_index] = true; low_temp[uorb_index] = baro_sample_filt[uorb_index][1]; //Record the low temperature - ref_temp[uorb_index] = baro_sample_filt[uorb_index][1] + 12.0f; + ref_temp[uorb_index] = baro_sample_filt[uorb_index][1] + 0.5f * (float)min_temp_rise; } num_samples[uorb_index]++; @@ -221,8 +225,8 @@ void Tempcalbaro::task_main() continue; } - //TODO: Hot Soak Saturation - if (hot_soak_sat[sensor_index] == 10 || (high_temp[sensor_index] - low_temp[sensor_index]) > 24.0f) { + //TODO: Detect when temperature has stopped rising for more than TBD seconds + if (hot_soak_sat[sensor_index] == 10 || (high_temp[sensor_index] - low_temp[sensor_index]) > (float)min_temp_rise) { hot_soaked[sensor_index] = true; } diff --git a/src/modules/events/temperature_gyro_calibration.cpp b/src/modules/events/temperature_gyro_calibration.cpp index 507eeb3809..ef6fbfaa56 100644 --- a/src/modules/events/temperature_gyro_calibration.cpp +++ b/src/modules/events/temperature_gyro_calibration.cpp @@ -205,6 +205,9 @@ void Tempcalgyro::task_main() } } + int32_t min_temp_rise = 24; + param_get(param_find("SYS_CAL_TEMP"), &min_temp_rise); + while (!_force_task_exit) { int ret = px4_poll(fds, num_gyro, 1000); @@ -236,7 +239,7 @@ void Tempcalgyro::task_main() if (!cold_soaked[uorb_index]) { cold_soaked[uorb_index] = true; low_temp[uorb_index] = gyro_sample_filt[uorb_index][3]; //Record the low temperature - ref_temp[uorb_index] = gyro_sample_filt[uorb_index][3] + 12.0f; + ref_temp[uorb_index] = gyro_sample_filt[uorb_index][3] + 0.5f * (float)min_temp_rise; } num_samples[uorb_index]++; @@ -256,8 +259,8 @@ void Tempcalgyro::task_main() continue; } - //TODO: Hot Soak Saturation - if (hot_soak_sat[sensor_index] == 10 || (high_temp[sensor_index] - low_temp[sensor_index]) > 24.0f) { + //TODO: Detect when temperature has stopped rising for more than TBD seconds + if (hot_soak_sat[sensor_index] == 10 || (high_temp[sensor_index] - low_temp[sensor_index]) > (float)min_temp_rise) { hot_soaked[sensor_index] = true; }