|
|
@@ -166,6 +166,12 @@ static __inline__ int can_modify_min_cap(void){
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static void _force_capacity_full(void){
|
|
|
+ _soc.capacity = 100;
|
|
|
+ is_force_full = 1;
|
|
|
+ force_full_ts = shark_get_seconds();
|
|
|
+}
|
|
|
+
|
|
|
int soc_update_by_ocv(void){
|
|
|
static int ocv_full_count = 0;
|
|
|
int changed = 0;
|
|
|
@@ -186,11 +192,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)){
|
|
|
+ if (bms_health()->sigle_cell_over_voltage) {
|
|
|
+ _force_capacity_full();
|
|
|
+ ocv_full_count = 0;
|
|
|
+ changed = 1;
|
|
|
+ }else if (bms_state_get()->pack_voltage >= (FULL_MAX_VOLTAGE) && (measure_value()->load_current <= FULL_MIN_CURRENT)){
|
|
|
if (ocv_full_count++ >= 30) {
|
|
|
- _soc.capacity = 100;
|
|
|
- is_force_full = 1;
|
|
|
- force_full_ts = shark_get_seconds();
|
|
|
+ _force_capacity_full();
|
|
|
ocv_full_count = 0;
|
|
|
changed = 1;
|
|
|
}
|
|
|
@@ -207,21 +215,19 @@ static void soc_calibrate(uint8_t prev_charge_status){
|
|
|
static int cali_full_count = 0;
|
|
|
if (!(_soc.flags & SOC_FLAG_CALIBRATED)){
|
|
|
if (chargering){//ÓÃocv½øÐÐÑϸñУ׼
|
|
|
- if (!is_force_full && (measure_value()->load_current <= FULL_MIN_CURRENT) && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){
|
|
|
- cali_full_count ++;
|
|
|
- if (cali_full_count == 10) {
|
|
|
+ if (!is_force_full){
|
|
|
+ if ((measure_value()->load_current <= FULL_MIN_CURRENT) && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){
|
|
|
+ cali_full_count ++;
|
|
|
+ }
|
|
|
+ if (cali_full_count == 10 || bms_health()->sigle_cell_over_voltage) {
|
|
|
soc_debug("calibrate Capacity to 100, measure_value()->load_current %d\n", measure_value()->load_current);
|
|
|
- _soc.capacity = 100;
|
|
|
- force_full_ts = shark_get_seconds();
|
|
|
- is_force_full = 1;
|
|
|
+ _force_capacity_full();
|
|
|
}
|
|
|
}
|
|
|
}else if (prev_charge_status){
|
|
|
- if(!is_force_full && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){
|
|
|
+ if(!is_force_full && ((bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE) || bms_health()->sigle_cell_over_voltage)){
|
|
|
soc_debug("calibrate Capacity to 100\n");
|
|
|
- _soc.capacity = 100;
|
|
|
- force_full_ts = shark_get_seconds();
|
|
|
- is_force_full = 1;
|
|
|
+ _force_capacity_full();
|
|
|
}
|
|
|
}
|
|
|
}
|