|
|
@@ -21,12 +21,10 @@ static void _current_notify(void);
|
|
|
static void _voltage_notify(void);
|
|
|
static void _temperature_notify(void);
|
|
|
static u32 _bms_main_task_handler(void);
|
|
|
-static void _balance_timer_handler(shark_timer_t *t);
|
|
|
static void _debug_timer_handler(shark_timer_t *t);
|
|
|
|
|
|
static bms_state_t _bms_state;
|
|
|
static shark_task_t _bms_main_task = {.handler = _bms_main_task_handler};
|
|
|
-static shark_timer_t _balance_timer = {.handler = _balance_timer_handler};
|
|
|
|
|
|
static shark_timer_t _debug_timer = {.handler = _debug_timer_handler};
|
|
|
|
|
|
@@ -372,10 +370,14 @@ static void _current_notify(void){
|
|
|
soc_update(); //计算soc
|
|
|
}
|
|
|
|
|
|
+#if (ALLOW_5238_BALANCE==1)
|
|
|
+
|
|
|
/* 需要检查电芯的电压,如果发现有电芯电压过高,需要开启被动均衡
|
|
|
* 充电过程中考虑balance,主要是希望cell 电压扩散后,保证1. 单电芯不能过压, 2. 单电芯不能比平均电压过低,导致
|
|
|
* 木桶效应,目标是电压最高的那个cell,尽量压制,不让电压再升高,或者升高的尽量慢一些
|
|
|
*/
|
|
|
+static shark_timer_t _balance_timer = {.handler = _balance_timer_handler};
|
|
|
+
|
|
|
static debounce_t _cell_balance = {.count = 10, .max_count = 20};
|
|
|
|
|
|
static void _balance_timer_handler(shark_timer_t *t){
|
|
|
@@ -411,7 +413,7 @@ static void check_cell_balance(uint8_t current_max_index){
|
|
|
}
|
|
|
_bms_state.cell_index_of_max_vol = current_max_index;
|
|
|
}
|
|
|
-
|
|
|
+#endif
|
|
|
static uint8_t calc_cell_voltage(void){
|
|
|
uint16_t voltage = 0;
|
|
|
uint16_t max_cell = 0;
|