diff --git a/code/application/source/sf_app/code/source/app/sf_system.c b/code/application/source/sf_app/code/source/app/sf_system.c index 43f5905a0..d75d55dc0 100755 --- a/code/application/source/sf_app/code/source/app/sf_system.c +++ b/code/application/source/sf_app/code/source/app/sf_system.c @@ -1082,7 +1082,6 @@ SINT32 sf_app_battery_start(void) SLOGE("thread has already run !!!\n"); return SF_FAILURE; } - sf_adc_init(); printf("[sf_app_battery_start]thread start\n"); ret = pthread_create(&BatteryTskCfg.TskId, NULL, sf_battery_check_thread, NULL); if(ret != SF_SUCCESS) @@ -1372,7 +1371,7 @@ void* sf_app_load_ko_thread(void *arg) SLOGI("thread run\n"); UsbKoTskCfg.IsRun = 1; - sf_load_ko(); + // sf_load_ko(); if(PWR_ON_SETUP == sf_poweron_type_get()) { diff --git a/code/application/source/sf_app/code/source/battery/sf_battery.c b/code/application/source/sf_app/code/source/battery/sf_battery.c index 94f664a04..6f71a07b1 100755 --- a/code/application/source/sf_app/code/source/battery/sf_battery.c +++ b/code/application/source/sf_app/code/source/battery/sf_battery.c @@ -49,6 +49,7 @@ #include "sf_ledmng.h" #include "sf_dev_usb.h" #include "sf_commu_mcu_reg.h" +#include #if HUNTING_CAMERA_MCU == ENABLE typedef signed int SINT32; @@ -447,7 +448,7 @@ UINT32 sf_battery_adc_value_get_once(void) if(_LiPolymerVoltageVal) { - printf("[sf_battery_level_polling]is lith battery\n"); + // printf("[sf_battery_level_polling]is lith battery\n"); if(SF_BATT_LI_PACK != puiPara->BatteryType) { puiPara->LiBatteryType = puiPara->BatteryType; @@ -910,12 +911,12 @@ SINT32 sf_battery_adc_value_get(void) void sf_battery_level_polling(void) { UINT16 readBatCnt = 0; - UINT32 dcTemp = 0; - UINT32 batTemp = 0; - UINT32 LibatTemp = 0; + double dcTemp = 0; + double batTemp = 0; + double LibatTemp = 0; UINT8 LibatCnt = 0; UINT8 batCnt = 0; - UINT32 temperValue = 0; + double temperValue = 0; UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); static UINT32 prePowerDcStatus = 0; @@ -958,13 +959,13 @@ void sf_battery_level_polling(void) } if(readBatCnt >= 10) { - _DcVoltageVal = dcTemp / 10; - _TemperAdc = temperValue/10; + _DcVoltageVal = (UINT32)round(dcTemp / 10); + _TemperAdc = (UINT32)round(temperValue / 10); if(LibatCnt) - _LiPolymerVoltageVal = LibatTemp / LibatCnt; + _LiPolymerVoltageVal = (UINT32)round(LibatTemp / LibatCnt); if(batCnt) - _BatVoltageVal = batTemp / batCnt; + _BatVoltageVal = (UINT32)round(batTemp / batCnt); if((_DcVoltageVal > _LiPolymerVoltageVal) && (_DcVoltageVal >= _BatVoltageVal) && (_DcVoltageVal >= SF_DC_IN_VOLATAGE)) { @@ -1010,7 +1011,7 @@ void sf_battery_level_polling(void) sf_temper_update(); if(LiPolymerVoltageVal) { - printf("[sf_battery_level_polling]is lith battery\n"); + // printf("[sf_battery_level_polling]is lith battery\n"); if(SF_BATT_LI_PACK != puiPara->BatteryType) { puiPara->LiBatteryType = puiPara->BatteryType; @@ -1093,6 +1094,7 @@ void* sf_battery_check_thread(void *arg) { //THREAD_ENTRY(); printf("[%s:%d] s\n", __FUNCTION__, __LINE__); + sf_adc_init(); if(sf_is_battery_low(1, 0) == TRUE) {