Explorar o código

强制校准的条件多加一个连续1s都小于500mA

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui %!s(int64=5) %!d(string=hai) anos
pai
achega
36713ea1cf
Modificáronse 1 ficheiros con 8 adicións e 5 borrados
  1. 8 5
      Application/app/sox/soc.c

+ 8 - 5
Application/app/sox/soc.c

@@ -167,7 +167,7 @@ static __inline__ int can_modify_min_cap(void){
 }
 
 int soc_update_by_ocv(void){
-	
+	static int ocv_full_count = 0;
 	int changed = 0;
 	if (_soc.flags & SOC_FLAG_CALIBRATED){
 		if (!chargering){
@@ -187,10 +187,13 @@ int soc_update_by_ocv(void){
 		}
 		if (chargering && !is_force_full){
 			if (bms_state_get()->pack_voltage >= (FULL_MAX_VOLTAGE) && (measure_value()->load_current <= FULL_MIN_CURRENT)){
-				_soc.capacity = 100;
-				is_force_full = 1;
-				force_full_ts = shark_get_seconds();
-				changed = 1;
+				if (ocv_full_count++ >= 30) {
+					_soc.capacity = 100;
+					is_force_full = 1;
+					force_full_ts = shark_get_seconds();
+					ocv_full_count = 0;
+					changed = 1;
+				}
 			}
 		}
 	}