|
|
@@ -18,7 +18,7 @@ static float max_soc_delta_time = 0;
|
|
|
static float _charger_coefficient = 1.0f;
|
|
|
static float _discharger_coefficient = 1.0f;
|
|
|
static uint32_t charger_remain_time = 0;
|
|
|
-static bool _is_cell_lower_vol = false;
|
|
|
+static uint32 _is_cell_lower_vol = 0;
|
|
|
static const float _discharger_gain[] = {1.0f/*>0度*/, 1.002f/*-2<t<=0*/, 1.005f/*-5<t<=-2*/, 1.008f/*-10<t<=-5*/, 1.02f/*-15<t<=-10*/, 1.04f/*-20<t<=-15*/};
|
|
|
#define MAX_TIME_FULL_TO_EMPTY (5 * 24 * 3600) //充满到欠压5天内达到,可以校准最小电量
|
|
|
#define MAX_TIME_EMPTY_TO_FULL (8 * 24 * 3600) //充满到欠压5天内达到,可以校准最小电量
|
|
|
@@ -219,7 +219,7 @@ void soc_log(void){
|
|
|
soc_debug("C delta time %f,%f, -- %d\n", max_soc_delta_time, soc_delta_time, force_full_ts);
|
|
|
soc_debug("C discharger coefficient = %f\n", _discharger_coefficient);
|
|
|
soc_debug("forcce full = %d, %d, %d, %d\n", _full_reason, _force_full, _force_full_minc, force_full_ts);
|
|
|
- soc_debug("Discharger: %s\n", _is_cell_lower_vol?"Lower vol":"Normal");
|
|
|
+ soc_debug("Discharger lover vol:%d\n", _is_cell_lower_vol);
|
|
|
if (chargering){
|
|
|
soc_debug("C remain %d\n", charger_remain_time);
|
|
|
}
|
|
|
@@ -304,7 +304,7 @@ static void _force_capacity_full(void){
|
|
|
_soc.coulomb_now = _soc.coulomb_max;//充满后,当前容量设置为最大容量
|
|
|
|
|
|
force_full_ts = shark_get_seconds();
|
|
|
- _is_cell_lower_vol = false;
|
|
|
+ _is_cell_lower_vol = 0;
|
|
|
_force_full = 2;
|
|
|
}
|
|
|
|
|
|
@@ -323,7 +323,9 @@ static int _soc_update_by_ocv(uint8_t prev_charge_status){
|
|
|
if (!chargering){
|
|
|
if (_soc.capacity && _soc_is_under_voltage()) {
|
|
|
soc_warning("judge calib min col %d - %d\n", shark_get_seconds(), force_full_ts);
|
|
|
+ _is_cell_lower_vol = 1;
|
|
|
if (can_modify_min_cap()){
|
|
|
+ _is_cell_lower_vol = 2;
|
|
|
if (health_is_low_current()) {
|
|
|
_soc.coulomb_min = _soc.coulomb_now; //已经校准过了,而且电池在常温下进入powerdown,最小容量修正为当前容量
|
|
|
}else if (health_is_mid_current()) {
|
|
|
@@ -336,9 +338,9 @@ static int _soc_update_by_ocv(uint8_t prev_charge_status){
|
|
|
_soc.coulomb_now = _soc.coulomb_min;
|
|
|
soc_warning("calicablite coulomb_min %f\n", _soc.coulomb_min);
|
|
|
}else {
|
|
|
+ _is_cell_lower_vol = 3;
|
|
|
_soc.coulomb_now = _soc.coulomb_min;
|
|
|
}
|
|
|
- _is_cell_lower_vol = true;
|
|
|
_soc.capacity = 0;
|
|
|
return 1;
|
|
|
}
|
|
|
@@ -398,6 +400,7 @@ static void soc_calibrate(uint8_t prev_charge_status){
|
|
|
}
|
|
|
}else {
|
|
|
if (_soc.capacity && _soc_is_under_voltage()) {
|
|
|
+ _soc.coulomb_now = _soc.coulomb_min = 0;
|
|
|
_soc.capacity = 0;
|
|
|
}
|
|
|
}
|