电压显示:
void fnSdsOsdSetBatteryState(unsigned char ucState)
{
switch (ucState)
{
case 0x7f: // above 3.0V
case 0x3f: // above 3.0V
case 0x1f: // 3.0V ~ 2.8V
ucState = 3;
break;
case 0x0f: // 2.8V ~ 2.7V
ucState = 2;
break;
case 0x07: // 2.7V ~ 2.4V
ucState = 2;
break;
case 0x03: // 2.4V ~ 2.2V
ucState = 1;
break;
case 0x01: // below 2.2V
ucState = 0;
break;
default:
break;
}
fnCtloIconSetIconIndex(&g_stBatteryIcon, ucState);
}
电压状态更新(是否低压关机):
void fnSysFuncNewBATState(BYTE ucState)
{
static BYTE ucCount = 0;
if ((stSysFuncInfo.ucBATState != ucState) && stSysFuncInfo.fUpdtBAT)
{
ucCount++;
ucCount %= 5;
if (ucCount != 4)
return;
stSysFuncInfo.ucBATState = ucState;
// Battery power down to below 2.2v , shutdown system by set power time to 1s.
stSysFuncInfo.fLowBAT = (ucState <= 1);//低压关机
SosSendEvent(SYSEVENT_BATTERYSTATE, ucState);
}
}