diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 737410027f..636281e117 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -321,6 +321,7 @@ private: int32_t _rssi_pwm_chan; ///< RSSI PWM input channel int32_t _rssi_pwm_max; ///< max RSSI input on PWM channel int32_t _rssi_pwm_min; ///< min RSSI input on PWM channel + int32_t _thermal_control; ///< thermal control state bool _analog_rc_rssi_stable; ///< true when analog RSSI input is stable float _analog_rc_rssi_volt; ///< analog RSSI voltage @@ -558,6 +559,7 @@ PX4IO::PX4IO(device::Device *interface) : _rssi_pwm_chan(0), _rssi_pwm_max(0), _rssi_pwm_min(0), + _thermal_control(-1), _analog_rc_rssi_stable(false), _analog_rc_rssi_volt(-1.0f), _last_throttle(0.0f), @@ -1157,6 +1159,30 @@ PX4IO::task_main() param_get(param_find("RC_RSSI_PWM_MAX"), &_rssi_pwm_max); param_get(param_find("RC_RSSI_PWM_MIN"), &_rssi_pwm_min); + param_t thermal_param = param_find("SENS_EN_THERMAL"); + + if (thermal_param != PARAM_INVALID) { + + int32_t thermal_p; + param_get(thermal_param, &thermal_p); + + if (thermal_p != _thermal_control || _param_update_force) { + + _thermal_control = thermal_p; + /* set power management state for thermal */ + uint16_t tctrl; + + if (_thermal_control < 0) { + tctrl = PX4IO_THERMAL_IGNORE; + + } else { + tctrl = PX4IO_THERMAL_OFF; + } + + ret = io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_THERMAL, tctrl); + } + } + /* * Set invert mask for PWM outputs (does not apply to S.Bus) */