1.电池检测优化
This commit is contained in:
parent
fb4ad35a74
commit
6c15c3403d
|
@ -1082,7 +1082,6 @@ SINT32 sf_app_battery_start(void)
|
||||||
SLOGE("thread has already run !!!\n");
|
SLOGE("thread has already run !!!\n");
|
||||||
return SF_FAILURE;
|
return SF_FAILURE;
|
||||||
}
|
}
|
||||||
sf_adc_init();
|
|
||||||
printf("[sf_app_battery_start]thread start\n");
|
printf("[sf_app_battery_start]thread start\n");
|
||||||
ret = pthread_create(&BatteryTskCfg.TskId, NULL, sf_battery_check_thread, NULL);
|
ret = pthread_create(&BatteryTskCfg.TskId, NULL, sf_battery_check_thread, NULL);
|
||||||
if(ret != SF_SUCCESS)
|
if(ret != SF_SUCCESS)
|
||||||
|
@ -1372,7 +1371,7 @@ void* sf_app_load_ko_thread(void *arg)
|
||||||
SLOGI("thread run\n");
|
SLOGI("thread run\n");
|
||||||
UsbKoTskCfg.IsRun = 1;
|
UsbKoTskCfg.IsRun = 1;
|
||||||
|
|
||||||
sf_load_ko();
|
// sf_load_ko();
|
||||||
|
|
||||||
if(PWR_ON_SETUP == sf_poweron_type_get())
|
if(PWR_ON_SETUP == sf_poweron_type_get())
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "sf_ledmng.h"
|
#include "sf_ledmng.h"
|
||||||
#include "sf_dev_usb.h"
|
#include "sf_dev_usb.h"
|
||||||
#include "sf_commu_mcu_reg.h"
|
#include "sf_commu_mcu_reg.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#if HUNTING_CAMERA_MCU == ENABLE
|
#if HUNTING_CAMERA_MCU == ENABLE
|
||||||
typedef signed int SINT32;
|
typedef signed int SINT32;
|
||||||
|
@ -447,7 +448,7 @@ UINT32 sf_battery_adc_value_get_once(void)
|
||||||
|
|
||||||
if(_LiPolymerVoltageVal)
|
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)
|
if(SF_BATT_LI_PACK != puiPara->BatteryType)
|
||||||
{
|
{
|
||||||
puiPara->LiBatteryType = puiPara->BatteryType;
|
puiPara->LiBatteryType = puiPara->BatteryType;
|
||||||
|
@ -910,12 +911,12 @@ SINT32 sf_battery_adc_value_get(void)
|
||||||
void sf_battery_level_polling(void)
|
void sf_battery_level_polling(void)
|
||||||
{
|
{
|
||||||
UINT16 readBatCnt = 0;
|
UINT16 readBatCnt = 0;
|
||||||
UINT32 dcTemp = 0;
|
double dcTemp = 0;
|
||||||
UINT32 batTemp = 0;
|
double batTemp = 0;
|
||||||
UINT32 LibatTemp = 0;
|
double LibatTemp = 0;
|
||||||
UINT8 LibatCnt = 0;
|
UINT8 LibatCnt = 0;
|
||||||
UINT8 batCnt = 0;
|
UINT8 batCnt = 0;
|
||||||
UINT32 temperValue = 0;
|
double temperValue = 0;
|
||||||
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
static UINT32 prePowerDcStatus = 0;
|
static UINT32 prePowerDcStatus = 0;
|
||||||
|
|
||||||
|
@ -958,13 +959,13 @@ void sf_battery_level_polling(void)
|
||||||
}
|
}
|
||||||
if(readBatCnt >= 10)
|
if(readBatCnt >= 10)
|
||||||
{
|
{
|
||||||
_DcVoltageVal = dcTemp / 10;
|
_DcVoltageVal = (UINT32)round(dcTemp / 10);
|
||||||
_TemperAdc = temperValue/10;
|
_TemperAdc = (UINT32)round(temperValue / 10);
|
||||||
|
|
||||||
if(LibatCnt)
|
if(LibatCnt)
|
||||||
_LiPolymerVoltageVal = LibatTemp / LibatCnt;
|
_LiPolymerVoltageVal = (UINT32)round(LibatTemp / LibatCnt);
|
||||||
if(batCnt)
|
if(batCnt)
|
||||||
_BatVoltageVal = batTemp / batCnt;
|
_BatVoltageVal = (UINT32)round(batTemp / batCnt);
|
||||||
|
|
||||||
if((_DcVoltageVal > _LiPolymerVoltageVal) && (_DcVoltageVal >= _BatVoltageVal) && (_DcVoltageVal >= SF_DC_IN_VOLATAGE))
|
if((_DcVoltageVal > _LiPolymerVoltageVal) && (_DcVoltageVal >= _BatVoltageVal) && (_DcVoltageVal >= SF_DC_IN_VOLATAGE))
|
||||||
{
|
{
|
||||||
|
@ -1010,7 +1011,7 @@ void sf_battery_level_polling(void)
|
||||||
sf_temper_update();
|
sf_temper_update();
|
||||||
if(LiPolymerVoltageVal)
|
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)
|
if(SF_BATT_LI_PACK != puiPara->BatteryType)
|
||||||
{
|
{
|
||||||
puiPara->LiBatteryType = puiPara->BatteryType;
|
puiPara->LiBatteryType = puiPara->BatteryType;
|
||||||
|
@ -1093,6 +1094,7 @@ void* sf_battery_check_thread(void *arg)
|
||||||
{
|
{
|
||||||
//THREAD_ENTRY();
|
//THREAD_ENTRY();
|
||||||
printf("[%s:%d] s\n", __FUNCTION__, __LINE__);
|
printf("[%s:%d] s\n", __FUNCTION__, __LINE__);
|
||||||
|
sf_adc_init();
|
||||||
|
|
||||||
if(sf_is_battery_low(1, 0) == TRUE)
|
if(sf_is_battery_low(1, 0) == TRUE)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user