#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;
}
}