Browse Source

optimize code

Chenyingjia 2 years ago
parent
commit
58e8ccf355
1 changed files with 4 additions and 3 deletions
  1. 4 3
      hal/hal_battery/hal_battery_NoPowerEnPin.c

+ 4 - 3
hal/hal_battery/hal_battery_NoPowerEnPin.c

@@ -7,8 +7,6 @@
 #include "hal_charge.h"
 #include "fml_adc.h"
 #include "app_chargerpin_conn_detect.h"
-#include "drv_trigger.h"
-
 #define PRINTBLE 0
 
 #define IIDUAN 1
@@ -92,7 +90,7 @@ void cb_init(void)
 //返回5V信号,有5V的话返回1,没有的话返回0
 static char charge_in(void)
 {
-    if (drv_GetChargeTrig())
+    if (nrf_gpio_pin_read(PIN_CHARGING))
     {
         return 1;
     }
@@ -393,6 +391,7 @@ static float Power_management(float mV_Battery, float mV_Charge)
                 battercb->sta = 2; //充电过程
                 battercb->kg = 0;
                 battercb->Battery_capacity_mAh = mah2Voltage(battercb->P1, storage_capacity);
+							log("in %f\r\n",battercb->P1);
             }
             else
             {
@@ -413,6 +412,7 @@ static float Power_management(float mV_Battery, float mV_Charge)
         case 2://充电
             if (mV_Charge < 20)
             {
+							log("out %f\r\n",battercb->P1);
                 battercb->sta = 1; //放电过程
                 //初始化滤波器波器
                 battercb->preBestResult_Voltage2power = mV_Battery / 10;
@@ -423,6 +423,7 @@ static float Power_management(float mV_Battery, float mV_Charge)
 //                #endif
                 {
                     battercb->P1 = 100.0f;
+									log("full %f\r\n",battercb->P1);
                 }
             }
             else