Kaynağa Gözat

充满5s内主动关闭充电mos,不接受开充电mos指令

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 4 yıl önce
ebeveyn
işleme
90a6fbd4f1

+ 12 - 0
Application/app/sox/soc.c

@@ -283,9 +283,21 @@ static __inline__ int can_modify_min_when_full(void){
 	return 0;
 }
 
+static bool is_force_full = false;
+static u32  force_full_time = 0;
+bool soc_is_force_full(void) {
+	if (is_force_full) {
+		if (shark_get_seconds() >= 5 + force_full_time) {
+			is_force_full = false;
+		}
+	}
+	return is_force_full;
+}
 
 static void _force_capacity_full(void){
 	_soc.capacity = 100;
+	is_force_full = true;
+	force_full_time = shark_get_seconds();
 	if (can_modify_min_when_full()) { //前面出现过电芯欠压, 当前容量没到最大容量
 		double curr_real_cap = start_charger_coulomb + _soc.charger_coulomb;
 		double curr_min_cap = 0.0f;

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

@@ -36,5 +36,6 @@ void soc_update_for_deepsleep(float sleep_time);
 void soc_restore_by_iap(uint8_t flags, uint8_t capaticy);
 u8 soc_get_version(void);
 void soc_set_version(u8 version);
+bool soc_is_force_full(void);
 
 

+ 4 - 1
Application/app/sox/state.c

@@ -292,7 +292,10 @@ static s32 _process_unheath(void){
 			unhealth |= Health_Discharger_Failt;
 		}
 	}
-	
+	if (soc_is_force_full()) {
+		charger_open(0); //disable charger mosfet
+		unhealth |= (Health_charger_Fault |Health_Fault_Can_Sleep);
+	}
 	return unhealth;
 }