Преглед на файлове

软件120A放电过流保护

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui преди 5 години
родител
ревизия
7872f03c97
променени са 2 файла, в които са добавени 8 реда и са изтрити 0 реда
  1. 7 0
      Application/app/sox/health.c
  2. 1 0
      Application/app/sox/health.h

+ 7 - 0
Application/app/sox/health.c

@@ -148,6 +148,13 @@ void check_current_state(void){
 			shark_timer_post(&_charger_detect_timer._timer, _charger_detect_timer.interval);
 			shark_timer_post(&_charger_detect_timer._timer, _charger_detect_timer.interval);
 		}
 		}
 	}
 	}
+	if (!bms_state_get()->charging){
+		if (!_health.load_current_short && (abs(measure_value()->load_current) >= MAX_CURRENT_FOR_DISCHARGER)){
+			_health.load_current_short = 1;
+			ml5238_enable_load_detect(1); //打开负载检测
+			shark_timer_post(&_load_detect_timer._timer, _load_detect_timer.interval);
+		}
+	}
 }
 }
 
 
 /* 检测pack电压,cell电压,pack电压过低触发powerdown*/
 /* 检测pack电压,cell电压,pack电压过低触发powerdown*/

+ 1 - 0
Application/app/sox/health.h

@@ -5,6 +5,7 @@
 
 
 #define MAX_CURRENT_FOR_CHARGER (30*1000) //最大充电电流20A
 #define MAX_CURRENT_FOR_CHARGER (30*1000) //最大充电电流20A
 #define SIGLE_CELL_MAX_CHARGER_VOLTAGE (3800)//最大允许充电电压,3.9v,考虑到采样的误差取 3.88
 #define SIGLE_CELL_MAX_CHARGER_VOLTAGE (3800)//最大允许充电电压,3.9v,考虑到采样的误差取 3.88
+#define MAX_CURRENT_FOR_DISCHARGER (120 * 1000) //软件采样的电流保护
 /* 
 /* 
  * xxx_over_temp: 表示过高温(温度过高)
  * xxx_over_temp: 表示过高温(温度过高)
  * xxx_under_temp: 表示过低温(温度过低)
  * xxx_under_temp: 表示过低温(温度过低)