uboot充电延时,解决CC MODE提示100%的问题

本文针对U-Boot中充电模式存在的问题进行了修复,特别是针对预充(PC)、恒流(CC)及恒压(VC)模式下,充电延时及CC模式未充满即显示100%的问题。通过增加计时机制,确保电池真正充满后再显示100%,提高了用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述:充电的时候,有三种模式,PC(预充),CC(恒流),VC(恒压).在uboot充电延时,CC MODE未充满会提示100%的问题

--- a/mediatek/platform/mt6577/uboot/mt6577_bat.c
+++ b/mediatek/platform/mt6577/uboot/mt6577_bat.c
@@ -1762,6 +1762,13 @@ void check_point_sync_leds(void)
 		leds_battery_medium_charging();
 	}
 }
+extern int capacity_timer_start;
+extern int capacity_full_flag;
+
+static int capacity_seconds=0;
+static int capacity_minutes=0;
 
 void mt65xx_bat_init(void)
 {    
@@ -1960,7 +1967,28 @@ void mt65xx_bat_init(void)
             upmu_chr_baton_tdet_en(1); // sw workaround : 26M off            
             
              if (loop_count++ == 60) loop_count = 0;

+			if(capacity_timer_start == 1)
+			{
+				capacity_seconds++;
+				if(capacity_seconds>=5*60)
+				{
+					printf("[mt65xx_bat_init] capacity_seconds = %d,capacity_minutes=%d\n",capacity_seconds,capacity_minutes);
+					capacity_seconds = 0;
+					capacity_minutes++;
+					if(capacity_minutes >=20)
+					{
+						capacity_minutes = 0;
+						capacity_full_flag = 1;
+					}
+				}
+			}
+			else
+			{
+				capacity_seconds = 0;
+				capacity_minutes = 0;
+			}

              if (mt6577_detect_key(BACKLIGHT_KEY) || (!mt6577_detect_powerkey() && press_pwrkey_count > 0))
              {
                 bl_switch = false;

--- a/mediatek/platform/mt6577/uboot/mt65xx_logo.c
+++ b/mediatek/platform/mt6577/uboot/mt65xx_logo.c
@@ -140,7 +140,10 @@ int capacity_zero = 0;
 int capacity_zero_index = 0;
 //for new
 
-
+int capacity_timer_start=0;
+int capacity_full_flag = 0;
 
 bool mt65xx_logo_decompress(void *in, void *out, int inlen, int outlen)
 {
@@ -739,7 +742,25 @@ void mt65xx_disp_show_battery_full(void)
     else
     {
 #ifdef ANIMATION_NEW
-        cust_show_battery_capacity_new(100);
+//        cust_show_battery_capacity_new(100);

+		if(capacity_timer_start	== 0)
+		{
+			capacity_timer_start = 1;
+			printf("[mt65xx_disp_show_battery_full] timer start \n");
+		}
+		
+		if(capacity_full_flag == 0)
+		{
+			cust_show_battery_capacity_new(99);	
+			printf("[mt65xx_disp_show_battery_full] 99 \n");
+		}
+		else
+		{
+			cust_show_battery_capacity_new(100);
+			printf("[mt65xx_disp_show_battery_full] 100 \n");
+		}
	
 #else
         cust_show_battery_capacity(100);
 #endif
@@ -759,7 +780,20 @@ void mt65xx_disp_show_battery_capacity(UINT32 capacity)
     else
     {
 #ifdef ANIMATION_NEW
-        cust_show_battery_capacity_new(capacity);
+//		cust_show_battery_capacity_new(capacity);

+		if(capacity == 100)
+		{
+			cust_show_battery_capacity_new(99);
+		}
+		else
+		{
+			printf("[mt65xx_disp_show_battery_full] timer off capacity = %d\n",capacity);
+			capacity_timer_start = 0;
+			capacity_full_flag= 0;
+			cust_show_battery_capacity_new(capacity);
+		}	
 #else
         cust_show_battery_capacity(capacity);
 #endif


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值