Bläddra i källkod

optimize code

Chenyingjia 2 år sedan
förälder
incheckning
12c4311113
1 ändrade filer med 7 tillägg och 6 borttagningar
  1. 7 6
      hal/hal_battery/hal_battery_NoPowerEnPin.c

+ 7 - 6
hal/hal_battery/hal_battery_NoPowerEnPin.c

@@ -414,11 +414,11 @@ static float Power_management(float mV_Battery, float mV_Charge)
                 battercb->sta = 1; //放电过程
                 battercb->sta = 1; //放电过程
                 //初始化滤波器波器
                 //初始化滤波器波器
                 battercb->preBestResult_Voltage2power = mV_Battery / 10;
                 battercb->preBestResult_Voltage2power = mV_Battery / 10;
-                #ifdef PIN_BATFULL
-                if ((battercb->P1 > 99.1f) && (charge_in()) && (nrf_gpio_pin_read(PIN_BATFULL) == 0))
-                #else
+//                #ifdef PIN_BATFULL
+//                if ((battercb->P1 > 99.1f) && (charge_in()) && (nrf_gpio_pin_read(PIN_BATFULL) == 0))
+//                #else
                 if ((battercb->P1 > 99.1f) && (charge_in()))
                 if ((battercb->P1 > 99.1f) && (charge_in()))
-                #endif
+//                #endif
                 {
                 {
                     battercb->P1 = 100.0f;
                     battercb->P1 = 100.0f;
                 }
                 }
@@ -508,10 +508,11 @@ static void hal_battery_Process(void)
     len = sprintf(buff, "%4d ,%4d ,%4d,%f\r\n", TIME_GetTicks(), volTemp, volTemp_CHARGMEASURE, battercb->adc_tp4056_power);
     len = sprintf(buff, "%4d ,%4d ,%4d,%f\r\n", TIME_GetTicks(), volTemp, volTemp_CHARGMEASURE, battercb->adc_tp4056_power);
     send_bytes_client((unsigned char*)buff, len);
     send_bytes_client((unsigned char*)buff, len);
     #endif
     #endif
-    if (cprign % 600 == 0)
-    {
+    if (cprign % 600 == 0)//600
+    { 
         log("%4d,%4d,%4d,%2.1f,%d,%2.1f,%2.1f,%2.1f\n", TIME_GetTicks(), volTemp, volTemp_CHARGMEASURE, battercb->adc_tp4056_power, battercb->sta, battercb->P_mAh, battercb->P2, battercb->kg);
         log("%4d,%4d,%4d,%2.1f,%d,%2.1f,%2.1f,%2.1f\n", TIME_GetTicks(), volTemp, volTemp_CHARGMEASURE, battercb->adc_tp4056_power, battercb->sta, battercb->P_mAh, battercb->P2, battercb->kg);
         logbuftemp[logbuftemp_len] = 0;
         logbuftemp[logbuftemp_len] = 0;
+//				SEGGER_RTT_Write(0,logbuftemp,logbuftemp_len);
         Except_TxError(EXCEPT_DATA_BATTERY, logbuftemp);
         Except_TxError(EXCEPT_DATA_BATTERY, logbuftemp);
     }
     }
     cprign++;
     cprign++;