|
|
@@ -266,6 +266,13 @@ static void _pack_low_judge_current(bool set) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void push_cell_event(event_id_t id){
|
|
|
+ u32 max = ((bms_state_get()->cell_index_of_max_vol << 12) & 0xF000) | (bms_state_get()->cell_max_vol& 0x0FFF);
|
|
|
+ u32 min = ((bms_state_get()->cell_index_of_min_vol << 12) & 0xF000) | (bms_state_get()->cell_min_vol& 0x0FFF);
|
|
|
+
|
|
|
+ push_event(id, max << 16 | min);
|
|
|
+}
|
|
|
+
|
|
|
void check_voltage_state(void) {
|
|
|
static uint16_t _charging = 0xFFFF;
|
|
|
if (_charging != bms_state_get()->charging) {
|
|
|
@@ -283,7 +290,7 @@ void check_voltage_state(void) {
|
|
|
if ((bms_state_get()->cell_max_vol>= SIGLE_CELL_MAX_CHARGER_VOLTAGE)){
|
|
|
if (judge_debounce(!_health.sigle_cell_over_voltage, &_sigle_cell_charger_max_vol)){
|
|
|
_health.sigle_cell_over_voltage = 1;
|
|
|
- push_event(Cell_Over_Vol, bms_state_get()->cell_max_vol | (bms_state_get()->cell_index_of_max_vol << 16));
|
|
|
+ push_cell_event(Cell_Over_Vol);
|
|
|
sys_debug("sigle cell %d\n", bms_state_get()->cell_max_vol);
|
|
|
}
|
|
|
}else if ((bms_state_get()->cell_max_vol < SIGLE_CELL_MAX_CHARGER_VOLTAGE)){
|
|
|
@@ -299,7 +306,7 @@ void check_voltage_state(void) {
|
|
|
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)){
|
|
|
_health.sigle_cell_lower_voltage = 1;
|
|
|
- push_event(Cell_Under_Vol, bms_state_get()->cell_min_vol | (bms_state_get()->cell_index_of_min_vol << 16));
|
|
|
+ push_cell_event(Cell_Under_Vol);
|
|
|
_single_low_judge_current(true);
|
|
|
error_counts.cell_under_voltage++;
|
|
|
}
|