فهرست منبع

解决重满校准最小容量,计算错误

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 4 سال پیش
والد
کامیت
896cc8ea12
1فایلهای تغییر یافته به همراه9 افزوده شده و 6 حذف شده
  1. 9 6
      Application/app/sox/soc.c

+ 9 - 6
Application/app/sox/soc.c

@@ -307,27 +307,30 @@ bool soc_is_force_full(void) {
 	return is_force_full;
 }
 
-#define min_cap_lfp 0.2f
+#define min_cap_lfp 0.5f
 static void _force_capacity_full(void){
 	_soc.capacity = 100;
 	is_force_full = true;
 	force_full_time = shark_get_seconds();
+	double curr_real_cap = start_charger_coulomb + _soc.charger_coulomb;
 	if (can_modify_min_when_full()) { //前面出现过电芯欠压, 当前容量没到最大容量
-		double curr_real_cap = start_charger_coulomb + _soc.charger_coulomb;
 		double curr_min_cap = 0.0f;
 		if (curr_real_cap > _soc.coulomb_max) {
-			curr_min_cap = 0.0f;
+			curr_min_cap = _soc.coulomb_min - (curr_real_cap - _soc.coulomb_max);
 		}else {
-			curr_min_cap = _soc.coulomb_max - curr_real_cap;
+			curr_min_cap = _soc.coulomb_max - curr_real_cap + _soc.coulomb_min;
+		}
+		if (curr_min_cap < 0.0f) {
+			curr_min_cap = 0.0f;
 		}
 		//don't trust if curr_min_cap big than before
 		if (curr_min_cap < _soc.coulomb_min) {
 			_soc.coulomb_min = _soc.coulomb_min * (1.0f - min_cap_lfp) + curr_min_cap * min_cap_lfp; //lowpass filter
 			soc_warning("current real cap %f\n", _soc.coulomb_min);
-			push_event(Min_Cap_For_Full, (u32)curr_real_cap);
+			push_event(Min_Cap_For_Full, (u32)curr_min_cap);
 		}
 	}
-	push_event(Charger_Full_cap, (u32)_soc.coulomb_now);
+	push_event(Charger_Full_cap, (u32)curr_real_cap);
 	_soc.coulomb_now = _soc.coulomb_max;//充满后,当前容量设置为最大容量
 
 	force_full_ts = shark_get_seconds();