Exemple #1
0
void DrawBattery(void)
{
	static u8 batflash;
	int i,BatPer;	
	u16 batfull,batlow;
	
	//计算百分比,缺省镍电:4V~5V
	batfull=500;
	batlow=400;
	if(TxSys.BatType==1)//碱性:4V~6V
	{
		batfull=600;
		batlow=400;
	}
	if(TxSys.BatType==2)//1S LI:3.3V~4.2V
	{
		batfull=410;
		batlow=330;
	}
	if(TxSys.BatType==3)//2S LI:6.6V~8.4V
	{
		batfull=830;
		batlow=660;
	}
	
	if(BatVol>batfull)	BatPer=LCD_BAT_FULL;
	else				BatPer=(BatVol-batlow)*LCD_BAT_FULL/(batfull-batlow);
	
	//开始绘制电池状态
    LcdDrawStart(0, 0,LCD_W-1, 8, DRAW_NWSE);
    
    //显示电池电压
    if(BatLowCnt>=BAT_LOW_CNT)  batflash=!batflash;
    else						batflash=1;

    if(batflash)
    {
    	LcdDrawMiniInt(LCD_BAT_X+18,LCD_BAT_Y,BatVol,0,2,0,1);
    	LcdDrawMiniNum(LCD_BAT_X+18,LCD_BAT_Y,LCD_MN_CHAR('V'));
    }
    else LcdDrawRect(LCD_BAT_X,LCD_BAT_Y,LCD_BAT_X+22,LCD_BAT_Y+6,0);
    
    //显示电池柱状图
    LcdDrawMaskY(LCD_BAT_X+24,LCD_BAT_Y,LCD_BAT_ICON1,5);
    LcdDrawMaskY(LCD_BAT_X+25,LCD_BAT_Y,BatPer==LCD_BAT_FULL?LCD_BAT_ICON4:LCD_BAT_ICON2,5);
    for(i=0;i<LCD_BAT_FULL;i++)
    {
    	LcdDrawMaskY(LCD_BAT_X+26+i,LCD_BAT_Y,i>=(LCD_BAT_FULL-BatPer)?LCD_BAT_ICON4:LCD_BAT_ICON3,5);
    }
    LcdDrawMaskY(LCD_BAT_X+26+LCD_BAT_FULL,LCD_BAT_Y,LCD_BAT_ICON5,5);
    
    LcdDrawStop();
}
Exemple #2
0
void Disp_NorRev(u8 x,u8 y)
{
	LcdDrawMiniNum(x,y,LCD_MN_CHAR('N'),0);
	x+=4;
	LcdDrawMiniNum(x,y,LCD_MN_CHAR('O'),0);
	x+=4;
	LcdDrawMiniNum(x,y,LCD_MN_CHAR('R'),0);
	x+=12;
	LcdDrawMiniNum(x,y,LCD_MN_CHAR('R'),0);
	x+=4;
	LcdDrawMiniNum(x,y,LCD_MN_CHAR('E'),0);
	x+=4;
	LcdDrawMiniNum(x,y,LCD_MN_CHAR('V'),0);
}
Exemple #3
0
//模型参数调节菜单处理过程
u32 PageNorRevSet(u8 event)
{
	static u8 DrawMask;
	static u8 iFocus;
	
	if(event==PV_INIT)
	{
		LCD_Clr_All();//清屏
		DrawMask = PD_ALL;
		iFocus = 0;
		return 1;
	}
	
	if(event==PV_REDRAW)
	{
		LCD_Clr_All();//清屏
		DrawMask = PD_ALL;	
	}
	
	if(DrawMask)
	{
		if(DrawMask&PD_TITLE)
		{
			LCD_Fill_Rect(0,0,127,13,0);
			Disp_GB2312_String(0,3,(u8 *)TitleNorRevSet[TxSys.Language],0,0);
			LCD_Draw_Line(0,14,127,14,1);
			LCD_Draw_Line(0,15,127,15,1);
			
			Disp_NorRev(24,17);
			Disp_NorRev(92,17);
		}
		
		if(DrawMask&PD_IDX)
		{
			if(iFocus==0)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y,ARROW_X1+6,ARROW_Y+8,0);
			
			if(iFocus==1)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y+8);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y+8,ARROW_X1+6,ARROW_Y+16,0);
			
			if(iFocus==2)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y+16);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y+16,ARROW_X1+6,ARROW_Y+24,0);
			
			if(iFocus==3)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y+24);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y+24,ARROW_X1+6,ARROW_Y+32,0);
			
			if(iFocus==4)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y+32);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y+32,ARROW_X1+6,ARROW_Y+40,0);
			
			if(iFocus==5)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y,ARROW_X2+6,ARROW_Y+8,0);
			
			if(iFocus==6)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y+8);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y+8,ARROW_X2+6,ARROW_Y+16,0);
			
			if(iFocus==7)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y+16);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y+16,ARROW_X2+6,ARROW_Y+24,0);
			
			if(iFocus==8)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y+24);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y+24,ARROW_X2+6,ARROW_Y+32,0);
			
			if(iFocus==9)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y+32);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y+32,ARROW_X2+6,ARROW_Y+40,0);
		}
			
		if(DrawMask&PD_VALUE)	
		{
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y,1,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y,Model.Rev[0]);
			
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y+8,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y+8,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y+8,2,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y+8,Model.Rev[1]);
			
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y+16,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y+16,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y+16,3,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y+16,Model.Rev[2]);
			
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y+24,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y+24,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y+24,4,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y+24,Model.Rev[3]);
			
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y+32,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y+32,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y+32,5,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y+32,Model.Rev[4]);
			
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y,6,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y,Model.Rev[5]);
			
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y+8,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y+8,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y+8,7,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y+8,Model.Rev[6]);
			
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y+16,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y+16,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y+16,8,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y+16,Model.Rev[7]);
			
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y+24,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y+24,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y+24,9,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y+24,Model.Rev[8]);
			
			LcdDrawMiniNum(REVBAR_X2-4,REVBAR_Y+32,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y+32,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y+32,1,0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y+32,0,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y+32,Model.Rev[9]);
		}
		DrawMask = 0;
	}
		
	if(KeyTstDown(KEY_ENT))
	{
		Model.Rev[iFocus] = !Model.Rev[iFocus];
		DrawMask = PD_VALUE;
	}
	
	//上下按键处理
	if(KeyTstDown(KEY_DOWN))
	{
		if(iFocus<9)	iFocus++;
		else	iFocus = 0;
		DrawMask = PD_IDX;
	}
	if(KeyTstDown(KEY_UP))
	{
		if(iFocus>0)	iFocus--;
		else	iFocus = 9;
		DrawMask = PD_IDX;
	}
	
	//返回键处理
	if(KeyTstDown(KEY_EXT))
	{
		PageReturn(PV_INIT);
	}

	KeyClearDown(KEY_MENUALL);

	
	return 0;
}