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

电池工作温度判断不要判断PCB的温度,主要是电芯的温度

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 лет назад
Родитель
Сommit
734f93b148
1 измененных файлов с 14 добавлено и 14 удалено
  1. 14 14
      Application/app/sox/health.c

+ 14 - 14
Application/app/sox/health.c

@@ -23,7 +23,7 @@ static int8_t discharger_normal_low_temp[PACK_TEMPS_NUM] = {-20,-20,-20,-25};//
 static int8_t discharger_normal_high_temp[PACK_TEMPS_NUM] = {50,50,50,55};//正常的放电最高温度
 static int8_t discharger_normal_high_temp[PACK_TEMPS_NUM] = {50,50,50,55};//正常的放电最高温度
 static int8_t discharger_lower_low_temp[PACK_TEMPS_NUM] = {-25,-25,-25,-30}; //需要停止放电的最低温度
 static int8_t discharger_lower_low_temp[PACK_TEMPS_NUM] = {-25,-25,-25,-30}; //需要停止放电的最低温度
 static int8_t discharger_higher_high_temp[PACK_TEMPS_NUM] = {55,55,55,60};//需要停止放电的最高温度
 static int8_t discharger_higher_high_temp[PACK_TEMPS_NUM] = {55,55,55,60};//需要停止放电的最高温度
-static int8_t work_lower_temp[PACK_TEMPS_NUM] = {0,0,0,5};
+static int8_t work_lower_temp[PACK_TEMPS_NUM] = {0,0,0}; //pcb温度不用判断
 /*定义低温和正常温度下的电池保护参数, [0]低温参数, [1]常温参数 */
 /*定义低温和正常温度下的电池保护参数, [0]低温参数, [1]常温参数 */
 /*能提供动力的最小电压*/
 /*能提供动力的最小电压*/
 static float min_discharger_power_vol[] = {32000, 38000}; //允许能提供动力的最小电压
 static float min_discharger_power_vol[] = {32000, 38000}; //允许能提供动力的最小电压
@@ -293,7 +293,7 @@ void check_voltage_state(void) {
 			if (judge_debounce(_health.discharger_cell_shutpower_voltage, &_shut_discharger_lower_voltage)){
 			if (judge_debounce(_health.discharger_cell_shutpower_voltage, &_shut_discharger_lower_voltage)){
 				_health.discharger_shutpower_voltage = 0;
 				_health.discharger_shutpower_voltage = 0;
 			}
 			}
-		}		
+		}
 	}	
 	}	
 
 
 	/* check for power down */
 	/* check for power down */
@@ -320,8 +320,8 @@ static debounce_t _discharger_lower_temp_count  = {.count = 0, .max_count = 8, .
 static debounce_t _discharger_normal_temp_count = {.count = 0, .max_count = 8, .init_count = 0};
 static debounce_t _discharger_normal_temp_count = {.count = 0, .max_count = 8, .init_count = 0};
 static debounce_t _work_lower_temp_count = 		{.count = 0, .max_count = 8, .init_count = 0};
 static debounce_t _work_lower_temp_count = 		{.count = 0, .max_count = 8, .init_count = 0};
 
 
-static int _is_over_temp(int8_t *temps){
-	for (int i = 0; i < PACK_TEMPS_NUM; i++){
+static int _is_over_temp(int8_t *temps, int size){
+	for (int i = 0; i < size; i++){
 		if (measure_value()->pack_temp[i] >= temps[i]){
 		if (measure_value()->pack_temp[i] >= temps[i]){
 			return 1;
 			return 1;
 		}
 		}
@@ -329,8 +329,8 @@ static int _is_over_temp(int8_t *temps){
 	return 0;
 	return 0;
 }
 }
 
 
-static int _is_low_temp(int8_t *temps){
-	for (int i = 0; i < PACK_TEMPS_NUM; i++){
+static int _is_low_temp(int8_t *temps, int size){
+	for (int i = 0; i < size; i++){
 		if (measure_value()->pack_temp[i] < temps[i]){
 		if (measure_value()->pack_temp[i] < temps[i]){
 			return 1;
 			return 1;
 		}
 		}
@@ -395,7 +395,7 @@ void health_process_aux_lock(void){
 
 
 void check_temp_state(void){
 void check_temp_state(void){
 	if (!_health.over_temp_deny_charger){
 	if (!_health.over_temp_deny_charger){
-		if (_is_over_temp(charger_higher_high_temp)) {//超过允许的最高温度
+		if (_is_over_temp(charger_higher_high_temp, sizeof(charger_higher_high_temp))) {//超过允许的最高温度
 			debounce_inc(_charger_over_temp_count);
 			debounce_inc(_charger_over_temp_count);
 		}else {
 		}else {
 			debounce_reset(_charger_over_temp_count);
 			debounce_reset(_charger_over_temp_count);
@@ -406,7 +406,7 @@ void check_temp_state(void){
 		}			
 		}			
 	}
 	}
 	if (!_health.lower_temp_deny_charger){
 	if (!_health.lower_temp_deny_charger){
-		if (_is_low_temp(charger_lower_low_temp)) {//低于允许的最低温度
+		if (_is_low_temp(charger_lower_low_temp, sizeof(charger_lower_low_temp))) {//低于允许的最低温度
 			debounce_inc(_charger_lower_temp_count);
 			debounce_inc(_charger_lower_temp_count);
 		}else {
 		}else {
 			debounce_reset(_charger_lower_temp_count);
 			debounce_reset(_charger_lower_temp_count);
@@ -417,7 +417,7 @@ void check_temp_state(void){
 		}
 		}
 	}
 	}
 	if (_health.lower_temp_deny_charger || _health.over_temp_deny_charger) {
 	if (_health.lower_temp_deny_charger || _health.over_temp_deny_charger) {
-		if (!_is_over_temp(charger_normal_high_temp) && !_is_low_temp(charger_normal_low_temp)){
+		if (!_is_over_temp(charger_normal_high_temp, sizeof(charger_normal_high_temp)) && !_is_low_temp(charger_normal_low_temp, sizeof(charger_normal_low_temp))){
 			debounce_inc(_charger_normal_temp_count);
 			debounce_inc(_charger_normal_temp_count);
 		}else {
 		}else {
 			debounce_reset(_charger_normal_temp_count);
 			debounce_reset(_charger_normal_temp_count);
@@ -430,7 +430,7 @@ void check_temp_state(void){
 	}
 	}
 
 
 	if (!_health.over_temp_deny_discharger){
 	if (!_health.over_temp_deny_discharger){
-		if (_is_over_temp(discharger_higher_high_temp)) {//超过允许的最高温度
+		if (_is_over_temp(discharger_higher_high_temp, sizeof(discharger_higher_high_temp))) {//超过允许的最高温度
 			debounce_inc(_discharger_over_temp_count);
 			debounce_inc(_discharger_over_temp_count);
 		}else {
 		}else {
 			debounce_reset(_discharger_over_temp_count);
 			debounce_reset(_discharger_over_temp_count);
@@ -442,7 +442,7 @@ void check_temp_state(void){
 	}
 	}
 	
 	
 	if (!_health.lower_temp_deny_discharger){
 	if (!_health.lower_temp_deny_discharger){
-		if (_is_low_temp(discharger_lower_low_temp)) {//低于允许的最低温度
+		if (_is_low_temp(discharger_lower_low_temp, sizeof(discharger_lower_low_temp))) {//低于允许的最低温度
 			debounce_inc(_discharger_lower_temp_count);
 			debounce_inc(_discharger_lower_temp_count);
 		}else {
 		}else {
 			debounce_reset(_discharger_lower_temp_count);
 			debounce_reset(_discharger_lower_temp_count);
@@ -453,7 +453,7 @@ void check_temp_state(void){
 		}
 		}
 	}
 	}
 	if (_health.lower_temp_deny_discharger || _health.over_temp_deny_discharger) {
 	if (_health.lower_temp_deny_discharger || _health.over_temp_deny_discharger) {
-		if (!_is_over_temp(discharger_normal_high_temp) && !_is_low_temp(discharger_normal_low_temp)){
+		if (!_is_over_temp(discharger_normal_high_temp, sizeof(discharger_lower_low_temp)) && !_is_low_temp(discharger_normal_low_temp, sizeof(discharger_normal_low_temp))){
 			debounce_inc(_discharger_normal_temp_count);
 			debounce_inc(_discharger_normal_temp_count);
 		}else {
 		}else {
 			debounce_reset(_discharger_normal_temp_count);
 			debounce_reset(_discharger_normal_temp_count);
@@ -465,7 +465,7 @@ void check_temp_state(void){
 		}	
 		}	
 	}
 	}
 	if (!_health.is_work_temp_normal){
 	if (!_health.is_work_temp_normal){
-		if (_is_over_temp(work_lower_temp)){
+		if (_is_over_temp(work_lower_temp, sizeof(work_lower_temp))){
 			debounce_inc(_work_lower_temp_count);
 			debounce_inc(_work_lower_temp_count);
 			if (debounce_reach_max(_work_lower_temp_count)){
 			if (debounce_reach_max(_work_lower_temp_count)){
 				_health.is_work_temp_normal = 1;
 				_health.is_work_temp_normal = 1;
@@ -475,7 +475,7 @@ void check_temp_state(void){
 			debounce_reset(_work_lower_temp_count);
 			debounce_reset(_work_lower_temp_count);
 		}
 		}
 	}else {
 	}else {
-		if (_is_low_temp(work_lower_temp)){
+		if (_is_low_temp(work_lower_temp, sizeof(work_lower_temp))){
 			debounce_inc(_work_lower_temp_count);
 			debounce_inc(_work_lower_temp_count);
 			if (debounce_reach_max(_work_lower_temp_count)){
 			if (debounce_reach_max(_work_lower_temp_count)){
 				_health.is_work_temp_normal = 0;
 				_health.is_work_temp_normal = 0;