Jelajahi Sumber

连续10次小于2.9v,才校准容量到10%

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 tahun lalu
induk
melakukan
3f43fa56d5
1 mengubah file dengan 7 tambahan dan 1 penghapusan
  1. 7 1
      Application/app/sox/soc.c

+ 7 - 1
Application/app/sox/soc.c

@@ -269,6 +269,7 @@ static int _soc_force_capaticy(uint8_t capaticy){
 
 static int _soc_update_by_ocv(uint8_t prev_charge_status){
 	static int ocv_full_count = 0;
+	static int ocv_force_capaticy = 0;
 	int changed = 0;
 	if ((_soc.flags & SOC_FLAG_CALIBRATED) == 0){
 		return 0;
@@ -286,10 +287,15 @@ static int _soc_update_by_ocv(uint8_t prev_charge_status){
 			return 1;
 		}else if ((!prev_charge_status) && (bms_state_get()->cell_min_vol <= 2900) && (_soc.capacity > 10)) {
 			/* 如果单电芯最小电压小于2.9v,并且容量大于10%,需要校准到10% */
-			return _soc_force_capaticy(10);
+			if (ocv_force_capaticy++ >= 10) {
+				return _soc_force_capaticy(10);
+			}
+		}else {
+			ocv_force_capaticy = 0;
 		}
 	}
 	if (chargering || prev_charge_status) {
+		ocv_force_capaticy = 0;
 		/*
 		if (bms_state_get()->ps_charger_mask && !bms_state_get()->ps_charger_in) { //ps100 上报无充电器,不做处理
 			ocv_full_count = 0;