|
@@ -187,10 +187,10 @@ void check_current_state(void){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* 检测pack电压,cell电压,pack电压过低触发powerdown*/
|
|
/* 检测pack电压,cell电压,pack电压过低触发powerdown*/
|
|
|
-static debounce_t _discharger_lower_voltage = {.count = 0, .max_count = 20, .init_count = 10};
|
|
|
|
|
|
|
+static debounce_t _discharger_lower_voltage = {.count = 0, .max_count = 10, .init_count = 0};
|
|
|
static debounce_t _power_down_voltage = {.count = 0, .max_count = 10, .init_count = 0};
|
|
static debounce_t _power_down_voltage = {.count = 0, .max_count = 10, .init_count = 0};
|
|
|
-static debounce_t _sigle_cell_discharger_lower_vol = {.count = 0, .max_count = 10, .init_count = 5};
|
|
|
|
|
-static debounce_t _sigle_cell_charger_max_vol = {.count = 0, .max_count = 30, .init_count = 15};
|
|
|
|
|
|
|
+static debounce_t _sigle_cell_discharger_lower_vol = {.count = 0, .max_count = 5, .init_count = 0};
|
|
|
|
|
+static debounce_t _sigle_cell_charger_max_vol = {.count = 0, .max_count = 15, .init_count = 0};
|
|
|
static debounce_t _shut_discharger_lower_voltage = {.count = 0, .max_count = 20,};
|
|
static debounce_t _shut_discharger_lower_voltage = {.count = 0, .max_count = 20,};
|
|
|
static debounce_t _shut_discharger_cell_lower_voltage = {.count = 0, .max_count = 20,};
|
|
static debounce_t _shut_discharger_cell_lower_voltage = {.count = 0, .max_count = 20,};
|
|
|
|
|
|
|
@@ -244,20 +244,24 @@ void check_voltage_state(void) {
|
|
|
if ((bms_state_get()->cell_min_vol <= min_discharger_cell_vol[_health.is_work_temp_normal])){
|
|
if ((bms_state_get()->cell_min_vol <= min_discharger_cell_vol[_health.is_work_temp_normal])){
|
|
|
if (judge_debounce(!_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
|
|
if (judge_debounce(!_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
|
|
|
_health.sigle_cell_lower_voltage = 1;
|
|
_health.sigle_cell_lower_voltage = 1;
|
|
|
|
|
+ _sigle_cell_discharger_lower_vol.max_count = 30;//从欠压恢复可以稍微慢一点
|
|
|
}
|
|
}
|
|
|
}else if ((bms_state_get()->cell_min_vol >= min_discharger_cell_recovery_vol[_health.is_work_temp_normal])){
|
|
}else if ((bms_state_get()->cell_min_vol >= min_discharger_cell_recovery_vol[_health.is_work_temp_normal])){
|
|
|
if (judge_debounce(_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
|
|
if (judge_debounce(_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
|
|
|
_health.sigle_cell_lower_voltage = 0;
|
|
_health.sigle_cell_lower_voltage = 0;
|
|
|
|
|
+ _sigle_cell_discharger_lower_vol.max_count = 5;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//check sigle pack's voltage for discharger
|
|
//check sigle pack's voltage for discharger
|
|
|
if (bms_state_get()->pack_voltage <= min_discharger_vol[_health.is_work_temp_normal]){
|
|
if (bms_state_get()->pack_voltage <= min_discharger_vol[_health.is_work_temp_normal]){
|
|
|
if (judge_debounce(!_health.discharger_lower_voltage, &_discharger_lower_voltage)){
|
|
if (judge_debounce(!_health.discharger_lower_voltage, &_discharger_lower_voltage)){
|
|
|
_health.discharger_lower_voltage = 1;
|
|
_health.discharger_lower_voltage = 1;
|
|
|
|
|
+ _discharger_lower_voltage.max_count = 30; //从欠压恢复可以稍微慢一点
|
|
|
}
|
|
}
|
|
|
}else if (bms_state_get()->pack_voltage >= min_discharger_recovery_vol[_health.is_work_temp_normal]){
|
|
}else if (bms_state_get()->pack_voltage >= min_discharger_recovery_vol[_health.is_work_temp_normal]){
|
|
|
if (judge_debounce(_health.discharger_lower_voltage, &_discharger_lower_voltage)){
|
|
if (judge_debounce(_health.discharger_lower_voltage, &_discharger_lower_voltage)){
|
|
|
_health.discharger_lower_voltage = 0;
|
|
_health.discharger_lower_voltage = 0;
|
|
|
|
|
+ _discharger_lower_voltage.max_count = 10;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//check for shutdown power
|
|
//check for shutdown power
|