|
@@ -607,8 +607,13 @@ static void _check_mos_stat(void){
|
|
|
_check_mos_time = shark_get_seconds();
|
|
_check_mos_time = shark_get_seconds();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+#if (ALLOW_5238_BALANCE==1)
|
|
|
|
|
+static bool check_stop_balance(void) ;
|
|
|
|
|
+#endif
|
|
|
static void _current_notify(void){
|
|
static void _current_notify(void){
|
|
|
|
|
+#if (ALLOW_5238_BALANCE==1)
|
|
|
|
|
+ check_stop_balance();
|
|
|
|
|
+#endif
|
|
|
check_charging();
|
|
check_charging();
|
|
|
check_current_state(); //check health of current
|
|
check_current_state(); //check health of current
|
|
|
_check_mos_stat();
|
|
_check_mos_stat();
|
|
@@ -749,13 +754,7 @@ static u8 need_stop_balance(void) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void check_cell_balance(void){
|
|
static void check_cell_balance(void){
|
|
|
- if (!can_do_balance()) {
|
|
|
|
|
- if (need_stop_balance()) {
|
|
|
|
|
- if (_bms_state.pack_balancing){
|
|
|
|
|
- _stop_balance();
|
|
|
|
|
- shark_timer_cancel(&_balance_timer);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (check_stop_balance()) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
u16 mask = get_balance_maskV2();
|
|
u16 mask = get_balance_maskV2();
|
|
@@ -766,6 +765,21 @@ static void check_cell_balance(void){
|
|
|
}
|
|
}
|
|
|
state_debug("Cell balance mask 0x%x\n", mask);
|
|
state_debug("Cell balance mask 0x%x\n", mask);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+static bool check_stop_balance(void) {
|
|
|
|
|
+ if (!can_do_balance()) {
|
|
|
|
|
+ if (need_stop_balance()) {
|
|
|
|
|
+ if (_bms_state.pack_balancing){
|
|
|
|
|
+ _stop_balance();
|
|
|
|
|
+ push_event(Cell_balance, 0);
|
|
|
|
|
+ shark_timer_cancel(&_balance_timer);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#endif
|
|
#endif
|
|
|
static void calc_cell_voltage(void){
|
|
static void calc_cell_voltage(void){
|
|
|
uint16_t voltage = 0;
|
|
uint16_t voltage = 0;
|