Sfoglia il codice sorgente

Revert "powerdown等待5s,同时不统计最小容量"

This reverts commit 67eef019f62df8d41409b95a5e915565356a13ff.
huhui 4 anni fa
parent
commit
4e10f3600e

+ 0 - 4
Application/app/sox/health.c

@@ -309,11 +309,7 @@ void check_voltage_state(void) {
 			 * system will power on with powerdown_lower_voltage cleared
 			 * system will power on with powerdown_lower_voltage cleared
 			*/			
 			*/			
 			_health.powerdown_lower_voltage = 1;
 			_health.powerdown_lower_voltage = 1;
-			_health.pd_time = shark_get_seconds();
 		}
 		}
-	}else {
-		_health.powerdown_lower_voltage = 0;
-		_health.pd_time = shark_get_seconds();
 	}
 	}
 	debug_health();
 	debug_health();
 }
 }

+ 1 - 2
Application/app/sox/health.h

@@ -48,8 +48,7 @@ typedef struct {
 	uint32_t is_work_temp_normal:1;
 	uint32_t is_work_temp_normal:1;
 	uint32_t small_current_real_short:1; //ÕæÊµ¶Ì·
 	uint32_t small_current_real_short:1; //ÕæÊµ¶Ì·
 
 
-	uint8_t  internal_resistance[CELLS_NUM];   //cell's internal resistance
-	uint32_t pd_time;
+	uint8_t    internal_resistance[CELLS_NUM];   //cell's internal resistance
 }bms_health_t;
 }bms_health_t;
 
 
 typedef struct {
 typedef struct {

+ 1 - 1
Application/app/sox/soc.c

@@ -236,7 +236,7 @@ static __inline__ float _delta_time(void){
 }
 }
 
 
 static __inline__ int can_modify_min_cap(void){
 static __inline__ int can_modify_min_cap(void){
-	if (bms_health()->powerdown_lower_voltage){//如果powerdown,先不修改最小容量
+	if (ml5238_is_spi_ok() == 0){//如果5238异常,不修改最小容量
 		return 0;
 		return 0;
 	}
 	}
 	if (shark_get_seconds() > force_full_ts){
 	if (shark_get_seconds() > force_full_ts){

+ 5 - 10
Application/app/sox/state.c

@@ -214,10 +214,9 @@ void start_aux_power(int start){
 		health_stop_aux_detect();
 		health_stop_aux_detect();
 	}
 	}
 }
 }
-static int system_force_pd = 0;
+
 void system_power_down(void){
 void system_power_down(void){
 	bms_health()->powerdown_lower_voltage = 1;
 	bms_health()->powerdown_lower_voltage = 1;
-	system_force_pd = 1;
 	_process_power_down();
 	_process_power_down();
 }
 }
 
 
@@ -350,20 +349,16 @@ int bms_is_reset_befor_pd(void) {
 }
 }
 
 
 static void _process_power_down(void){
 static void _process_power_down(void){
-#if (ALLOW_POWER_DOWN==1)
+#if (ALLOW_POWER_DOWN==1)	
 	if (bms_health()->powerdown_lower_voltage){
 	if (bms_health()->powerdown_lower_voltage){
-		if (system_force_pd == 0) {
-			ml5238_enable_all_mosfet(0);
-			if (shark_get_seconds() < (bms_health()->pd_time + 5)) {
-				return;
-			}
+		if (ml5238_is_spi_ok() == 0) {
+			nv_save_all_soc();
+			system_reboot();
 		}
 		}
 		state_debug("BMS System PowerDown!!\n");
 		state_debug("BMS System PowerDown!!\n");
 
 
 		if (bms_work_is_normal() && soc_update_by_ocv()) {
 		if (bms_work_is_normal() && soc_update_by_ocv()) {
-			bms_health()->powerdown_lower_voltage = 0;
 			nv_save_all_soc();
 			nv_save_all_soc();
-			bms_health()->powerdown_lower_voltage = 1;
 		}
 		}
 		
 		
 		shark_uart_flush();
 		shark_uart_flush();

+ 1 - 2
Application/bsp/ml5238.c

@@ -20,14 +20,13 @@ void ml5238_init(void){
 
 
 int ml5238_is_spi_ok(void) {
 int ml5238_is_spi_ok(void) {
 	uint8_t data;
 	uint8_t data;
-	int count = 20;
+	int count = 5;
 	while(count-- >= 0) {
 	while(count-- >= 0) {
 		data = 0;
 		data = 0;
 		ml5238_read(ML5238_FET, &data);
 		ml5238_read(ML5238_FET, &data);
 		if (data == 0xaa) {
 		if (data == 0xaa) {
 			return 1;
 			return 1;
 		}
 		}
-		task_udelay(10);
 	}
 	}
 	return 0;
 	return 0;
 }
 }