|
@@ -23,6 +23,8 @@ uint32_t charger_remain_time = 0;
|
|
|
|
|
|
|
|
#define DEFALUT_MAX_COULOMB (MAX_HA * 3600.0f)
|
|
#define DEFALUT_MAX_COULOMB (MAX_HA * 3600.0f)
|
|
|
#define DEFALUT_MIN_COULOMB (25.0f * 3600.0f)
|
|
#define DEFALUT_MIN_COULOMB (25.0f * 3600.0f)
|
|
|
|
|
+#define FULL_MAX_VOLTAGE (53500)//mV
|
|
|
|
|
+#define FULL_MIN_CURRENT (500.0f) //mA
|
|
|
static void calibrate_soc_by_ocv(void);
|
|
static void calibrate_soc_by_ocv(void);
|
|
|
|
|
|
|
|
#if LEAST_SQUARE==1
|
|
#if LEAST_SQUARE==1
|
|
@@ -167,7 +169,7 @@ int soc_update_by_ocv(void){
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (chargering && !is_force_full){
|
|
if (chargering && !is_force_full){
|
|
|
- if (bms_state_get()->pack_voltage >= (53500) && (measure_value()->load_current <= 500.0f)){
|
|
|
|
|
|
|
+ if (bms_state_get()->pack_voltage >= (FULL_MAX_VOLTAGE) && (measure_value()->load_current <= FULL_MIN_CURRENT)){
|
|
|
_soc.capacity = 100;
|
|
_soc.capacity = 100;
|
|
|
is_force_full = 1;
|
|
is_force_full = 1;
|
|
|
changed = 1;
|
|
changed = 1;
|
|
@@ -182,7 +184,7 @@ static void soc_calibrate(uint8_t prev_charge_status){
|
|
|
static int cali_full_count = 0;
|
|
static int cali_full_count = 0;
|
|
|
if (!(_soc.flags & SOC_FLAG_CALIBRATED)){
|
|
if (!(_soc.flags & SOC_FLAG_CALIBRATED)){
|
|
|
if (chargering){//ÓÃocv½øÐÐÑϸñУ׼
|
|
if (chargering){//ÓÃocv½øÐÐÑϸñУ׼
|
|
|
- if (!is_force_full && (measure_value()->load_current <= 500.0f) && (bms_state_get()->pack_voltage >= 53500)){
|
|
|
|
|
|
|
+ if (!is_force_full && (measure_value()->load_current <= FULL_MIN_CURRENT) && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){
|
|
|
cali_full_count ++;
|
|
cali_full_count ++;
|
|
|
if (cali_full_count == 10) {
|
|
if (cali_full_count == 10) {
|
|
|
soc_debug("calibrate Capacity to 100, measure_value()->load_current %d\n", measure_value()->load_current);
|
|
soc_debug("calibrate Capacity to 100, measure_value()->load_current %d\n", measure_value()->load_current);
|
|
@@ -191,7 +193,7 @@ static void soc_calibrate(uint8_t prev_charge_status){
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}else if (prev_charge_status){
|
|
}else if (prev_charge_status){
|
|
|
- if(!is_force_full && (bms_state_get()->pack_voltage >= 53500)){
|
|
|
|
|
|
|
+ if(!is_force_full && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){
|
|
|
soc_debug("calibrate Capacity to 100\n");
|
|
soc_debug("calibrate Capacity to 100\n");
|
|
|
_soc.capacity = 100;
|
|
_soc.capacity = 100;
|
|
|
is_force_full = 1;
|
|
is_force_full = 1;
|