Commit 5d20e161 authored by Wenxi XU's avatar Wenxi XU
Browse files

添加IMU传感器触发初始化的错误处理,确保在未启用PWM温控时记录错误信息并返回。

parent 52a4ef5f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -306,7 +306,12 @@ static struct sensor_trigger gyro_trig = {

void IMU_Sensor_trig_init(const struct device *accel_dev, const struct device *gyro_dev)
{
#ifdef CONFIG_IMU_PWM_TEMP_CTRL
	if (!IS_ENABLED(CONFIG_IMU_PWM_TEMP_CTRL)) {
		LOG_ERR("IMU PWM TEMP CTRL is not enabled");
		return;
	}

#if CONFIG_IMU_PWM_TEMP_CTRL
	pwm_set_pulse_dt(&pwm, 20000000);

	pid_reg_input(temp_pwm_pid, &current_temp, &target_temp);