Explorar el Código

add powerdown test PCBA Test

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui hace 5 años
padre
commit
29976d78a9
Se han modificado 3 ficheros con 11 adiciones y 3 borrados
  1. 4 3
      Application/app/pcba_test.c
  2. 6 0
      Application/app/sox/state.c
  3. 1 0
      Application/app/sox/state.h

+ 4 - 3
Application/app/pcba_test.c

@@ -77,10 +77,11 @@ int pcba_test(uint8_t *data, int len, uint8_t *response){
 	}else if (cmd == 0xd) {
 		response[resp_len ++] = io_state()->aux_lock_detect;
 	}else if (cmd == 0xe) {
-		charger_open(0);
-		discharger_open(0);
-		start_aux_power(1);
+		charger_open(1);
+		discharger_open(1);
+		start_aux_power(0);
 		response[resp_len ++] = 0;
+		system_power_down();
 	}else if (cmd == 0xf){
 		response[resp_len ++] = !IS_HALL1_DETECTED();
 		response[resp_len ++] = !IS_HALL2_DETECTED();

+ 6 - 0
Application/app/sox/state.c

@@ -22,6 +22,7 @@ static void _voltage_notify(void);
 static void _temperature_notify(void);
 static u32 _bms_main_task_handler(void);
 static void _debug_timer_handler(shark_timer_t *t);
+static void _process_power_down(void);
 
 static bms_state_t _bms_state;
 static int pcb_temp = 100;
@@ -171,6 +172,11 @@ void start_aux_power(int start){
 	}
 }
 
+void system_power_down(void){
+	bms_health()->powerdown_lower_voltage = 1;
+	_process_power_down();
+}
+
 #define Health_Success 0
 #define Health_Discharger_Failt 1
 #define Health_charger_Fault 2

+ 1 - 0
Application/app/sox/state.h

@@ -95,6 +95,7 @@ void charger_open(int open);
 void discharger_open(int open);
 void start_aux_power(int start);
 void bms_set_ps_charger_in(uint16_t mask, uint16_t in);
+void system_power_down(void);
 
 #endif /* _BMS_STATE_H__ */