|
|
@@ -157,12 +157,17 @@ void soc_update(void){
|
|
|
soc_update_by_ocv();
|
|
|
|
|
|
//如果没有校准过,充电过程中,电量100%后,设置校准标志位
|
|
|
- if (chargering && (_soc.flags & SOC_FLAG_CALIBRATED) == 0){
|
|
|
- if (_soc.capacity == 100){
|
|
|
+ if (chargering && (_soc.capacity == 100)){
|
|
|
+ if ((_soc.flags & SOC_FLAG_CALIBRATED) == 0){
|
|
|
_soc.coulomb_now = _soc.coulomb_max;
|
|
|
_soc.flags |= SOC_FLAG_CALIBRATED;
|
|
|
nv_save_soc();
|
|
|
soc_warning("calibrate OK, charging coulomb: %f\n", _soc.charger_coulomb);
|
|
|
+ }else { //如果校准过,单电芯过压,100%的容量,设置最大容量为当前容量
|
|
|
+ if (bms_health()->sigle_cell_over_voltage){
|
|
|
+ _soc.coulomb_max = _soc.coulomb_now;
|
|
|
+ soc_warning("signal cell over vol, cap full, reset coul max to coul now: %f\n", _soc.coulomb_max);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
_soc.energy = bms_state_get()->pack_voltage/1000.f * (_soc.coulomb_now - _soc.coulomb_min) * _soc.capacity/100.0f;
|