1.修复低电保存问题
This commit is contained in:
parent
f5e9d8b576
commit
df02eb9bf9
|
@ -37,4 +37,5 @@ INT16 sf_adc2Temperature(UINT16 adcValue, UINT8 type);/*type: 0:F 1:C*/
|
|||
void sf_stamp_temperature_get(INT16 *fTem,INT16 *cTem); /*0:F 1:C*/
|
||||
void sf_temper_update(void);
|
||||
INT16 sf_celsius_change_to_fahrenheit(INT16 cTemper);
|
||||
UINT16 sf_battery_val_get(void);
|
||||
#endif
|
||||
|
|
|
@ -883,7 +883,7 @@ static SINT32 sf_app_proccess_cmd_dev(SF_MESSAGE_BUF_S *pMessageBuf)
|
|||
stMessageBuf.cmdId = CMD_DEV;
|
||||
stMessageBuf.arg1 = SF_DEV_CMD_BAT;
|
||||
stMessageBuf.arg2 = sf_battery_value_get(0);
|
||||
stMessageBuf.arg3 = (SINT32)sf_battery_type_get();
|
||||
stMessageBuf.arg3 = ((SINT32)(((sf_battery_type_get()) << 16) | (sf_battery_val_get())));
|
||||
printf("[%s:%d]batteryVal=%d battery_type:%d\n",__FUNCTION__,__LINE__,stMessageBuf.arg2, stMessageBuf.arg3);
|
||||
sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
//sf_app_set_battery(pMessageBuf->arg2, pMessageBuf->arg3);
|
||||
|
|
|
@ -397,7 +397,7 @@ void sf_battery_level_update(void)
|
|||
stMessageBuf.cmdId = CMD_DEV;
|
||||
stMessageBuf.arg1 = SF_DEV_CMD_BAT;
|
||||
stMessageBuf.arg2 = batteryVal;
|
||||
stMessageBuf.arg3 = (SINT32)sf_battery_type_get();
|
||||
stMessageBuf.arg3 = ((SINT32)(((sf_battery_type_get()) << 16) | (sf_battery_val_get())));
|
||||
printf("[%s:%d]batteryVal=%d battery_type:%d\n",__FUNCTION__,__LINE__,batteryVal, stMessageBuf.arg3);
|
||||
sf_com_message_send_to_cardv(&stMessageBuf);
|
||||
#endif
|
||||
|
@ -1290,6 +1290,26 @@ UINT8 sf_battery_type_get(void)
|
|||
return SF_POWER_TYPE_DC;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: sf_battery_type_get
|
||||
Description: Get battery type.
|
||||
Input: N/A
|
||||
Output: N/A
|
||||
Return: value: battery type, 0:normal 1:LiPolymer
|
||||
Others: N/A
|
||||
*************************************************/
|
||||
UINT16 sf_battery_val_get(void)
|
||||
{
|
||||
if(IsPowerDcIn)
|
||||
return (UINT16)DcVoltageVal;
|
||||
else if(LiPolymerVoltageVal)
|
||||
return (UINT16)LiPolymerVoltageVal;
|
||||
else if(BatVoltageVal)
|
||||
return (UINT16)BatVoltageVal;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: sf_is_battery_low
|
||||
Description: Judge whether the power is low
|
||||
|
|
|
@ -80,6 +80,7 @@ static UINT8 FwUpdate = 0;
|
|||
static UINT8 IsNightLedOn = 0;
|
||||
static SF_BatteryLevel_e sf_LatestBattLevel = SF_BATT_LEVEL_0;
|
||||
static UINT8 batteryVal = 0;
|
||||
static UINT16 powerVal = 0;
|
||||
static UINT8 batteryType = 0;
|
||||
static SINT16 fTemper = 0;
|
||||
static SINT16 cTemper = 0;
|
||||
|
@ -1699,7 +1700,8 @@ static SINT32 sf_cardv_proccess_cmd_dev(SF_MESSAGE_BUF_S *pMessageBuf)
|
|||
break;
|
||||
case SF_DEV_CMD_BAT:
|
||||
batteryVal = pMessageBuf->arg2;
|
||||
batteryType = pMessageBuf->arg3;
|
||||
batteryType = pMessageBuf->arg3 & 0xf0;
|
||||
powerVal = pMessageBuf->arg3 & 0xf;
|
||||
sf_cardv_battery_level_update(batteryVal);
|
||||
MLOGI("batteryVal:%d batteryType:%d\n",batteryVal,batteryType);
|
||||
|
||||
|
@ -2236,9 +2238,9 @@ UINT8 sf_cardv_battery_type_get(void)
|
|||
BOOL sf_is_flash_voltage_abnormal(void)
|
||||
{
|
||||
|
||||
printf("batteryVal=%d batteryType=%d \n", batteryVal, batteryType);
|
||||
printf("powerVal=%d batteryType=%d \n", powerVal, batteryType);
|
||||
|
||||
if((/*SF_POWER_TYPE_DC*/1 != batteryType) && (batteryVal < 55) && (batteryVal < 55))
|
||||
if((/*SF_POWER_TYPE_DC*/1 != batteryType) && (powerVal < 55) )
|
||||
{
|
||||
printf("low battery no write flash\n");
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in New Issue
Block a user