|
|
@@ -38,6 +38,21 @@ static int open_dfet = 0;
|
|
|
static int open_dfet_failt = 0;
|
|
|
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;
|
|
|
+
|
|
|
+static void put_no_hall_time(void){
|
|
|
+ no_hall_time[no_hall_count] = shark_get_seconds();
|
|
|
+ no_hall_count = (no_hall_count + 1) % 5;
|
|
|
+}
|
|
|
+
|
|
|
+static void log_no_hall_time(void){
|
|
|
+ state_debug("current time %d\n", shark_get_seconds());
|
|
|
+ for (int i = 0; i < 5; i++){
|
|
|
+ state_debug("no hall time[%d]:%d\n", i, no_hall_time[i]);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void bms_state_init(void){
|
|
|
set_log_level(MOD_STATE, L_debug);
|
|
|
state_debug("BMS System Starting......\n");
|
|
|
@@ -107,9 +122,10 @@ void bms_state_log(void){
|
|
|
state_debug("Sleep Time: %ds\n", get_system_sleep_time());
|
|
|
state_debug("ml5238 cali: %d\n", ml5238_cali_count);
|
|
|
state_debug("ps charger mask:in %d, %d\n", _bms_state.ps_charger_mask, _bms_state.ps_charger_in);
|
|
|
- state_debug("open dfet %d - %d - %d - %d\n", open_dfet, open_dfet_failt, close_dfet_reson, close_dfet_no_hall);
|
|
|
+ state_debug("open dfet %d - %d - 0x%x - %d\n", open_dfet, open_dfet_failt, close_dfet_reson, close_dfet_no_hall);
|
|
|
state_debug("Reset Reson 0x%x\n", bsp_get_rst_reson());
|
|
|
state_debug("BackUp value 0x%x\n", bsp_get_backup());
|
|
|
+ log_no_hall_time();
|
|
|
#if 0
|
|
|
state_debug("Charging: %d\n", _bms_state.charging);
|
|
|
state_debug("WorkMode %d\n", _bms_state.work_mode);
|
|
|
@@ -278,6 +294,7 @@ static void _process_user_request(s32 health){
|
|
|
}
|
|
|
if (_bms_state.user_request & USER_REQUEST_DISCHARGER_OFF){
|
|
|
discharger_open(0);
|
|
|
+ close_dfet_reson |= (3 << 24);
|
|
|
}
|
|
|
if (_bms_state.user_request & USER_REQUEST_CHARGER_OFF){
|
|
|
charger_open(0);
|
|
|
@@ -400,6 +417,7 @@ static void _process_iostate_changed(s32 unhealth){
|
|
|
bms_set_ps_charger_in(0, 0);
|
|
|
if (ml5238_is_discharging() && (!_bms_state.charging)){
|
|
|
discharger_open(0);
|
|
|
+ put_no_hall_time();
|
|
|
close_dfet_no_hall ++;
|
|
|
open_dfet = open_dfet_failt = 0; //clear open dfet count
|
|
|
}
|