From 45c72eb4420b10028114f3a97becd5ffde90a470 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 15 Jun 2016 18:28:18 +1000 Subject: [PATCH] AP_BoardConfig: added BRD_IMU_TARGTEMP set target temperature for IMU --- libraries/AP_BoardConfig/AP_BoardConfig.cpp | 16 +++++++++++++++- libraries/AP_BoardConfig/AP_BoardConfig.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.cpp b/libraries/AP_BoardConfig/AP_BoardConfig.cpp index 733a8e9e92..9787bcfaab 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.cpp +++ b/libraries/AP_BoardConfig/AP_BoardConfig.cpp @@ -101,6 +101,15 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] = { // @Values: 0:Disabled,1:Enabled AP_GROUPINFO("CAN_ENABLE", 6, AP_BoardConfig, _can_enable, 0), #endif + +#if HAL_HAVE_IMU_HEATER + // @Param: IMU_TARGTEMP + // @DisplayName: Target IMU temperature + // @Description: This sets the target IMU temperature for boards with controllable IMU heating units. A value of -1 disables heating. + // @Range: -1 80 + // @Units: degreesC + AP_GROUPINFO("IMU_TARGTEMP", 7, AP_BoardConfig, _imu_target_temperature, HAL_IMU_TEMP_DEFAULT), +#endif #if CONFIG_HAL_BOARD == HAL_BOARD_PX4 // @Param: SAFETY_MASK @@ -246,5 +255,10 @@ void AP_BoardConfig::init() #elif CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN /* configure the VRBRAIN driver for the right number of PWMs */ -#endif +#endif + + // let the HAL know the target temperature. We pass a pointer as + // we want the user to be able to change the parameter without + // rebooting + hal.util->set_imu_target_temp((int8_t *)&_imu_target_temperature); } diff --git a/libraries/AP_BoardConfig/AP_BoardConfig.h b/libraries/AP_BoardConfig/AP_BoardConfig.h index 9fec0bcc63..69ac6e5f5f 100644 --- a/libraries/AP_BoardConfig/AP_BoardConfig.h +++ b/libraries/AP_BoardConfig/AP_BoardConfig.h @@ -35,4 +35,7 @@ private: #if CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN #endif + + // target temperarure for IMU in Celsius, or -1 to disable + AP_Int8 _imu_target_temperature; };