裸奔单片机GUI

#include "main.h"
#ifndef __STD_GUI_CONTEX__
#define __STD_GUI_CONTEX__

#define CPSTRSIZE 20//控件字符数
#define TOUCHCOLOR RED
#define TOUCHFONTCOLOR 0xffff

#define SELCOLOR GRED
#define SELFONTCOLOR RED

typedef struct
{
uint8 id;
uint8 relayIndex;

uint8 tmpflag :1;
uint8 fldflag :1;
uint8 distflag :1;

float temperature;
float tempCL;
float tempCH;

float dist;
float distCL;
float distCH;

float fluide;
float fluideCL;
float fluideCH;
}_DEVICE;
typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint16 color;
uint16 fontColor;
uint16 selColor;
uint16 selFColor;
uint8 fontSize;
uint8 selected :1;
uint8 touch :1;
uint8 updata :1;//是否更新控件
uint8 caption[CPSTRSIZE];
}_BUTTON;
typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint16 color;
uint16 fontColor;
uint16 selColor;
uint16 selFColor;
uint8 fontSize;
uint8 selected :1;
uint8 touch :1;
uint8 style :1;
uint8 updata :1;
uint8 caption[CPSTRSIZE];
}_FRAME;
typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint16 color;
uint16 fontColor;
uint16 selColor;
uint16 selFColor;
uint8 fontSize;
uint8 selected :1;
uint8 touch :1;
uint8 updata :1;
uint8 updataText :1;
uint8 caption[CPSTRSIZE];
uint8 text[CPSTRSIZE];
}_TEXTBOX;

typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint8 scale;
uint16 color;
uint16 backColor;
uint8 fontSize;
uint8 touch :1;
uint8 updata :1;
uint8 caption[CPSTRSIZE];
uint8 value;
}_CHECKBOX;
typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint16 color;
uint16 backColor;
uint16 selColor;
uint16 selBColor;
uint8 selected :1;
uint8 touch :1;
uint8 updata :1;
uint8 updataVal :1;
uint8 caption[CPSTRSIZE];
uint8 value;//百分比
_DEVICE device;
}_BUCKET;//桶
typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint16 color;
uint16 backColor;
uint16 selColor;
uint16 selBColor;
uint8 selected :1;
uint8 touch :1;
uint8 updata :1;
uint8 caption[CPSTRSIZE];
uint8 value;
_DEVICE device;
}_VALVE;//阀
typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint16 color;
uint16 backColor;
uint16 selColor;
uint16 selBColor;
uint8 selected :1;
uint8 touch :1;
uint8 updata :1;
uint8 caption[CPSTRSIZE];
uint8 value;
_DEVICE device;
}_MOTO;//电机
typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint16 color;
uint16 backColor;
uint16 selColor;
uint16 selBColor;
uint8 selected :1;
uint8 touch :1;
uint8 updata :1;
uint8 caption[CPSTRSIZE];
uint8 value;
_DEVICE device;
}_FLOWMETER;//流量计
typedef struct
{
uint16 x;
uint16 y;
uint16 width;
uint16 height;
uint16 color;
uint16 backColor;
uint16 selColor;
uint16 selBColor;
uint8 selected :1;
uint8 touch :1;
uint8 updata :1;
uint8 caption[CPSTRSIZE];
uint8 value;
_DEVICE device;
}_LIGHT;//灯
/*按键名,x,y,width,height,按键颜色,按键标题,标题颜色,标题大小*/
void Button_Updata(_BUTTON *button);
void Button_Creat(_BUTTON *button,uint16 _bx,uint16 _by, uint16 _bwidth, uint16 _bheight,
uint16 _bcolor,uint8 *s,uint16 _fcolor,uint8 _fscale );
void Button_SetSelectedColor(_BUTTON *button,uint16 _bcolor, uint16 _fcolor);
void Button_Selected(_BUTTON *button);
void Button_Unselected(_BUTTON *button);
void Button_Touch(_BUTTON *button);
void Button_Untouch(_BUTTON *button);
uint8 Button_CheckTouch(_BUTTON *button);
/*框架名,x,y,width,height,按键颜色,按键标题,标题颜色,标题大小,框架样式是否透明*/
void Frame_Updata(_FRAME *frame);
void Frame_Creat(_FRAME *frame,uint16 _frmx,uint16 _frmy, uint16 _frmwidth, uint16 _frmheight,
uint16 _frmcolor,uint8 *s,uint16 _fcolor,uint8 _fscale,uint8 style );
void Frame_SetSelectedColor(_FRAME *frame,uint16 _bcolor, uint16 _fcolor);
void Frame_SetCaption(_FRAME *frame,uint8 *s);
void Frame_Selected(_FRAME *frame);
void Frame_Unselected(_FRAME *frame);
/*文本框名,x,y,width,height,按键颜色,按键标题,标题颜色,标题大小*/
void TextBox_Updata(_TEXTBOX *textbox);
void TextBox_Creat(_TEXTBOX *textbox,uint16 _bx,uint16 _by, uint16 _bwidth, uint16 _bheight,
uint16 _bcolor,uint8 *s,uint16 _fcolor );
void TextBox_SetSelectedColor(_TEXTBOX *textbox,uint16 _bcolor, uint16 _fcolor);
void TextBox_Selected(_TEXTBOX *textbox);
void TextBox_Unselected(_TEXTBOX *textbox);
void TextBox_Touch(_TEXTBOX *textbox);
void TextBox_Untouch(_TEXTBOX *textbox);
uint8 TextBox_CheckTouch(_TEXTBOX *textbox);
void TextBox_PrintText(_TEXTBOX *textbox,uint8 *s);
/*复选框名,x,y,标题,颜色,背景色,大小,值*/
void CheckBox_Updata(_CHECKBOX *checkbox);
void Checbox_Creat(_CHECKBOX *checkbox,uint16 x,uint16 y,uint8 *s,uint16 color,uint16 backcolor,uint8 scale,uint8 val );
uint8 CheckBox_GetValue(_CHECKBOX *checkbox);
void CheckBox_SetValue(_CHECKBOX *checkbox,uint8 x);
uint8 CheckBox_CheckTouch(_CHECKBOX *checkbox);
/*创建桶**/
void Bucket_Updata(_BUCKET *bucket);
void Bucket_Creat(_BUCKET *bucket ,uint16 x, uint16 y, uint16 w, uint16 h, uint16 color, uint16 backcolor, uint8 *s);
void Bucket_SetSelectedColor(_BUCKET *bucket,uint16 color, uint16 backcolor);
void Bucke_SettValue(_BUCKET *bucket,uint8 val);
void Bucke_Selected(_BUCKET *bucket);
void Bucke_Unselected(_BUCKET *bucket);
void Bucke_Touch(_BUCKET *bucket);
void Bucke_Untouch(_BUCKET *bucket);
uint8 Bucket_CheckTouch(_BUCKET *bucket);
/*创建阀*/
void Valve_Updata(_VALVE *valve);
void Valve_Creat(_VALVE *valve, uint16 x, uint16 y, uint16 width, uint16 height, uint16 color, uint16 bcolor);
void Valve_SetSelectedColor(_VALVE *valve,uint16 color, uint16 backcolor);
uint8 Valve_SetValue(_VALVE *valve,uint8 val);
void Valve_Selected(_VALVE *valve);
void Valve_Unselected(_VALVE *valve);
void Valve_Touch(_VALVE *valve);
void Valve_Untouch(_VALVE *valve);
uint8 Valve_CheckTouch(_VALVE *valve);
/*电机*/
void Moto_Updata(_MOTO *moto);
void Moto_Creat(_MOTO *moto,uint16 x,uint16 y, uint16 width, uint16 height, uint16 color, uint16 bcolor);
void Moto_Selected(_MOTO *moto);
void Moto_Unselected(_MOTO *moto);
void Moto_Touch(_MOTO *moto);
void Moto_Untouch(_MOTO *moto);
void Moto_SetSelectedColor(_MOTO *moto,uint16 color, uint16 bcolor);
uint8 Moto_CheckTouch(_MOTO *moto);
uint8 Moto_SetValue(_MOTO *moto, uint8 val);
/*流量计*/
void Flowmeter_Updata(_FLOWMETER *flowmeter);
void Flowmeter_Creat(_FLOWMETER *flowmeter,uint16 x, uint16 y, uint16 width, uint16 height, uint16 color, uint16 bcolor);
void Flowmeter_SetSelectedColor(_FLOWMETER *flowmeter,uint16 color, uint16 backcolor);
void Flowmeter_Selected(_FLOWMETER *flowmeter);
void Flowmeter_Unselected(_FLOWMETER *flowmeter);
uint8 Flowmeter_CheckTouch(_FLOWMETER *flowmeter);
/*灯*/
void Light_Updata(_LIGHT *light);
void Light_Creat(_LIGHT *light,uint16 x, uint16 y, uint16 width, uint16 height,
uint16 color, uint16 bcolor,uint8 *s);
uint8 Light_SetValue(_LIGHT *light, uint8 val);
void Light_SetSelectedColor(_LIGHT *light,uint16 color, uint16 bcolor);
void Light_Selected(_LIGHT *light);
void Light_Unselected(_LIGHT *light);
void Light_Touch(_LIGHT *light);
void Light_Untouch(_LIGHT *light);
uint8 Light_CheckTouch(_LIGHT *light);

void DrawSelectedChannel(uint8 channel, uint16 color,uint16 backcolor);
void DrawClearChannel(uint8 channel, uint16 color, uint16 backcolor, uint8 half);
void DrawAllChannel(uint16 color);
#endif

 

 

 

#define __Global

#include <string.h>
#include "main.h"
void TextBox_Updata(_TEXTBOX *textbox)
{
uint16 _fWidth,_totalFontWidth,_fHeight;
uint16 _fx,_fy;
uint16 _len;
uint16 temp;
uint16 color,fcolor;
if(textbox->updata)
{
_len=0;
while(textbox->caption[_len]!='\0')
{
_len++;
}
if(textbox->height<FONTHEIGHT)
temp=1;
else
temp=textbox->height/FONTHEIGHT;
_fHeight=FONTHEIGHT*temp;
_fWidth=FONTWIDTH*temp;
_totalFontWidth=_fWidth*_len;

if(textbox->selected||textbox->touch)
{color=textbox->selColor;fcolor=textbox->selFColor;}
else
{color=textbox->color;fcolor=textbox->fontColor;}

LCD_DrawRectangle(textbox->x+_totalFontWidth,textbox->y,textbox->width-_totalFontWidth,textbox->height,fcolor);
LCD_FillWidow(textbox->x+_totalFontWidth+1,textbox->y+1,textbox->width-_totalFontWidth-2,textbox->height-2,color);
if(_len>0)
{
SetFontStyle(fcolor,color,temp,1);
_fx=((textbox->x));
_fy=(textbox->height/2+textbox->y)-(_fHeight/2);
LCD_PrintString(_fx,_fy,textbox->caption);
}
textbox->updata=0;
textbox->updataText=0x01;
//textbox->touch=0;
}
if(textbox->updataText)
{
if(textbox->selected||textbox->touch)
{color=textbox->selColor;fcolor=textbox->selFColor;}
else
{color=textbox->color;fcolor=textbox->fontColor;}
_len=0;
while(textbox->caption[_len]!='\0')
{
_len++;
}
if(_len>0)
{
if(textbox->height<FONTHEIGHT)
temp=1;
else
temp=textbox->height/FONTHEIGHT;
_fHeight=FONTHEIGHT*temp;
_fWidth=FONTWIDTH*temp;
_totalFontWidth=_fWidth*_len;
SetFontStyle(fcolor,color,temp,0);
_fx=((textbox->x)+_totalFontWidth+2);
_fy=(textbox->height/2+textbox->y)-(_fHeight/2);
LCD_PrintString(_fx,_fy,textbox->text);
_len=textbox->width+textbox->x;//末尾
_fx=strlen(textbox->text)*_fWidth+_fx;//起始x
while(_fx<_len)
{
if(_fx+_fWidth>_len)
break;
SetFontStyle(fcolor,color,temp,0);
LCD_PrintString(_fx,_fy," ");
_fx+=_fWidth;
}
}
textbox->updataText=0;
}
}
void TextBox_Creat(_TEXTBOX *textbox,uint16 _bx,uint16 _by, uint16 _bwidth, uint16 _bheight,
uint16 _bcolor,uint8 *s,uint16 _fcolor )
{
uint8 i;
textbox->x=_bx;
textbox->y=_by;
textbox->width=_bwidth;
textbox->height=_bheight;
textbox->color=_bcolor;
textbox->fontColor=_fcolor;

textbox->selColor=SELCOLOR;
textbox->selFColor=SELFONTCOLOR;
textbox->selected=0x00;
textbox->updata=1;
for(i=0;i<CPSTRSIZE;i++)
{
textbox->caption[i]=*(s+i);
if(*(s+i)=='\0')
break;
}
TextBox_Updata(textbox);
}
void TextBox_SetSelectedColor(_TEXTBOX *textbox,uint16 _bcolor, uint16 _fcolor)
{
textbox->selColor=_bcolor;
textbox->selFColor=_fcolor;
textbox->updata=0x01;
TextBox_Updata(textbox);
}
void TextBox_Selected(_TEXTBOX *textbox)
{
if(!textbox->selected)
{
textbox->updata=0x01;
textbox->selected=0x01;
TextBox_Updata(textbox);
}
}
void TextBox_Unselected(_TEXTBOX *textbox)
{
if(textbox->selected)
{
textbox->updata=0x01;
textbox->selected=0x00;
TextBox_Updata(textbox);
}
}
void TextBox_Touch(_TEXTBOX *textbox)
{
if(!textbox->touch)
{
textbox->updata=0x01;
textbox->touch=0x01;
TextBox_Updata(textbox);
}
}
void TextBox_Untouch(_TEXTBOX *textbox)
{
if(textbox->touch)
{
textbox->updata=0x01;
textbox->touch=0x00;
TextBox_Updata(textbox);
}
}
uint8 TextBox_CheckTouch(_TEXTBOX *textbox)
{
uint16 x,y,temp;
temp=GetTouch(&x,&y);
if(temp)
{
if((x>=textbox->x)&&(y>=textbox->y)&&(x<=(textbox->x+textbox->width))&&(y<=(textbox->y+textbox->height)))
{
TextBox_Touch(textbox);
return GetTouchStatus();
}
}
TextBox_Untouch(textbox);
return 0;
}
void TextBox_PrintText(_TEXTBOX *textbox,uint8 *s)
{
uint8 i;
for(i=0;i<CPSTRSIZE;i++)
{
textbox->text[i]=*(s+i);
if(*(s+i)=='\0')
break;
}
textbox->updataText=0x01;
TextBox_Updata(textbox);
}
void Frame_Updata(_FRAME *frame)
{
uint16 _fWidth,_totalFontWidth;
uint16 color,fcolor;
uint16 _fx,_fy;
uint8 _len;
if(frame->updata)
{
if(frame->selected||frame->touch)
{color=frame->selColor;fcolor=frame->selFColor;}
else
{color=frame->color;fcolor=frame->fontColor;}

_fWidth=FONTWIDTH*frame->fontSize;
_len=0;
while(frame->caption[_len]!='\0')
{
_len++;
}
_totalFontWidth=_fWidth*_len;
if(frame->style)
LCD_DrawRectangle(frame->x,frame->y,frame->width,frame->height,color);
else
{
LCD_FillWidow(frame->x+1,frame->y+1,frame->width-2,frame->height-2,color);
LCD_DrawRectangle(frame->x,frame->y,frame->width,frame->height,0x00);
}
SetFontStyle(fcolor,0x00,frame->fontSize,0);
_fx=((frame->width/2+frame->x)-(_totalFontWidth/2));
_fy=(2+frame->y);
LCD_PrintString(_fx,_fy,frame->caption);
frame->updata=0;
frame->touch=0x00;
}
}
void Frame_Creat(_FRAME *frame,uint16 _frmx,uint16 _frmy, uint16 _frmwidth, uint16 _frmheight,
uint16 _frmcolor,uint8 *s,uint16 _fcolor,uint8 _fscale,uint8 style )
{
uint8 i;
frame->x=_frmx;
frame->y=_frmy;
frame->width=_frmwidth;
frame->height=_frmheight;
frame->color=_frmcolor;
frame->fontColor=_fcolor;
frame->selColor=SELCOLOR;
frame->selFColor=SELFONTCOLOR;
frame->fontSize=_fscale;
frame->style=style;
frame->updata=1;
frame->selected=0;
frame->touch=0;
for(i=0;i<CPSTRSIZE;i++)
{
frame->caption[i]=*(s+i);
if(*(s+i)=='\0')
break;
}
Frame_Updata(frame);
}
void Frame_SetSelectedColor(_FRAME *frame,uint16 _bcolor, uint16 _fcolor)
{
frame->selColor=_bcolor;
frame->selFColor=_fcolor;
frame->updata=1;
Frame_Updata(frame);
}
void Frame_Selected(_FRAME *frame)
{
if(!frame->selected)
{
frame->selected=0x01;
frame->updata=1;
Frame_Updata(frame);
}
}
void Frame_Unselected(_FRAME *frame)
{
if(frame->selected)
{
frame->selected=0x00;
frame->updata=1;
Frame_Updata(frame);
}
}
void Frame_SetCaption(_FRAME *frame,uint8 *s)
{
uint8 i;
for(i=0;i<CPSTRSIZE;i++)
{
frame->caption[i]=*(s+i);
if(*(s+i)=='\0')
break;
}
frame->updata=1;
Frame_Updata(frame);
}
void Button_Updata(_BUTTON *button)
{
uint16 _fWidth,_totalFontWidth,_fHeight;
uint16 _fx,_fy;
uint8 _len;
uint16 color,fcolor;
if(button->updata)
{
if(button->selected||button->touch)
{color=button->selColor;fcolor=button->selFColor;}
else
{color=button->color;fcolor=button->fontColor;}

_fWidth=FONTWIDTH*button->fontSize;
_fHeight=FONTHEIGHT*button->fontSize;

_len=0;
while(button->caption[_len]!='\0')
{
_len++;
}
_totalFontWidth=_fWidth*_len;
LCD_DrawRectangle(button->x,button->y,button->width,button->height,0x00);
LCD_FillWidow(button->x+1,button->y+1,button->width-2,button->height-2,color);

SetFontStyle(fcolor,color,button->fontSize,1);
_fx=((button->width/2+button->x)-(_totalFontWidth/2));
_fy=(button->height/2+button->y)-(_fHeight/2);
LCD_PrintString(_fx,_fy,button->caption);
button->updata=0;
}
}
void Button_Creat(_BUTTON *button,uint16 _bx,uint16 _by, uint16 _bwidth, uint16 _bheight,
uint16 _bcolor,uint8 *s,uint16 _fcolor,uint8 _fscale )
{
uint8 i;
button->x=_bx;
button->y=_by;
button->width=_bwidth;
button->height=_bheight;
button->color=_bcolor;
button->fontColor=_fcolor;

button->selColor=SELCOLOR;
button->selFColor=SELFONTCOLOR;
button->fontSize=_fscale;

button->updata=1;
for(i=0;i<CPSTRSIZE;i++)
{
button->caption[i]=*(s+i);
if(*(s+i)=='\0')
break;
}
Button_Updata(button);
}
void Button_SetSelectedColor(_BUTTON *button,uint16 _bcolor, uint16 _fcolor)
{
button->selColor=_bcolor;
button->selFColor=_fcolor;
Button_Updata(button);
}
void Button_Selected(_BUTTON *button)
{
if(!button->selected)
{
button->selected=0x01;
button->updata=0x01;
Button_Updata(button);
}
}
void Button_Unselected(_BUTTON *button)
{
if(button->selected)
{
button->selected=0x00;
button->updata=0x01;
Button_Updata(button);
}
}
void Button_Touch(_BUTTON *button)
{
if(!button->touch)
{
button->touch=0x01;
button->updata=0x01;
Button_Updata(button);
}
}
void Button_Untouch(_BUTTON *button)
{
if(button->touch)
{
button->touch=0x00;
button->updata=0x01;
Button_Updata(button);
}
}
uint8 Button_CheckTouch(_BUTTON *button)
{
uint16 x,y,temp;
temp=GetTouch(&x,&y);
if(temp)
{
if((x>=button->x)&&(y>=button->y)&&(x<=(button->x+button->width))&&(y<=(button->y+button->height)))
{
Button_Touch(button);
return GetTouchStatus();
}
}
Button_Untouch(button);
return 0;
}
const uint8 R_Sign[4][16]=
{
{0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x05,0x0D,0x99,0xF9,0x71,0x01,0x01,0xFF},
{0xFF,0x80,0x80,0xC0,0xA0,0xB0,0x98,0x8C,0x86,0x83,0x81,0x80,0x80,0x80,0x80,0xFF},//check true
{0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF},
{0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFF},//check fause
};
void CheckBox_Updata(_CHECKBOX *checkbox)
{
// uint8 i;
uint8 j,k;
uint8 width,height;
uint16 temp0,temp1,temp;
// uint8 flag;
uint8 _len;
if(checkbox->updata)
{
_len=0;
while(checkbox->caption[_len]!='\0')
{
_len++;
}
width = FONTWIDTH*checkbox->scale;
height = FONTHEIGHT*checkbox->scale;
checkbox->width=width*(_len+1);
checkbox->height=height;
for(j=0;j<height;j++)
{
temp=j/checkbox->scale;
if(checkbox->value)
{
temp0=R_Sign[0][temp];
temp1=R_Sign[1][temp];
}
else
{
temp0=R_Sign[2][temp];
temp1=R_Sign[3][temp];
}
for(k=0;k<width;k++)
{
if(temp0&0x01)
LCD_PutPixel(checkbox->x+k,checkbox->y+j,checkbox->color);
else
LCD_PutPixel(checkbox->x+k,checkbox->y+j,checkbox->backColor);
if(temp1&0x01)
LCD_PutPixel(checkbox->x+k+width,checkbox->y+j,checkbox->color);
else
LCD_PutPixel(checkbox->x+k+width,checkbox->y+j,checkbox->backColor);
if((k%checkbox->scale)==(checkbox->scale-1))
{
temp0>>=1;
temp1>>=1;
}
}
}
SetFontStyle(checkbox->color,checkbox->backColor,checkbox->scale,1);
LCD_PrintString(checkbox->x+width*2+3,checkbox->y,checkbox->caption);
checkbox->updata=0x00;
}
}
void Checbox_Creat(_CHECKBOX *checkbox,uint16 x,uint16 y,uint8 *s,uint16 color,uint16 backcolor,uint8 scale,uint8 val )
{
uint8 i;
checkbox->x=x;
checkbox->y=y;
for(i=0;i<CPSTRSIZE;i++)
{
checkbox->caption[i]=*(s+i);
if(*(s+i)=='\0')
break;
}
checkbox->color=color;
checkbox->backColor=backcolor;
checkbox->scale=scale;
checkbox->value=val;
checkbox->updata=0x01;
CheckBox_Updata(checkbox);
}
uint8 CheckBox_GetValue(_CHECKBOX *checkbox){return checkbox->value;}
void CheckBox_SetValue(_CHECKBOX *checkbox,uint8 x){checkbox->value=x;checkbox->updata=1;CheckBox_Updata(checkbox);}
uint8 CheckBox_CheckTouch(_CHECKBOX *checkbox)
{
uint16 x,y,temp;
temp=GetTouch(&x,&y);
if(temp)
{
if((x>=checkbox->x)&&(y>=checkbox->y)&&(x<=(checkbox->x+checkbox->width))&&(y<=(checkbox->y+checkbox->height)))
{
return GetTouchStatus();
}
}
return 0;
}
void Bucket_Updata(_BUCKET *bucket)
{
uint16 _fWidth,_totalFontWidth;
uint16 _fx,_fy;
uint16 perline;
uint8 _len,i;
uint8 temp;
uint16 fluidColor;
uint16 color,bcolor;
if(bucket->updata)
{
if(bucket->selected||bucket->touch)
{color=bucket->selColor;bcolor=bucket->selBColor;}
else
{color=bucket->color;bcolor=bucket->backColor;}
LCD_DrawLine(bucket->x,bucket->y,bucket->x,(bucket->y+bucket->height),color);//|
LCD_DrawLine(bucket->x,(bucket->y+bucket->height),(bucket->x+bucket->width),(bucket->y+bucket->height),color);//_
LCD_DrawLine((bucket->x+bucket->width),bucket->y,(bucket->x+bucket->width),(bucket->y+bucket->height),color);//|
_fWidth=FONTWIDTH;
_len=0;
while(bucket->caption[_len]!='\0')
{
_len++;
}
_totalFontWidth=_fWidth*_len;
SetFontStyle(color,bcolor,1,0);
_fx=((bucket->width/2+bucket->x)-(_totalFontWidth/2));
_fy=(2+bucket->y);
LCD_PrintString(_fx,_fy,bucket->caption);

LCD_DrawLine(bucket->x,bucket->y,bucket->x,(bucket->y+bucket->height),color);//|
LCD_DrawLine(bucket->x,(bucket->y+bucket->height),(bucket->x+bucket->width),(bucket->y+bucket->height),color);//_
LCD_DrawLine((bucket->x+bucket->width),bucket->y,(bucket->x+bucket->width),(bucket->y+bucket->height),color);//|
bucket->updata=0x00;
}
if(bucket->updataVal)
{
if(bucket->selected||bucket->touch)
{color=bucket->selColor;bcolor=bucket->selBColor;}
else
{color=bucket->color;bcolor=bucket->backColor;}
_fy=bucket->y+bucket->height-1;
temp=bucket->height-19;
perline=(bucket->value*temp)/100;
if(bucket->value<15)
fluidColor=0xC000;
else
fluidColor=0x6BC0;
for(i=0;i<temp;i++)
{
if(i<perline)
LCD_DrawLine(bucket->x+1,(_fy-i),(bucket->x+bucket->width),(_fy-i),fluidColor);//_
else
LCD_DrawLine(bucket->x+1,(_fy-i),(bucket->x+bucket->width),(_fy-i),bcolor);//_
}
bucket->updataVal=0x00;
}
}
void Bucket_Creat(_BUCKET *bucket ,uint16 x, uint16 y, uint16 w, uint16 h, uint16 color, uint16 backcolor, uint8 *s)
{
uint8 i;
bucket->x=x;
bucket->y=y;
bucket->width=w;
bucket->height=h;
bucket->color=color;
bucket->backColor=backcolor;
bucket->selColor=RED;
bucket->selBColor=0x0ffff;
bucket->selected=0x00;
for(i=0;i<CPSTRSIZE;i++)
{
bucket->caption[i]=*(s+i);
if(*(s+i)=='\0')
break;
}
bucket->updata=0x01;
Bucket_Updata(bucket);
}
void Bucket_SetSelectedColor(_BUCKET *bucket,uint16 color, uint16 backcolor)
{
bucket->selColor=color;
bucket->selBColor=backcolor;
bucket->updata=0x01;
Bucket_Updata(bucket);
}
void Bucke_SettValue(_BUCKET *bucket,uint8 val)
{
bucket->value=val;
bucket->updataVal=0x01;
Bucket_Updata(bucket);
}
void Bucke_Selected(_BUCKET *bucket)
{
if(!bucket->selected)
{
bucket->updata=0x01;
bucket->selected=0x01;
Bucket_Updata(bucket);
}
}
void Bucke_Unselected(_BUCKET *bucket)
{
if(bucket->selected)
{
bucket->updata=0x01;
bucket->selected=0x00;
Bucket_Updata(bucket);
}
}
void Bucke_Touch(_BUCKET *bucket)
{
if(!bucket->touch)
{
bucket->updata=0x01;
bucket->touch=0x01;
Bucket_Updata(bucket);
}
}
void Bucke_Untouch(_BUCKET *bucket)
{
if(bucket->touch)
{
bucket->updata=0x01;
bucket->touch=0x00;
Bucket_Updata(bucket);
}
}
uint8 Bucket_CheckTouch(_BUCKET *bucket)
{
uint16 x,y,temp;
temp=GetTouch(&x,&y);
if(temp)
{
if((x>=bucket->x)&&(y>=bucket->y)&&(x<=(bucket->x+bucket->width))&&(y<=(bucket->y+bucket->height)))
{
Bucke_Touch(bucket);
return GetTouchStatus();
}
}
Bucke_Untouch(bucket);
return 0;
}
void Valve_Updata(_VALVE *valve)
{
uint16 midy,py;
uint16 color,bcolor;
uint8 i;
if(valve->updata)
{
if(valve->selected||valve->touch)
{color=valve->selColor;bcolor=valve->selBColor;}
else
{color=valve->color;bcolor=valve->backColor;}
LCD_FillWidow(valve->x,valve->y,valve->width,valve->height,bcolor);
if(!valve->value)
{
for(i=0;i<valve->width;i++)
LCD_DrawLine(valve->x+i,valve->y,valve->x+valve->width-i,valve->y+valve->height,color);//_
midy=valve->height/2;
py=valve->height/10;
if(py==0)
py=1;
else if(py>2)
midy=midy-py/2;
for(i=0;i<py;i++)
{
LCD_DrawLine(valve->x,valve->y+midy-i,valve->x+valve->width,valve->y+midy-i,color);//_
}
}
else
{
LCD_DrawLine(valve->x,valve->y,valve->x+valve->width,valve->y+valve->height,color);//_
LCD_DrawLine(valve->x+valve->width,valve->y,valve->x,valve->y+valve->height,color);//_
LCD_DrawLine(valve->x,valve->y,valve->x+valve->width,valve->y,valve->color);//_
LCD_DrawLine(valve->x,valve->y+valve->height,valve->x+valve->width,valve->y+valve->height,color);//_
}
valve->updata=0x00;
}
}
void Valve_Creat(_VALVE *valve, uint16 x, uint16 y, uint16 width, uint16 height, uint16 color, uint16 bcolor)
{
valve->x=x;
valve->y=y;
valve->width=width;
valve->height=height;
valve->color=color;
valve->backColor=bcolor;
valve->selColor=RED;
valve->selBColor=0x0ffff;
valve->selected=0x00;
valve->updata=0x01;
valve->value=0x00;
Valve_Updata(valve);
}
void Valve_SetSelectedColor(_VALVE *valve,uint16 color, uint16 backcolor)
{
valve->selColor=color;
valve->selBColor=backcolor;
valve->updata=0x01;
Valve_Updata(valve);
}
uint8 Valve_SetValue(_VALVE *valve,uint8 val)
{
uint8 temp=0;
uint8 temp1;
valve->updata=0x01;
if(valve->device.id)
{
temp1=valve->value;
valve->value=val;
#if (!SYSDEBUG)
if(valve->value)
temp=BroadcastSetValve(valve);
else
temp=BroadcastResetValve(valve);
#else
temp=0x01;
#endif
if(!temp)
valve->value=temp1;
}
else
temp=0x01;
Valve_Updata(valve);
return temp;
}
void Valve_Selected(_VALVE *valve)
{
if(!valve->selected)
{
valve->selected=0x01;
valve->updata=0x01;
Valve_Updata(valve);
}
}
void Valve_Unselected(_VALVE *valve)
{
if(valve->selected)
{
valve->selected=0x00;
valve->updata=0x01;
Valve_Updata(valve);
}
}
void Valve_Touch(_VALVE *valve)
{
if(!valve->touch)
{
valve->touch=0x01;
valve->updata=0x01;
Valve_Updata(valve);
}
}
void Valve_Untouch(_VALVE *valve)
{
if(valve->touch)
{
valve->touch=0x00;
valve->updata=0x01;
Valve_Updata(valve);
}
}
uint8 Valve_CheckTouch(_VALVE *valve)
{
uint16 x,y,temp;
temp=GetTouch(&x,&y);
if(temp)
{
if((x>=valve->x)&&(y>=valve->y)&&(x<=(valve->x+valve->width))&&(y<=(valve->y+valve->height)))
{
Valve_Touch(valve);
return GetTouchStatus();
}
}
Valve_Untouch(valve);
return 0;
}
void Moto_Updata(_MOTO *moto)
{
uint16 r,x,y;
uint8 s;
uint16 color,bcolor;
if(moto->updata)
{
if(moto->selected||moto->touch)
{color=moto->selColor;bcolor=moto->selBColor;}
else
{color=moto->color;bcolor=moto->backColor;}
LCD_FillWidow(moto->x,moto->y,moto->width,moto->height,bcolor);
r=(moto->width>moto->height)?(moto->height/2):(moto->width/2);
x=moto->x+(moto->width/2);
y=moto->y+(moto->height/2);
s=(r*2)/16;
if(s==0)
s=1;
if(moto->value)
{
while(r)
{
LCD_DrawCircle(x,y,r,RED);
r--;
}
}
else
{
LCD_DrawCircle(x,y,r,color);
LCD_DrawCircle(x,y,r-1,color);
LCD_DrawCircle(x,y,r-3,color);
}
SetFontStyle(color,bcolor,s,0);
LCD_PrintString(moto->x+moto->width+3,moto->y+2,"M");
moto->updata=0x00;
}
}
void Moto_Creat(_MOTO *moto,uint16 x,uint16 y, uint16 width, uint16 height, uint16 color, uint16 bcolor)
{
moto->x=x;
moto->y=y;
moto->width=width;
moto->height=height;
moto->color=color;
moto->backColor=bcolor;
moto->selColor=RED;
moto->selBColor=0x0ffff;
moto->updata=0x01;
moto->selected=0x00;
moto->value=0x00;
Moto_Updata(moto);
}
void Moto_Selected(_MOTO *moto)
{
if(!moto->selected)
{
moto->selected=0X01;
moto->updata=0X01;
Moto_Updata(moto);
}
}
void Moto_Unselected(_MOTO *moto)
{
if(moto->selected)
{
moto->selected=0X00;
moto->updata=0X01;
Moto_Updata(moto);
}
}
void Moto_Touch(_MOTO *moto)
{
if(!moto->touch)
{
moto->touch=0X01;
moto->updata=0X01;
Moto_Updata(moto);
}
}
void Moto_Untouch(_MOTO *moto)
{
if(moto->touch)
{
moto->touch=0X00;
moto->updata=0X01;
Moto_Updata(moto);
}
}
void Moto_SetSelectedColor(_MOTO *moto,uint16 color, uint16 bcolor)
{
moto->selColor=color;
moto->selBColor=bcolor;
moto->updata=0x01;
Moto_Updata(moto);
}
uint8 Moto_CheckTouch(_MOTO *moto)
{
uint16 x,y,temp;
temp=GetTouch(&x,&y);
if(temp)
{
if((x>=moto->x)&&(y>=moto->y)&&(x<=(moto->x+moto->width))&&(y<=(moto->y+moto->height)))
{
Moto_Touch(moto);
return GetTouchStatus();
}
}
Moto_Untouch(moto);
return 0;
}
uint8 Moto_SetValue(_MOTO *moto, uint8 val)
{
uint8 temp;
uint8 temp1;
moto->updata=0x01;
if(moto->device.id)
{
temp1=moto->value;
moto->value=val;
#if(!SYSDEBUG)
if(moto->value)
temp=BroadcastSetMoto(moto);
else
temp=BroadcastResetMoto(moto);
#else
temp=0x01;
#endif
if(!temp)
moto->value=temp1;
}
else
temp=0x01;
Moto_Updata(moto);
return temp;
}
void Light_Updata(_LIGHT *light)
{
uint16 r,x,y;
uint8 s;
uint16 color,bcolor;
if(light->updata)
{
if(light->selected||light->touch)
{color=light->selColor;bcolor=light->selBColor;}
else
{color=light->color;bcolor=light->backColor;}
LCD_FillWidow(light->x,light->y,light->width,light->height,bcolor);
r=(light->width>light->height)?(light->height/2):(light->width/2);
x=light->x+(light->width/2);
y=light->y+(light->height/2);
s=(r*2)/16;
if(s==0)
s=1;
if(light->value)
{
while(r)
{
LCD_DrawCircle(x,y,r,RED);
r--;
}
}
else
{
while(r)
{
LCD_DrawCircle(x,y,r,color);
r--;
};
}
SetFontStyle(color,bcolor,s,0);
LCD_PrintString(light->x+light->width+3,light->y+2,light->caption);
light->updata=0x00;
}
}
void Light_Creat(_LIGHT *light,uint16 x, uint16 y, uint16 width, uint16 height,
uint16 color, uint16 bcolor,uint8 *s)
{
uint8 i;
light->x=x;
light->y=y;
light->width=width;
light->height=height;
light->color=color;
light->backColor=bcolor;
light->selColor=RED;
light->selBColor=0x0ffff;
light->updata=0x01;
light->value=0x00;
light->selected=0x00;
for(i=0;i<CPSTRSIZE;i++)
{
light->caption[i]=*(s+i);
if(*(s+i)=='\0')
break;
}
light->updata=0x01;
Light_Updata(light);
}
uint8 Light_SetValue(_LIGHT *light, uint8 val)
{
uint8 temp;
uint8 temp1;
light->updata=0x01;
if(light->device.id)
{
temp1=light->value;
light->value=val;
#if(!SYSDEBUG)
if(light->value)
{
temp=BroadcastSetLight(light);
SetLEDN(9);//Set heater LED ON
}
else
{
temp=BroadcastResetLight(light);
ResetLEDN(9);//Set heater LED OFF
}
#else
temp=0x01;
#endif
if(!temp)
light->value=temp1;
}
else
temp=0x01;
Light_Updata(light);
return temp;
}
void Light_SetSelectedColor(_LIGHT *light,uint16 color, uint16 bcolor)
{
light->selColor=color;
light->selBColor=bcolor;
light->updata=0x01;
Light_Updata(light);
}
void Light_Selected(_LIGHT *light)
{
if(!light->selected)
{
light->selected=0X01;
light->updata=0x01;
Light_Updata(light);
}
}
void Light_Unselected(_LIGHT *light)
{
if(light->selected)
{
light->selected=0X00;
light->updata=0x01;
Light_Updata(light);
}
}
void Light_Touch(_LIGHT *light)
{
if(!light->touch)
{
light->touch=0X01;
light->updata=0x01;
Light_Updata(light);
}
}
void Light_Untouch(_LIGHT *light)
{
if(light->touch)
{
light->touch=0X00;
light->updata=0x01;
Light_Updata(light);
}
}
uint8 Light_CheckTouch(_LIGHT *light)
{
uint16 x,y,temp;
temp=GetTouch(&x,&y);
if(temp)
{
if((x>=light->x)&&(y>=light->y)&&(x<=(light->x+light->width))&&(y<=(light->y+light->height)))
{
Light_Touch(light);
return GetTouchStatus();
}
}
Light_Untouch(light);
return 0;
}
void Flowmeter_Updata(_FLOWMETER *flowmeter)
{
uint16 r,x,y;
uint8 s;
uint16 color,bcolor;
if(flowmeter->updata)
{
if(flowmeter->selected||flowmeter->touch)
{color=flowmeter->selColor;bcolor=flowmeter->selBColor;}
else
{color=flowmeter->color;bcolor=flowmeter->backColor;}
LCD_FillWidow(flowmeter->x,flowmeter->y,flowmeter->width,flowmeter->height,bcolor);
r=(flowmeter->width>flowmeter->height)?(flowmeter->height/2):(flowmeter->width/2);
x=flowmeter->x+(flowmeter->width/2);
y=flowmeter->y+(flowmeter->height/2);
s=(r*2)/16;
if(s==0)
s=1;
LCD_DrawCircle(x,y-(r*2)/3,r,color);
LCD_DrawCircle(x,y+(r*2)/3,r,color);
SetFontStyle(flowmeter->color,bcolor,s,0);
LCD_PrintString(flowmeter->x+flowmeter->width+3,flowmeter->y+1,"F");
flowmeter->updata=0x00;
}
}
void Flowmeter_Creat(_FLOWMETER *flowmeter,uint16 x, uint16 y, uint16 width, uint16 height, uint16 color, uint16 bcolor)
{
flowmeter->x=x;
flowmeter->y=y;
flowmeter->width=width;
flowmeter->height=height;
flowmeter->color=color;
flowmeter->backColor=bcolor;
flowmeter->selColor=RED;
flowmeter->selBColor=0x0ffff;
flowmeter->updata=0x01;
flowmeter->value=0x00;
Flowmeter_Updata(flowmeter);
}
void Flowmeter_SetSelectedColor(_FLOWMETER *flowmeter,uint16 color, uint16 backcolor)
{
flowmeter->selColor=color;
flowmeter->selBColor=backcolor;
flowmeter->updata=0x01;
Flowmeter_Updata(flowmeter);
}
void Flowmeter_Selected(_FLOWMETER *flowmeter)
{
if(!flowmeter->selected)
{
flowmeter->selected=0x01;
flowmeter->updata=0x01;
Flowmeter_Updata(flowmeter);
}
}
void Flowmeter_Unselected(_FLOWMETER *flowmeter)
{
if(flowmeter->selected)
{
flowmeter->selected=0x00;
flowmeter->updata=0x01;
Flowmeter_Updata(flowmeter);
}
}
uint8 Flowmeter_CheckTouch(_FLOWMETER *flowmeter)
{
uint16 x,y,temp;
temp=GetTouch(&x,&y);
if(temp)
{
if((x>=flowmeter->x)&&(y>=flowmeter->y)&&(x<=(flowmeter->x+flowmeter->width))&&(y<=(flowmeter->y+flowmeter->height)))
{
Flowmeter_Selected(flowmeter);
return GetTouchStatus();
}
}
Flowmeter_Unselected(flowmeter);
return 0;
}
void DrawPipeline0(uint16 color)//烧蜡出料管
{
// |_ _ _ _
LCD_DrawLine(28,60,28,100,color);//|
LCD_DrawLine(28,100,223,100,color);//-
}
void DrawPipeline1(uint16 color)//硬化油出料管
{
// |_ _ _
LCD_DrawLine(93,60,93,100,color);//|
LCD_DrawLine(93,100,223,100,color);//-
}
void DrawPipeline2(uint16 color)//熔蜡0出料管
{
// |_ _
LCD_DrawLine(158,60,158,100,color);//|
LCD_DrawLine(158,100,223,100,color);//-
}
void DrawPipeline3(uint16 color)//熔蜡1出料管
{
// |_
LCD_DrawLine(223,60,223,100,color);//|
}

void DrawPipeline4(uint16 color)//研磨进料管
{
// |---|
// |_
LCD_DrawLine(28,140,28,180,color);//|
LCD_DrawLine(28,140,190,140,color);//---
LCD_DrawLine(190,140,190,170,color);//|
LCD_DrawLine(190,170,223,170,color);//-
}
void DrawPipeline5(uint16 color)//分散0进料管
{
// |--|
// |_
LCD_DrawLine(93,140,93,180,color);//|
LCD_DrawLine(93,140,190,140,color);//--
LCD_DrawLine(190,140,190,170,color);//|
LCD_DrawLine(190,170,223,170,color);//-
}
void DrawPipeline6(uint16 color)//分散1进料管
{
// |-|
// |_
LCD_DrawLine(158,140,158,180,color);//|
LCD_DrawLine(158,140,190,140,color);//-
LCD_DrawLine(190,140,190,170,color);//|
LCD_DrawLine(190,170,223,170,color);//-
}
void DrawPipeline7(uint16 color)//熔蜡0进料管
{
// |-
// |_
// |_
LCD_DrawLine(125,10,135,10,color);//-
LCD_DrawLine(125,10,125,140,color);//|//熔蜡0进料管道
LCD_DrawLine(125,140,190,140,color);//-
LCD_DrawLine(190,140,190,170,color);//|
LCD_DrawLine(190,170,223,170,color);//-
}
void DrawPipeline8(uint16 color)//熔蜡1进料管
{
// |-
// |_
LCD_DrawLine(190,10,200,10,color);//-
LCD_DrawLine(190,140,190,10,color);//|//熔蜡1进料管道
LCD_DrawLine(190,140,190,170,color);//|
LCD_DrawLine(190,170,223,170,color);//-

}
void DrawPipeline9(uint16 color)// 气阀0-->
{
// -|
LCD_DrawLine(250,100,250,239,color);//|进气阀0(右边)
LCD_DrawLine(223,100,250,100,color);//-进气阀0
}
void DrawPipeline10(uint16 color)//气阀1-->
{
// |-
LCD_DrawLine(205,130,205,239,color);//|进气阀1(左边)
LCD_DrawLine(223,130,205,130,color);//|进气阀1
LCD_DrawLine(223,130,223,170,color);//|
}
void DrawPipeline11(uint16 color)//电机-->流量计
{
// |-
LCD_DrawLine(223,100,223,170,color);//
}
void DrawChannel0(uint16 color)//烧蜡到熔蜡桶0
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline7(color);//熔蜡0进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[RONGLA0_IN]);
Bucke_Selected(&MyBucket[SHAOLA]);
Bucke_Selected(&MyBucket[RONGLA0]);
SetLEDN(SHAOLA);
SetLEDN(RONGLA0);
}
void DrawClearChannel0(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);

}
else
{
DrawPipeline7(color);//熔蜡0进料管
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[RONGLA0_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel1(uint16 color)//烧蜡到熔蜡桶1
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline8(color);//熔蜡1进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[RONGLA1_IN]);
Bucke_Selected(&MyBucket[SHAOLA]);
Bucke_Selected(&MyBucket[RONGLA1]);
SetLEDN(SHAOLA);
SetLEDN(RONGLA1);
}
void DrawClearChannel1(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline8(color);//熔蜡1进料管
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[RONGLA1_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel2(uint16 color)//烧蜡到研磨桶
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline4(color);//研磨进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[YANMO_IN]);
Bucke_Selected(&MyBucket[SHAOLA]);
Bucke_Selected(&MyBucket[YANMO]);
SetLEDN(SHAOLA);
SetLEDN(YANMO);
}
void DrawClearChannel2(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline4(color);//研磨进料管
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[YANMO_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel3(uint16 color)//烧蜡到分散桶0
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline5(color);//分散0进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[FENGSAN0_IN]);
Bucke_Selected(&MyBucket[SHAOLA]);
Bucke_Selected(&MyBucket[FENGSAN0]);
SetLEDN(SHAOLA);
SetLEDN(FENGSAN0);
}
void DrawClearChannel3(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline5(color);//分散0进料管
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[FENGSAN0_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel4(uint16 color)//烧蜡到分散桶1
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline6(color);//分散1进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[FENGSAN1_IN]);
Bucke_Selected(&MyBucket[SHAOLA]);
Bucke_Selected(&MyBucket[FENGSAN1]);
SetLEDN(SHAOLA);
SetLEDN(FENGSAN1);
}
void DrawClearChannel4(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline0(color);//烧蜡出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[SHAOLA_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline6(color);//分散1进料管
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[FENGSAN1_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel5(uint16 color)//硬化油到熔蜡桶0
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline7(color);//熔蜡0进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[RONGLA0_IN]);
Bucke_Selected(&MyBucket[YINGHUAYOU]);
Bucke_Selected(&MyBucket[RONGLA0]);
SetLEDN(YINGHUAYOU);
SetLEDN(RONGLA0);
}
void DrawClearChannel5(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline7(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[RONGLA0_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel6(uint16 color)//硬化油到熔蜡桶1
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline8(color);//熔蜡1进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[RONGLA1_IN]);
Bucke_Selected(&MyBucket[YINGHUAYOU]);
Bucke_Selected(&MyBucket[RONGLA1]);
SetLEDN(YINGHUAYOU);
SetLEDN(RONGLA1);
}
void DrawClearChannel6(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline8(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[RONGLA1_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel7(uint16 color)//硬化油到研磨桶
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline4(color);//研磨进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[YANMO_IN]);
Bucke_Selected(&MyBucket[YINGHUAYOU]);
Bucke_Selected(&MyBucket[YANMO]);
SetLEDN(YINGHUAYOU);
SetLEDN(YANMO);
}
void DrawClearChannel7(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline4(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[YANMO_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel8(uint16 color)//硬化油到分散0
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline5(color);//分散0进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[FENGSAN0_IN]);
Bucke_Selected(&MyBucket[YINGHUAYOU]);
Bucke_Selected(&MyBucket[FENGSAN0]);
SetLEDN(YINGHUAYOU);
SetLEDN(FENGSAN0);
}
void DrawClearChannel8(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline5(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[FENGSAN0_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel9(uint16 color)//硬化油到分散1
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline6(color);//分散0进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[FENGSAN1_IN]);
Bucke_Selected(&MyBucket[YINGHUAYOU]);
Bucke_Selected(&MyBucket[FENGSAN1]);
SetLEDN(YINGHUAYOU);
SetLEDN(FENGSAN1);
}
void DrawClearChannel9(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline1(color);//硬化油出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[YINGHUAYOU_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline6(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[FENGSAN1_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel10(uint16 color)//熔蜡0桶到研磨桶
{
DrawPipeline2(color);//熔蜡0出料管
DrawPipeline4(color);//研磨进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[RONGLA0_OUT]);
Valve_Selected(&MyValve[YANMO_IN]);
Bucke_Selected(&MyBucket[RONGLA0]);
Bucke_Selected(&MyBucket[YANMO]);
SetLEDN(RONGLA0);
SetLEDN(YANMO);
}
void DrawClearChannel10(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline2(color);//熔蜡0出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[RONGLA0_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline4(color);//研磨进料管
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[YANMO_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel11(uint16 color)//熔蜡0桶到分散桶0
{
DrawPipeline2(color);//熔蜡0出料管
DrawPipeline5(color);//分散0进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[RONGLA0_OUT]);
Valve_Selected(&MyValve[FENGSAN0_IN]);
Bucke_Selected(&MyBucket[RONGLA0]);
Bucke_Selected(&MyBucket[FENGSAN0]);
SetLEDN(RONGLA0);
SetLEDN(FENGSAN0);
}
void DrawClearChannel11(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline2(color);//熔蜡0出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[RONGLA0_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline5(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[FENGSAN0_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel12(uint16 color)//熔蜡0桶到分散桶1
{
DrawPipeline2(color);//熔蜡0出料管
DrawPipeline6(color);//分散1进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[RONGLA0_OUT]);
Valve_Selected(&MyValve[FENGSAN1_IN]);
Bucke_Selected(&MyBucket[RONGLA0]);
Bucke_Selected(&MyBucket[FENGSAN1]);
SetLEDN(RONGLA0);
SetLEDN(FENGSAN1);
}
void DrawClearChannel12(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline2(color);//熔蜡0出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[RONGLA0_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline6(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[FENGSAN1_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel13(uint16 color)//熔蜡1桶到研磨桶
{
DrawPipeline3(color);//熔蜡1出料管
DrawPipeline4(color);//研磨进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[RONGLA1_OUT]);
Valve_Selected(&MyValve[YANMO_IN]);
Bucke_Selected(&MyBucket[RONGLA1]);
Bucke_Selected(&MyBucket[YANMO]);
SetLEDN(RONGLA1);
SetLEDN(YANMO);
}
void DrawClearChannel13(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline3(color);//熔蜡1出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[RONGLA1_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline4(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[YANMO_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel14(uint16 color)//熔蜡1桶到分散桶0
{
DrawPipeline3(color);//熔蜡1出料管
DrawPipeline5(color);//分散0进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[RONGLA1_OUT]);
Valve_Selected(&MyValve[FENGSAN0_IN]);
Bucke_Selected(&MyBucket[RONGLA1]);
Bucke_Selected(&MyBucket[FENGSAN0]);
SetLEDN(RONGLA1);
SetLEDN(FENGSAN0);
}
void DrawClearChannel14(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline3(color);//熔蜡1出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[RONGLA1_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline5(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[FENGSAN0_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawChannel15(uint16 color)//熔蜡1桶到分散桶1
{
DrawPipeline3(color);//熔蜡1出料管
DrawPipeline6(color);//分散1进料管
DrawPipeline11(color);
Valve_Selected(&MyValve[RONGLA1_OUT]);
Valve_Selected(&MyValve[FENGSAN1_IN]);
Bucke_Selected(&MyBucket[RONGLA1]);
Bucke_Selected(&MyBucket[FENGSAN1]);
SetLEDN(RONGLA1);
SetLEDN(FENGSAN1);
}
void DrawClearChannel15(uint8 half, uint16 color)
{
if(!half)
{
DrawPipeline3(color);//熔蜡1出料管
DrawPipeline9(color);// 气阀0
Valve_Selected(&MyValve[RONGLA1_OUT]);
Valve_Selected(&MyValve[ARE_IN0]);
}
else
{
DrawPipeline6(color);
DrawPipeline10(color);// 气阀1
Valve_Selected(&MyValve[FENGSAN1_IN]);
Valve_Selected(&MyValve[ARE_IN1]);
}
}
void DrawAllChannel(uint16 color)
{
uint8 i;
DrawPipeline0(color);
DrawPipeline1(color);
DrawPipeline2(color);
DrawPipeline3(color);
DrawPipeline4(color);
DrawPipeline5(color);
DrawPipeline6(color);
DrawPipeline7(color);
DrawPipeline8(color);
DrawPipeline9(color);
DrawPipeline10(color);
DrawPipeline11(color);
for(i=0;i<ALLVALVE;i++)
{
Valve_Unselected(&MyValve[i]);
}
for(i=0;i<ALLBUCKET;i++)
{
Bucke_Unselected(&MyBucket[i]);
ResetLEDN(i);
}
}
void DrawSelectedChannel(uint8 channel, uint16 color,uint16 backcolor)
{
DrawAllChannel(backcolor);
switch(channel)
{
case 0: DrawChannel0(color);break;
case 1: DrawChannel1(color);break;
case 2: DrawChannel2(color);break;
case 3: DrawChannel3(color);break;
case 4: DrawChannel4(color);break;
case 5: DrawChannel5(color);break;
case 6: DrawChannel6(color);break;
case 7: DrawChannel7(color);break;
case 8: DrawChannel8(color);break;
case 9: DrawChannel9(color);break;
case 10: DrawChannel10(color);break;
case 11: DrawChannel11(color);break;
case 12: DrawChannel12(color);break;
case 13: DrawChannel13(color);break;
case 14: DrawChannel14(color);break;
case 15: DrawChannel15(color);break;
default: return;
}
}
void DrawClearChannel(uint8 channel, uint16 color, uint16 backcolor, uint8 half)
{
DrawAllChannel(backcolor);
switch(channel)
{
case 0: DrawClearChannel0(half,color);break;
case 1: DrawClearChannel1(half,color);break;
case 2: DrawClearChannel2(half,color);break;
case 3: DrawClearChannel3(half,color);break;
case 4: DrawClearChannel4(half,color);break;
case 5: DrawClearChannel5(half,color);break;
case 6: DrawClearChannel6(half,color);break;
case 7: DrawClearChannel7(half,color);break;
case 8: DrawClearChannel8(half,color);break;
case 9: DrawClearChannel9(half,color);break;
case 10: DrawClearChannel10(half,color);break;
case 11: DrawClearChannel11(half,color);break;
case 12: DrawClearChannel12(half,color);break;
case 13: DrawClearChannel13(half,color);break;
case 14: DrawClearChannel14(half,color);break;
case 15: DrawClearChannel15(half,color);break;
default: return;
}
}

转载于:https://www.cnblogs.com/lort/p/5718726.html

Light Gui的新特性。 1图层和绘图: 支持多图层,使用与有多图层支持的处理器平台。 支持多图层的软件模拟,支持图层的alpha合并和滑动。 同时支持多种颜色格式的图层,如ragb8888模式、rgb565模式、256色调色板模式。 对每个图层,支持双缓存(double buffer)模式,内部进行了窗口剪切优化。 也支持直画(direct draw)模式,支持内存设备,两者可以配合使用。 支持图层和窗口之前的映射,支持一组窗口动态切换显示到不同大小、不同颜色格式的图层。 支持窗口旋转90度、180度、270度,无需硬件支持。 2风格支持: 支持css风格配置,代码中设置控件的类名,就可以和css配置配合使用。 支持css配置控件不同状态的背景属性,如图片、填充色;前景属性,如图片、颜色;字体属性,如大小、颜色;边框属性,如宽度、颜色、调色板位图、补白等。 支持css配置窗口的一些基本属性,如高宽,透明等。 支持皮肤特性,皮肤的属性包括图标、css配置和调色板位图。 支持多种皮肤,支持在线切换皮肤。 3window模拟器支持: 支持完整的window模拟器,使用visual studio 2005,可以独立于设备,在window环境编写界面代码。 全部由C代码编写,自带基本的C函数库,数学函数库,可以在window,嵌入式设备间无缝移植。 模拟器带来良好的调试特性,界面的相关bug,可以方便的在模拟器上调试,极大的加快软件的开发进度。 支持内存调试模式,可以方便的追踪内存越界,泄漏等问题。 4xml支持: 自带xml解释器,配置文件都使用xml编写,有很好的可读性。 实现了基于xml配置文件的多国语言支持,支持在线切换语言。 5简明易用的控件: 自带多种基本的控件,包括静态文本框、按钮、单行和多行编辑框、列表框、进度条、滚动条、图片、等等。 支持自定义控件,控件代码清晰、简明、容易编写。支持组合控件、对话框控件。配合皮肤配置,能快速实现美工效果和风格。 支持一些较复杂的控件,如文本控件、html显示、软件盘等 6良好的应用移植性 自带基本的C函数库,数学函数库等,可以方便的移植程序库和应用程序。 Light Gui的弱点: 实时性能不是Light GUI强项,不建议使用在实时性要就很高的环境。 在使用风格属性的情况下需要有系统盘的支持,用于存放配置文件和资源。 Light Gui目前是一个图形开发包,没有跨任务的窗口管理系统。 目前只有ucos(增强型,支持系统盘),linux,window平台的移植版本。 Light Gui使用的场合: 需要使用图形库快速实现自有风格的嵌入式设备,比如消费电子设备的二次开发,UI设计。 需要使用Light Gui特性的window程序设计。 Light Gui的商业模式: Light Gui是商业收费软件。 提供软件定制服务。 提供自主设计所需的源代码和库。 Light Gui 的其他特性 Light Gui 主要针对嵌入式操作系统,如嵌入式linux, uC/OS-II 等提供支持。在这些 OS 上,Light Gui 支持以多线程模式运行。其主要技术特性描述如下。 1) 硬件适配性: 可支持各种 32 位处理器架构,如 ARM、MIPS、PowerPC、Blackfin等。 支持各种灰度,彩色显示设备。 可支持各种输入设备,键盘(Keypad)、触摸屏、遥控器等等。 2) 资源消耗: Light GUI 的静态存储随配置选项的不同而不同,最少需占用 800K 静态存储空间。 Light GUI 启动后,初始占用动态存储空间最小为128k。建议系统内存为 2MB 以上。 3) 操作系统适配性: 目前支持uC/OS-II 等操作系统,也可以运行在 Linux/uClinux 操作系统之上,Light GUI自带基础的c函数库,可以方便的移植到支持frambuffer的设备上。 针对嵌入式系统的特殊支持,包括一般性的 I/O 流操作,字节序相关函数等。 4) 窗口子系统特性: 完备的任务内窗口机制和消息传递机制。 5) 图形子系统特性: 提供有增强 GDI 函数,包括光栅操作、复杂区域处理、椭圆、圆弧、多边形以及区域填充等函数。 在提供有兼容于 C99 规范的数学库平台上,还提供有高级二维绘图函数。 通过 Light GUI 的图形抽象层及图形引擎技术,我们也可以让上述高级 GDI 接口在低端显示屏上实现。 各种流行图像文件的支持,包括 Windows BMP、GIF、JPEG、PNG 等(JPEG
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值