Просмотр исходного кода

no hall clear ps charger mask

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 4 лет назад
Родитель
Сommit
8793dfab01
1 измененных файлов с 14 добавлено и 12 удалено
  1. 14 12
      Application/app/sox/state.c

+ 14 - 12
Application/app/sox/state.c

@@ -441,19 +441,21 @@ static int _can_close_mos_no_hall(void){
 }
 
 static void _process_iostate_changed(s32 unhealth){
-	if (!(io_state()->hall_detect)&& _can_close_mos_no_hall()){
+	if (!(io_state()->hall_detect)){
 		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
-		}
-		if (!AUX_VOL_IS_OPEN() && !bms_health()->load_current_short && !io_state()->aux_lock_detect && !bms_health()->small_current_short){
-			start_aux_power(1);
-		}
-		if (!io_state()->charger_detect_irq && ml5238_is_charging() && (!_bms_state.charging)){
-			charger_open(0);
+		if (_can_close_mos_no_hall()) {
+			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
+			}
+			if (!AUX_VOL_IS_OPEN() && !bms_health()->load_current_short && !io_state()->aux_lock_detect && !bms_health()->small_current_short){
+				start_aux_power(1);
+			}
+			if (!io_state()->charger_detect_irq && ml5238_is_charging() && (!_bms_state.charging)){
+				charger_open(0);
+			}
 		}
 	}
 	if (io_state()->charger_detect_irq && ((unhealth & Health_charger_Fault) == 0) && (_bms_state.cell_max_vol < SIGLE_CELL_MAX_CHARGER_VOLTAGE)) {