You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
393 lines
9.3 KiB
393 lines
9.3 KiB
void pogoda()
|
|
{
|
|
|
|
|
|
myGLCD.setColor(VGA_WHITE);
|
|
myGLCD.setBackColor(VGA_BLUE);
|
|
myGLCD.setFont(BigFont);
|
|
myGLCD.fillScr(VGA_BLUE);
|
|
kalend();
|
|
|
|
//*************************************************************************
|
|
myGLCD.drawBitmap (639, 370, 160, 80, cl);
|
|
myGLCD.drawRoundRect (639, 370, 799, 450); //Clok
|
|
|
|
clc();
|
|
|
|
myGLCD.setColor(0,38,92);
|
|
myGLCD.fillRoundRect(645, 155, 797, 367);//рисуем синий пр-к
|
|
myGLCD.setColor(255, 255, 255);//цвет обводки
|
|
myGLCD.drawRoundRect(645, 155, 797, 367);//прямоугольник с обводкой
|
|
info();
|
|
|
|
myGLCD.setColor(VGA_BLUE);
|
|
myGLCD.setBackColor(255,255,255);
|
|
myGLCD.setFont( Ubuntubold);
|
|
|
|
|
|
//int pos=(10*temperature/90)+42;
|
|
|
|
//*****************************************************************************************
|
|
int xtd=10;
|
|
termdom(xtd);
|
|
int xb=140;
|
|
barometr(xb);
|
|
int xtu=270;
|
|
termul(xtu);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//************************************************************************************************************************************************************
|
|
while(1)
|
|
{
|
|
|
|
|
|
sec=t.sec;
|
|
// myGLCD.setColor(VGA_BLUE);
|
|
// myGLCD.setBackColor(255,255,255);
|
|
// myGLCD.setFont( Ubuntubold);
|
|
// myGLCD.printNumI(sec , 700, 160);
|
|
|
|
if ((sec==0) ||(sec==15) || (sec==30) || (sec==45))
|
|
{
|
|
// myGLCD.setBackColor(0,0,255);
|
|
// myGLCD.drawBitmap (769, 339, 30, 30, jar);
|
|
|
|
|
|
delay(800);
|
|
|
|
clc();
|
|
bmp085();
|
|
|
|
myGLCD.setColor(VGA_BLUE);
|
|
myGLCD.setBackColor(255,255,255);
|
|
myGLCD.setFont( Ubuntubold);
|
|
int tem = tdc*10+tdd;
|
|
int pos=(10*tem/50);
|
|
//bar(x,y, pos,l,h);
|
|
barvert(xtd+58,42, pos,10,340);
|
|
|
|
//bar(x,y, pos,l,h);
|
|
pos=(100*(pressure-730)/50);
|
|
barbarom(xb+58,42, pos,10,340);
|
|
int tem1=tdc*10+tdd;
|
|
pos=(10*(tem1+340)/85);
|
|
//bar(x,y, pos,l,h);
|
|
|
|
int tempul=tu*10+tud;
|
|
pos=(10*(tempul+340)/85);
|
|
//bar(x,y, pos,l,h);
|
|
barult(xtu+58,42, pos,10,340);
|
|
//barvert(xtu+58,42, pos,10,340);
|
|
|
|
}
|
|
|
|
if ((sec==11) || (sec==42) )
|
|
{
|
|
|
|
info();
|
|
}
|
|
|
|
if ((sec==55) || (sec==25) )
|
|
{
|
|
|
|
info();
|
|
|
|
}
|
|
|
|
|
|
//*****************************************************************
|
|
if (myTouch.dataAvailable())
|
|
|
|
{
|
|
myTouch.read();
|
|
int x=myTouch.getX();
|
|
int y=myTouch.getY();
|
|
|
|
// myGLCD.setColor(VGA_BLUE);
|
|
// myGLCD.setBackColor(255,255,255);
|
|
// myGLCD.setFont( Ubuntubold);
|
|
// myGLCD.print("x= " , 650, 32);
|
|
// myGLCD.printNumI(x , 700, 32);
|
|
// myGLCD.setFont( Ubuntubold);
|
|
// myGLCD.print("y= " ,650 , 72);
|
|
// myGLCD.printNumI(y , 700, 72);
|
|
|
|
|
|
|
|
|
|
if ((x>=640) && (x<=799)) // Upper row
|
|
{
|
|
|
|
if ((y>=10) && (y<=150)) //(10, 370, 90, 450); //Install
|
|
{
|
|
kalendarset();
|
|
pogoda();
|
|
}
|
|
|
|
if ((y>=370) && (y<=450)) //(10, 370, 90, 450); //Clok
|
|
{waitForIt1(639, 370, 799, 450);
|
|
prognoz();
|
|
menu();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
//***************************************************************************************************************************************************
|
|
void termdom(int xtd)// xtd- координата начала вывода term dom по х
|
|
{
|
|
myFile.open("termd.raw", O_READ);
|
|
|
|
int n=0;
|
|
int m=0;
|
|
for (int i =0 ; i < 58086; i = i++) {
|
|
n=n+1;
|
|
byte bait = myFile.read();
|
|
|
|
byte bait1 =myFile.read();
|
|
|
|
// w1= (bait - 48) << 4 | (bait1 - 48);
|
|
// w2= (bait2 - 48) << 4 | (bait3 - 48);
|
|
int w= bait<<8|bait1;
|
|
|
|
pic1[n]=w;
|
|
//3199
|
|
if (n>125){
|
|
n=0;
|
|
// myGLCD.drawBitmap (0, 20*m, 320, 10, pic1, 2);
|
|
myGLCD.drawBitmap (xtd, m+8, 126, 1, pic1, 1);
|
|
m=m+1;
|
|
}
|
|
}
|
|
|
|
|
|
// close the file:
|
|
myFile.close();
|
|
int tem=tdc*10+tdd;
|
|
int pos=(10*tem/50);
|
|
//bar(x,y, pos,l,h);
|
|
barvert(xtd+58,42, pos,10,340);
|
|
|
|
|
|
}
|
|
|
|
|
|
void barvert(int x,int y,int pos,int l,int h)//kalendar(days, mon, years); l-длинна шкалы pos-позиция метки положения h-высота
|
|
{
|
|
|
|
//int h=40;//высота шкалы
|
|
myGLCD.setBackColor(0,0,255);
|
|
myGLCD.setColor(150,150,150);
|
|
|
|
myGLCD.fillRoundRect(x-2, y-2, l+x+2, h+y+2);//рисуем серый пр-к
|
|
myGLCD.setColor(255, 255, 255);
|
|
myGLCD.fillRoundRect(x, y, l+x, h+y);//с белой обводкой
|
|
//myGLCD.setColor(255,114,0);
|
|
//myGLCD.fillRoundRect(80, 35, 632, 87);
|
|
if (tdc>27)
|
|
{ myGLCD.setColor(255,50,50);
|
|
myGLCD.fillRoundRect(x+1, y+h-1, l+x-1, h+y-(pos*h/100));//уровень
|
|
myGLCD.fillCircle (l/2+x,y+h+40+3,40);
|
|
myGLCD.setBackColor( 255,0,0);
|
|
}
|
|
else
|
|
{
|
|
myGLCD.setColor(7,120,34);
|
|
myGLCD.fillRoundRect(x+1, y+h-1, l+x-1, h+y-(pos*h/100));//уровень
|
|
myGLCD.fillCircle (l/2+x,y+h+40+3,40);
|
|
myGLCD.setBackColor( 7,120,34);
|
|
}
|
|
myGLCD.setColor(255,255,255);
|
|
myGLCD.setFont( Ubuntubold);
|
|
//myGLCD.setBackColor( VGA_TRANSPARENT);
|
|
myGLCD.print("+" , x-48 , 380+30);
|
|
myGLCD.print("." ,x-48+24+40, 380+30);
|
|
myGLCD.printNumI(tdc, x-48+24, 380+30);
|
|
|
|
//int tdes=temperatur;
|
|
myGLCD.printNumI(tdd , x-48+24+40+20, 380+30);
|
|
|
|
|
|
}
|
|
//**********************************************************************
|
|
|
|
|
|
void barometr(int xb)// xb- координата начала вывода бар по х
|
|
{
|
|
myFile.open("barometr.raw", O_READ);
|
|
|
|
int n=0;
|
|
int m=0;
|
|
for (int i =0 ; i < 58086; i = i++) {
|
|
n=n+1;
|
|
byte bait = myFile.read();
|
|
|
|
byte bait1 =myFile.read();
|
|
|
|
// w1= (bait - 48) << 4 | (bait1 - 48);
|
|
// w2= (bait2 - 48) << 4 | (bait3 - 48);
|
|
int w= bait<<8|bait1;
|
|
|
|
pic1[n]=w;
|
|
//3199
|
|
if (n>125){
|
|
n=0;
|
|
// myGLCD.drawBitmap (0, 20*m, 320, 10, pic1, 2);
|
|
myGLCD.drawBitmap (xb, m+8, 126, 1, pic1, 1);
|
|
m=m+1;
|
|
}
|
|
}
|
|
|
|
|
|
// close the file:
|
|
myFile.close();
|
|
//bar(x,y, pos,l,h);
|
|
|
|
int pos=(100*(pressure-730)/50);
|
|
barbarom(xb+58,42, pos,10,340);
|
|
}
|
|
|
|
|
|
void barbarom(int x,int y,int pos,int l,int h)//kalendar(days, mon, years); l-длинна шкалы pos-позиция метки положения h-высота
|
|
{
|
|
|
|
//int h=40;//высота шкалы
|
|
myGLCD.setBackColor(0,0,255);
|
|
myGLCD.setColor(150,150,150);
|
|
|
|
myGLCD.fillRoundRect(x-2, y-2, l+x+2, h+y+2);//рисуем серый пр-к
|
|
myGLCD.setColor(255, 255, 255);
|
|
myGLCD.fillRoundRect(x, y, l+x, h+y);//с белой обводкой
|
|
//myGLCD.setColor(255,114,0);
|
|
//myGLCD.fillRoundRect(80, 35, 632, 87);
|
|
if (pressure<743)
|
|
{ myGLCD.setColor(0,70,167);
|
|
myGLCD.fillRoundRect(x+1, y+h-1, l+x-1, h+y-(pos*h/100));//син
|
|
myGLCD.fillCircle (l/2+x,y+h+40+3,40);
|
|
myGLCD.setBackColor(0,70,167);
|
|
}
|
|
if ((pressure<755)&&(pressure>742))
|
|
{ myGLCD.setColor(60,212,209);
|
|
myGLCD.fillRoundRect(x+1, y+h-1, l+x-1, h+y-(pos*h/100));//бир
|
|
myGLCD.fillCircle (l/2+x,y+h+40+3,40);
|
|
myGLCD.setBackColor(60,212,209);
|
|
}
|
|
if ((pressure<768)&&(pressure>754))
|
|
{ myGLCD.setColor(230,94,32);
|
|
myGLCD.fillRoundRect(x+1, y+h-1, l+x-1, h+y-(pos*h/100));//ор
|
|
myGLCD.fillCircle (l/2+x,y+h+40+3,40);
|
|
myGLCD.setBackColor(230,94,32);
|
|
}
|
|
|
|
if (pressure>767)
|
|
{
|
|
myGLCD.setColor(250,221,8);
|
|
myGLCD.fillRoundRect(x+1, y+h-1, l+x-1, h+y-(pos*h/100));//ж
|
|
myGLCD.fillCircle (l/2+x,y+h+40+3,40);
|
|
myGLCD.setBackColor(250,221,8);
|
|
}
|
|
myGLCD.setColor(255,255,255);
|
|
myGLCD.setFont( Ubuntubold);
|
|
myGLCD.printNumI(pressure , x-30, 380+30);
|
|
//myGLCD.setBackColor( VGA_TRANSPARENT);
|
|
//myGLCD.print("+" ,20+58 , 380+30);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void termul(int xtu)// xtu- координата начала вывода term dom по х
|
|
{
|
|
myFile.open("termu.raw", O_READ);
|
|
|
|
int n=0;
|
|
int m=0;
|
|
for (int i =0 ; i < 58086; i = i++) {
|
|
n=n+1;
|
|
byte bait = myFile.read();
|
|
|
|
byte bait1 =myFile.read();
|
|
|
|
// w1= (bait - 48) << 4 | (bait1 - 48);
|
|
// w2= (bait2 - 48) << 4 | (bait3 - 48);
|
|
int w= bait<<8|bait1;
|
|
|
|
pic1[n]=w;
|
|
//3199
|
|
if (n>125){
|
|
n=0;
|
|
// myGLCD.drawBitmap (0, 20*m, 320, 10, pic1, 2);
|
|
myGLCD.drawBitmap (xtu, m+8, 126, 1, pic1, 1);
|
|
m=m+1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// close the file:
|
|
myFile.close();
|
|
int tempul=tu*10+tud;
|
|
int pos=(10*(tempul+340)/85);
|
|
//bar(x,y, pos,l,h);
|
|
barult(xtu+58,42, pos,10,340);
|
|
|
|
|
|
}
|
|
|
|
//*******************************************************************************************
|
|
void barult(int x,int y,int pos,int l,int h)//kalendar(days, mon, years); l-длинна шкалы pos-позиция метки положения h-высота
|
|
{
|
|
|
|
//int h=40;//высота шкалы
|
|
myGLCD.setBackColor(0,0,255);
|
|
myGLCD.setColor(150,150,150);
|
|
|
|
myGLCD.fillRoundRect(x-2, y-2, l+x+2, h+y+2);//рисуем серый пр-к
|
|
myGLCD.setColor(255, 255, 255);
|
|
myGLCD.fillRoundRect(x, y, l+x, h+y);//с белой обводкой
|
|
//myGLCD.setColor(255,114,0);
|
|
//myGLCD.fillRoundRect(80, 35, 632, 87);
|
|
if (tdc>27)
|
|
{ myGLCD.setColor(255,50,50);
|
|
myGLCD.fillRoundRect(x+1, y+h-1, l+x-1, h+y-(pos*h/100));//уровень
|
|
myGLCD.fillCircle (l/2+x,y+h+40+3,40);
|
|
myGLCD.setBackColor( 255,0,0);
|
|
}
|
|
else
|
|
{
|
|
myGLCD.setColor(7,120,34);
|
|
myGLCD.fillRoundRect(x+1, y+h-1, l+x-1, h+y-(pos*h/100));//уровень
|
|
myGLCD.fillCircle (l/2+x,y+h+40+3,40);
|
|
myGLCD.setBackColor( 7,120,34);
|
|
}
|
|
myGLCD.setColor(255,255,255);
|
|
myGLCD.setFont( Ubuntubold);
|
|
//myGLCD.setBackColor( VGA_TRANSPARENT);
|
|
myGLCD.print("+" , x-48 , 380+30);
|
|
myGLCD.print("." ,x-48+24+40, 380+30);
|
|
myGLCD.printNumI(tu , x-48+24, 380+30);
|
|
|
|
//int tempul=tu*10+tud;
|
|
//int tdes=tempul;
|
|
myGLCD.printNumI(tud , x-48+24+40+20, 380+30);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//******************************DHT11***********************************
|
|
|
|
|