Explorar el Código

add _soc_is_under_voltage

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui hace 5 años
padre
commit
fe17b80059
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      Application/app/sox/soc.c

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

@@ -165,6 +165,10 @@ static void _force_capacity_full(void){
 	force_full_ts = shark_get_seconds();
 }
 
+static int _soc_is_under_voltage(void) {
+	return (bms_health()->powerdown_lower_voltage || bms_health()->sigle_cell_lower_voltage || bms_health()->discharger_lower_voltage);
+}
+
 static int _soc_update_by_ocv(uint8_t prev_charge_status){
 	static int ocv_full_count = 0;
 	int changed = 0;
@@ -173,7 +177,7 @@ static int _soc_update_by_ocv(uint8_t prev_charge_status){
 	}
 	if (!chargering){
 		if (bms_health()->is_work_temp_normal) {
-			if (_soc.capacity && (bms_health()->powerdown_lower_voltage || bms_health()->sigle_cell_lower_voltage || bms_health()->discharger_lower_voltage)) {
+			if (_soc.capacity && _soc_is_under_voltage()) {
 				if (can_modify_min_cap()){
 					_soc.coulomb_min = _soc.coulomb_now; //已经校准过了,而且电池在常温下进入powerdown,最小容量修正为当前容量
 					soc_warning("calicablite coulomb_min %f\n", _soc.coulomb_min);