|
|
@@ -40,6 +40,8 @@ static int close_dfet_reson = 0;
|
|
|
static int close_dfet_no_hall = 0;
|
|
|
static int no_hall_time[5];
|
|
|
static int no_hall_count = 0;
|
|
|
+u64 uart_frame_time = 0;
|
|
|
+static u32 uart_reinit_count = 0;
|
|
|
|
|
|
static void put_no_hall_time(void){
|
|
|
no_hall_time[no_hall_count] = shark_get_seconds();
|
|
|
@@ -69,6 +71,8 @@ void bms_state_init(void){
|
|
|
|
|
|
pcb_temp = measure_value()->pack_temp[PCB_TEMP_INDEX];
|
|
|
|
|
|
+ uart_frame_time = shark_get_mseconds();
|
|
|
+
|
|
|
set_log_all(L_disable);
|
|
|
}
|
|
|
|
|
|
@@ -404,6 +408,7 @@ static void _process_deepsleep(s32 health){
|
|
|
mcu_enter_deepsleep();
|
|
|
soc_update_for_deepsleep(mcu_get_sleeptime());//²¹³¥ÐÝÃߵŦºÄ
|
|
|
_sleep_time = shark_get_mseconds();
|
|
|
+ uart_frame_time = shark_get_mseconds();
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
@@ -447,12 +452,28 @@ static void _process_iostate_changed(s32 unhealth){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void _bms_uart_workaround(void) {
|
|
|
+ if (io_state()->hall_detect != 1){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (shark_get_mseconds() >= (uart_frame_time + 3000)){
|
|
|
+ UART0_IR_EN(0);
|
|
|
+ UART1_IR_EN(0);
|
|
|
+ task_udelay(50 * 1000);
|
|
|
+ UART0_IR_EN(1);
|
|
|
+ UART1_IR_EN(1);
|
|
|
+ uart_reinit_count++;
|
|
|
+ uart_frame_time = shark_get_mseconds();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static u32 _bms_main_task_handler(void){
|
|
|
s32 unhealth = _process_unheath();
|
|
|
_process_user_request(unhealth);
|
|
|
_process_deepsleep(unhealth);
|
|
|
_process_power_down();
|
|
|
_process_iostate_changed(unhealth);
|
|
|
+ _bms_uart_workaround();
|
|
|
return 0;
|
|
|
}
|
|
|
|