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