Просмотр исходного кода

温度采集不适用滤波

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 2 лет назад
Родитель
Сommit
ae9c24b9f5

+ 2 - 2
Applications/foc/limit.c

@@ -90,7 +90,7 @@ static u16 _vol_limiter(s16 vol, limter_t *lim) {
 }
 }
 
 
 static u16 _motor_limit(void) {
 static u16 _motor_limit(void) {
-	s16 temp = get_motor_temp();
+	s16 temp = get_motor_temp_raw();
 	for(int i = 0; i < ARRAY_SIZE(motor_temp_lim); i++) {
 	for(int i = 0; i < ARRAY_SIZE(motor_temp_lim); i++) {
 		limter_t *lim = motor_temp_lim + i;
 		limter_t *lim = motor_temp_lim + i;
 		u16 lim_value = _temp_limiter(temp, lim);
 		u16 lim_value = _temp_limiter(temp, lim);
@@ -132,7 +132,7 @@ static u16 _motor_limit(void) {
 }
 }
 
 
 static u16 _mos_limit(void) {
 static u16 _mos_limit(void) {
-	s16 temp = get_mos_temp();
+	s16 temp = get_mos_temp_raw();
 	for(int i = 0; i < ARRAY_SIZE(mos_temp_lim); i++) {
 	for(int i = 0; i < ARRAY_SIZE(mos_temp_lim); i++) {
 		limter_t *lim = mos_temp_lim + i;
 		limter_t *lim = mos_temp_lim + i;
 		u16 lim_value = _temp_limiter(temp, lim);
 		u16 lim_value = _temp_limiter(temp, lim);

+ 4 - 4
Applications/foc/motor/motor.c

@@ -407,14 +407,14 @@ bool mc_stop(void) {
 
 
 void mc_set_mos_lim_level(u8 l) {
 void mc_set_mos_lim_level(u8 l) {
 	if (motor.mos_lim != l) {
 	if (motor.mos_lim != l) {
-		mc_crit_err_add(FOC_EV_MOS_Limit_L, l, get_mos_temp());
+		mc_crit_err_add(FOC_EV_MOS_Limit_L, l, get_mos_temp_raw());
 	}
 	}
 	motor.mos_lim = l;
 	motor.mos_lim = l;
 }
 }
 
 
 void mc_set_motor_lim_level(u8 l) {
 void mc_set_motor_lim_level(u8 l) {
 	if (motor.motor_lim != l) {
 	if (motor.motor_lim != l) {
-		mc_crit_err_add(FOC_EV_MOT_Limit_L, l, get_motor_temp());
+		mc_crit_err_add(FOC_EV_MOT_Limit_L, l, get_motor_temp_raw());
 	}
 	}
 	motor.motor_lim = l;
 	motor.motor_lim = l;
 }
 }
@@ -1063,8 +1063,8 @@ static void mc_save_err_runtime(void) {
 	mc_error.rpm = (s16)motor_encoder_get_speed();
 	mc_error.rpm = (s16)motor_encoder_get_speed();
 	mc_error.b_sensorless = !foc_observer_is_encoder();
 	mc_error.b_sensorless = !foc_observer_is_encoder();
 	mc_error.b_sensorless_stable = foc_observer_sensorless_stable();
 	mc_error.b_sensorless_stable = foc_observer_sensorless_stable();
-	mc_error.mos_temp = get_mos_temp();
-	mc_error.mot_temp = get_motor_temp();
+	mc_error.mos_temp = get_mos_temp_raw();
+	mc_error.mot_temp = get_motor_temp_raw();
 	mc_error.enc_error = motor_encoder_may_error();
 	mc_error.enc_error = motor_encoder_may_error();
 	mc_error.sensorless_rpm = (s16)foc_observer_sensorless_speed();
 	mc_error.sensorless_rpm = (s16)foc_observer_sensorless_speed();
 
 

+ 8 - 0
Applications/foc/samples.c

@@ -129,6 +129,14 @@ s16 get_mos_temp(void) {
 	return mos_temp.filted_value;
 	return mos_temp.filted_value;
 }
 }
 
 
+s16 get_motor_temp_raw(void) {
+	return motor_temp.value;
+}
+
+s16 get_mos_temp_raw(void) {
+	return mos_temp.value;
+}
+
 float get_throttle_float(void) {
 float get_throttle_float(void) {
 #ifdef THROTTLE_CHAN
 #ifdef THROTTLE_CHAN
 	return _throttle[0].filted_value;
 	return _throttle[0].filted_value;

+ 2 - 3
Applications/foc/samples.h

@@ -14,10 +14,9 @@ void sample_throttle(void);
 void sample_motor_temp(void);
 void sample_motor_temp(void);
 void sample_mos_temp(void);
 void sample_mos_temp(void);
 void sample_vref(void);
 void sample_vref(void);
-s16 get_motor_temp(void);
-s16 get_mos_temp(void);
+s16 get_motor_temp_raw(void);
+s16 get_mos_temp_raw(void);
 int get_acc_vol(void);
 int get_acc_vol(void);
-s16 get_mos_temp2(void);
 float get_vbus_current(void);
 float get_vbus_current(void);
 void sample_ibus_offset(u16 offset);
 void sample_ibus_offset(u16 offset);
 float get_adc_vref(void);
 float get_adc_vref(void);

+ 2 - 2
Applications/prot/can_foc_msg.c

@@ -86,8 +86,8 @@ void can_report_foc_status(u8 can) {
 	mc_get_running_status(data+2);
 	mc_get_running_status(data+2);
 	u32 errMask = mc_get_critical_error();
 	u32 errMask = mc_get_critical_error();
 	encode_u32(data + 3, errMask);
 	encode_u32(data + 3, errMask);
-	encode_s16(data + 7, get_motor_temp());
-	encode_s16(data + 9, get_mos_temp());
+	encode_s16(data + 7, get_motor_temp_raw());
+	encode_s16(data + 9, get_mos_temp_raw());
 	encode_u24(data + 11, shark_get_seconds());
 	encode_u24(data + 11, shark_get_seconds());
 	encode_u8(data + 14, mc_get_gear());
 	encode_u8(data + 14, mc_get_gear());
 	encode_u8(data + 15, mc_params()->mos_lim | (mc_params()->motor_lim<<4));
 	encode_u8(data + 15, mc_params()->mos_lim | (mc_params()->motor_lim<<4));