|
|
@@ -80,6 +80,7 @@ int bms_work_mode_set(int mode, int start){
|
|
|
|
|
|
void bms_state_log(void){
|
|
|
state_warning("Life Time: %d\n", shark_get_seconds());
|
|
|
+ state_warning("Sleep Time: %ds\n", get_system_sleep_time());
|
|
|
state_debug("Charging: %d\n", _bms_state.charging);
|
|
|
state_debug("WorkMode %d\n", _bms_state.work_mode);
|
|
|
state_debug("DMos: %d\n", ml5238_is_discharging());
|
|
|
@@ -262,7 +263,7 @@ static void _process_deepsleep(s32 health){
|
|
|
#if (ALLOW_DEEP_SLEEP==1)
|
|
|
static u64 _sleep_time = 0;
|
|
|
#if (SLEEP_IGNORE_UNHEALTH==0)
|
|
|
- if ((health & Health_Fault_Can_Sleep) != Health_Fault_Can_Sleep){
|
|
|
+ if ((health != Health_Success) && ((health & Health_Fault_Can_Sleep) != Health_Fault_Can_Sleep)){
|
|
|
return;
|
|
|
}
|
|
|
#endif
|
|
|
@@ -312,7 +313,7 @@ static void _process_iostate_changed(s32 unhealth){
|
|
|
charger_open(0);
|
|
|
}
|
|
|
}
|
|
|
- if (io_state()->charger_detect && ((unhealth & Health_charger_Fault) == 0) && (_bms_state.cell_max_vol < SIGLE_CELL_MAX_CHARGER_VOLTAGE)) {
|
|
|
+ if (io_state()->charger_detect_irq && ((unhealth & Health_charger_Fault) == 0) && (_bms_state.cell_max_vol < SIGLE_CELL_MAX_CHARGER_VOLTAGE)) {
|
|
|
if (!ml5238_is_charging() && shark_uart_timeout()){//不在车上,底座上,充电柜上,检测到充电器插入,自动打开充电,否则的话,只能通过指令来打开充电mos
|
|
|
charger_open(1);
|
|
|
}
|