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.
 
 
 
Play/my718/prognoz.ino

1113 lines
30 KiB

void prognoz()
{
char* weat[] = {"weat1.raw","weat2.raw","weat3.raw","weat4.raw","weat5.raw","weat6.raw","weat7.raw","weat8.raw","weat9.raw"};
byte ind=0;
dtu21();
bmp085(); //pressure 757 temperature 254= 25,4С
uart();//tu tud hu hud volt zn
if (t.hour>19 && t.hour<22)//вечер
{ind=8;
if (hu>83) {ind=4;}
if (hu>93) {ind=6;}
// ind=8; //weat[i]
}
if (t.hour<6 || t.hour>21)//ночь
{ind=5;
if (hu>97) {ind=6;}//weat[i]
}
if (t.hour>5 && t.hour<8)//заря
{ind=7; //weat[i]
}
if (t.hour>7 && t.hour<20)//день
{ind=0; //weat[i]
if (ptoday==2) //пасмурно
{ind=2;
if (hu<50) {ind=1;}//перемен обл
}
if (ptoday==0) {ind=0;}//ясно
if (ptoday==1) {ind=1;}//перемен обл
if (hu>83) {ind=2;}//пасмурно
if (t.hour>8)
{if (hu>95) {ind=3;}//дождь
if ((hu>85)&&(ptoday==3)) {ind=3;}//дождь
}
if ((ptoday==3)&&(hu>83))//проверка прогноза и реальной влажности на дождь
{ind=3;}//дождь
if ((ptoday==6)&&(hu>83))
{ind=3;}//дождь
}
byte bait;
byte bait1;
sd.chdir("/");//установка раб директории
delay (100);
sd.chdir("weat");//установка раб директории
delay (100);
//myFiles.loadBitmap(0, 0, 640, 480, weat[ind]);
myFile.open(weat[ind], O_READ);
int n=0;
int m=0;
int w;
for (int i =0 ; i < 307200; i = i++)
{
n=n+1;
bait = myFile.read();
bait1 =myFile.read();
// w1= (bait - 48) << 4 | (bait1 - 48);
// w2= (bait2 - 48) << 4 | (bait3 - 48);
w= bait<<8|bait1;
pic1[n]=w;
//3199
if (n>639){
n=0;
// myGLCD.drawBitmap (0, 20*m, 320, 10, pic1, 2);
// myGLCD.drawBitmap (0, 2*m, 320, 1, pic1, 2);
myGLCD.drawBitmap (0, m, 640, 1, pic1, 1);
m=m+1;
}
}
// close the file:d
myFile.close();
//********************************************************
sd.chdir("/");//установка раб директории
delay (500);
//************************************** ***************************** *********************** ********************** *********
myGLCD.setFont( SevenSegNumFont);//myGLCD.setFont(BigFont);Ubuntubold
// myGLCD.setColor(255,114,0);
myGLCD.setBackColor( VGA_TRANSPARENT);
myGLCD.setColor(255,242, 0);
myGLCD.printNumI(pressure,280,180-16);// myGLCD.print(":",cx+32+32, cy);
myGLCD.setFont( Ubuntubold);
myGLCD.print("MM",280+103, 180+20-16);
//*********TEMPUL**************************************
// myGLCD.setColor(255,142,21);
myGLCD.setColor(VGA_WHITE);
myGLCD.setBackColor( VGA_TRANSPARENT);
if (zn<2)
{myGLCD.print("-",270, 260+8-16);
}
else
{myGLCD.print("+",270, 260+8-16);
}
myGLCD.print(",",270+88, 260+24-16);
myGLCD.print("C",270+88+20+32+10, 263-16);
myGLCD.setFont( SevenSegNumFont);
if (tu<10)
{ myGLCD.printNumI(tu,270+24+32,260-16);// myGLCD.print(":",cx+32+32, cy);
}
else
{myGLCD.printNumI(tu,270+24,260-16);
}
myGLCD.printNumI(tud,270+88+20,260-16);
//*********HUG**************************************
myGLCD.setColor(129,239,255);
myGLCD.setBackColor( VGA_TRANSPARENT);
myGLCD.setFont( Ubuntubold);
myGLCD.print(",",270+88, 340+24-16);
myGLCD.print("%",270+88+20+32+10, 340+24-16);
myGLCD.setFont( SevenSegNumFont);
myGLCD.printNumI(hu,270+24,340-16);
myGLCD.printNumI(hud,270+88+20,340-16);
//*************tdom*******************************
myGLCD.setColor(5,252,46);
myGLCD.setBackColor( VGA_TRANSPARENT);
myGLCD.setFont( Ubuntubold);
myGLCD.print("+",30, 365+8);
myGLCD.print(",",30+88, 365+27);
myGLCD.print("C",30+88+20+32+10, 365-7);
myGLCD.setFont( SevenSegNumFont);
myGLCD.printNumI(tdc,30+24,365);
//int tem = temperatur;
myGLCD.printNumI(tdd,30+88+20,365);
//**********************************SUN********************
myGLCD.setColor(220,220,220);
myGLCD.setBackColor( VGA_TRANSPARENT);
myGLCD.setFont( Ubuntubold);
if(ind==1)
{myGLCD.setColor(250,100,0);
if ((osv9>9)||(osv9==0))
{myGLCD.printNumI(osv9,260+80,35);
}
else
{myGLCD.print("0",260+80, 35);
myGLCD.printNumI(osv9,260+80+24, 35);
}
}
if(ind>1)
{
if ((osv9>9)||(osv9==0))
{myGLCD.printNumI(osv9,260,35);
}
else
{myGLCD.print("0",260, 35);
myGLCD.printNumI(osv9,260+24, 35);
}
}
if(ind==0)
{ myGLCD.setColor(250,100,0);
if ((osv9>9)||(osv9==0))
{myGLCD.printNumI(osv9,260+63,50);
}
else
{myGLCD.print("0",260+63, 50);
myGLCD.printNumI(osv9,260+24+63, 50);
}
}
//*************Hdom*******************************
myGLCD.setColor(57,255,255);
myGLCD.setBackColor( VGA_TRANSPARENT);
myGLCD.setFont( Ubuntubold);
myGLCD.print("%",40+64+24, 425+16);
myGLCD.setFont( SevenSegNumFont);
// int humidity=35;
myGLCD.printNumI(hdc,40+24,425);
//**********************************TIME********1400*************
int it=0;
myGLCD.setColor(220,220,220);
myGLCD.setBackColor( VGA_TRANSPARENT);
myGLCD.setFont( Ubuntubold);
if (time1[it]/100>9)
{myGLCD.printNumI(time1[it]/100,50,15);
}
else
{myGLCD.print("0",50, 15);
myGLCD.printNumI(time1[it]/100,50+24, 15);
}
myGLCD.print(":00",50+48, 15);
//***************PRES*****
myGLCD.setColor(255,242, 0);
//myGLCD.setColor(255,114,0);
myGLCD.printNumI(pres[it],45-5,70-10);
myGLCD.print("mm",45+72-5, 70-10);
//******************TERMUL****************
myGLCD.setColor(255,250,250);
if (temul[it]<999)
{ myGLCD.print("+" , 41-5 ,110-5);
myGLCD.print("." ,41+48+24-5, 110-5);
myGLCD.print("$" ,41+48+24+24+24-5, 110-5);
if ((temul[it]<100)&&(temul[it]>9))
{ myGLCD.print("0" , 41+24-5 ,110-5);
myGLCD.printNumI(temul[it]/10, 41+48-5, 110-5);
myGLCD.printNumI(temul[it]%10, 41+48+48-5, 110-5);
}
if (temul[it]<10)
{ myGLCD.print("00" ,41+24-5 ,110-5);
// myGLCD.printNumI(temul[index]/10, x+10+16, 30+index*18);
myGLCD.printNumI(temul[it]%10, 41+48+48-5, 110-5);
}
if (temul[it]>99)
{
myGLCD.printNumI(temul[it]/10, 41+24-5, 110-5);
myGLCD.printNumI(temul[it]%10, 41+48+48-5, 110-5);
}
}
else
{
myGLCD.print("-" ,41-5 ,110-5);
myGLCD.print("." ,41+48+24-5, 110-5);
myGLCD.print("$" ,41+48+24+24+24-5, 110-5);
//myGLCD.printNumI((temul[index]-1000)/10, x+10, 30+index*18);
if ((temul[it]-1000<100)&&(temul[it]-1000>9))
{ myGLCD.print("0" ,41+24-5 ,110-5);
myGLCD.printNumI((temul[it]-1000)/10, 41+48-5, 110-5);
myGLCD.printNumI((temul[it]-1000)%10, 41+48+48-5, 110-5);
}
if (temul[it]-1000<10)
{ myGLCD.print("00" ,41+24-5 ,110-5);
// myGLCD.printNumI(temul[index]/10, x+10+16, 30+index*18);
myGLCD.printNumI((temul[it]-1000)%10, 41+48+48-5, 110-5);
}
if (temul[it]-1000>99)
{
myGLCD.printNumI((temul[it]-1000)/10, 41+24-5, 110-5);
myGLCD.printNumI((temul[it]-1000)%10, 41+48+48-5, 110-5);
}
}
//*******HUG******************************************************
myGLCD.setColor(57,255,255);
myGLCD.printNumI(hug[it]/10, 40+24-5, 150-3);
myGLCD.print(". %" ,40+24+48-5, 150-3);
myGLCD.printNumI(hug[it]%10, 40+24+48+24-5, 150-3);
draw();
printprog();
if (rawp==1)
{//delay (1000);
return;
}
while(1)
{
sec=t.sec;
if ((sec==0)||(sec==20)||(sec==40))
{
delay(800);
clc();
}
if ((sec==11) || (sec==42) )
{
info();
}
if ((sec==55) || (sec==25) )
{
info();
}
//*********************************TOUCH********************************
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();
prognoz();
}
if ((y>=370) && (y<=450)) //(10, 370, 90, 450); //Clok
{waitForIt1(639, 370, 799, 450);
readprognoz();
}
}
}//touch
}
delay (200);
}
//*********************************************************************
void draw()
{ myGLCD.setBackColor( VGA_TRANSPARENT);
myGLCD.setColor(255, 255, 255);
for (int i=0; i<3; i++)//верт линии 50
{ myGLCD.drawLine(505, 170-10+i*90, 505, 225-10+i*90);
myGLCD.drawLine(506, 170-10+i*90, 506, 225-10+i*90);
myGLCD.drawLine(507, 170-10+i*90, 507, 225-10+i*90);
}
for (int i=0; i<3; i++)//гориз линии
{ myGLCD.drawLine(505, 223-10+i*90, 615, 223-10+i*90);
myGLCD.drawLine(506, 224-10+i*90, 615, 224-10+i*90);
myGLCD.drawLine(507, 225-10+i*90, 615, 225-10+i*90);
}
for (int i=0; i<3; i++)//шкала по гориз
{
for (int n=505; n<615; n=n+20)
{ myGLCD.drawLine(n, 226-10+i*90, n+2, 226-10+i*90);
myGLCD.drawLine(n, 227-10+i*90, n+2, 227-10+i*90);
myGLCD.drawLine(n, 228-10+i*90, n+2, 228-10+i*90);
}
}
//********************presure***************************
myGLCD.setColor(255,242, 0) ;
if (pres[9]>pres[0]) // выбор цвета графика красный- падает, зеленый-растет, желтый-норма
{ if (pres[9]-pres[0]>2)
{ myGLCD.setColor(255, 0, 0);//down
}
else
{myGLCD.setColor(255,242, 0) ;
}
}
if (pres[9]<pres[0])
{ if (pres[0]-pres[9]>2)
{ myGLCD.setColor(0, 255, 0);//up
}
else
{myGLCD.setColor(255,242, 0) ;
}
}
// рисуем
// for (int i=8; i>=0; i=i-2)//давление через 2 часа
int ind=8;
for (int n=525; n<615; n=n+20)
{ myGLCD.drawLine(n, 223-10, n,223-10-(pres[ind]-740)*2);
myGLCD.drawLine(n+1, 223-10, n+1,223-10-(pres[ind]-740)*2);
myGLCD.drawLine(n-1, 223-10, n-1,223-10-(pres[ind]-740)*2);
myGLCD.drawLine(n+2, 223-10, n+2,223-10-(pres[ind]-740)*2);
myGLCD.drawLine(n-2, 223-10, n-2,223-10-(pres[ind]-740)*2);
myGLCD.drawLine(n+3, 223-10, n+3,223-10-(pres[ind]-740)*2);
myGLCD.drawLine(n-3, 223-10, n-3,223-10-(pres[ind]-740)*2);
myGLCD.drawLine(n+4, 223-10, n+4,223-10-(pres[ind]-740)*2);
ind=ind-2;
}
//********************HUG***************************
myGLCD.setColor(255,242, 0) ;
if (hug[3]>hug[0]) // выбор цвета графика красный- падает, зеленый-растет, желтый-норма
{ if (hug[3]-hug[0]>50)
{ myGLCD.setColor(255, 0, 0);//down
}
else
{myGLCD.setColor(255,242, 0) ;
}
}
if (hug[3]<hug[0])
{ if (hug[0]-hug[3]>50)
{ myGLCD.setColor(0, 255, 0);//up
}
else
{myGLCD.setColor(255,242, 0) ;
}
}
// рисуем
// for (int i=8; i>=0; i=i-2)//hug через 1 часа
ind=4;
for (int n=525; n<615; n=n+20)
{ myGLCD.drawLine(n, 404-10, n,404-10-(hug[ind]/20));
myGLCD.drawLine(n+1, 404-10, n+1,404-10-(hug[ind]/20));
myGLCD.drawLine(n-1, 404-10, n-1,404-10-(hug[ind]/20));
myGLCD.drawLine(n+2, 404-10, n+2,404-10-(hug[ind]/20));
myGLCD.drawLine(n-2, 404-10, n-2,404-10-(hug[ind]/20));
myGLCD.drawLine(n+3, 404-10, n+3,404-10-(hug[ind]/20));
myGLCD.drawLine(n-3, 404-10, n-3,404-10-(hug[ind]/20));
myGLCD.drawLine(n+4, 404-10, n+4,404-10-(hug[ind]/20));
ind=ind-1;
}
//***************Tul************************************
int temul1[4];
for (int i=0 ;i<5; i++)
{
if (temul[i]>1000)
{temul1[i]=-1*(temul[i]-1000);
}
else
{temul1[i]=temul[i];
}
}
int tsr=temul1[0]+temul1[1]+temul1[2]+temul1[3]+temul1[4];
tsr=tsr/5;
myGLCD.setColor(255,242, 0) ;
if (temul1[3]>temul1[0]) // выбор цвета графика красный- падает, зеленый-растет, желтый-норма
{ if (temul1[3]-temul1[0]>10)
{ myGLCD.setColor(255, 0, 0);//down
}
else
{myGLCD.setColor(255,242, 0) ;
}
}
if (temul1[3]<temul1[0])
{ if (temul1[0]-temul1[3]>10)
{ myGLCD.setColor(0, 255, 0);//up
}
else
{myGLCD.setColor(255,242, 0) ;
}
}
// рисуем
ind=4;
int ps;
for (int n=525; n<615; n=n+20)
{
ps=tsr-temul1[ind];
ps=ps/5;
myGLCD.drawLine(n, 315-10, n ,285-10+ps);
myGLCD.drawLine(n+1, 315-10, n+1 ,285-10+ps);
myGLCD.drawLine(n-1, 315-10, n-1 ,285-10+ps);
myGLCD.drawLine(n+2, 315-10, n+2 ,285-10+ps);
myGLCD.drawLine(n-2, 315-10, n-2 ,285-10+ps);
myGLCD.drawLine(n+3, 315-10, n+3 ,285-10+ps);
myGLCD.drawLine(n-3, 315-10, n-3 ,285-10+ps);
myGLCD.drawLine(n+4, 315-10, n+4 ,285-10+ps);
ind=ind-1;
}
}
//*********************************************************************************
//*********************************************************************************
void printprog()
{
char* name;
sd.chdir("/");
delay (200);
sd.chdir("progn");
delay (200);
char token[] = "time day=\"??????????";
//const char token[] = "icon=\"???";//<time day="2014-10-12"> icon="03d"
// Сюда будет сохраняться номер иконки из ответа API
char imageId[6] = "nomer";
char endfile[7] = "weathe";
int st=0;
int st1=0;
if (sd.exists("prognoz.txt"))
{name= "prognoz.txt";
}//установка раб директории
else
{name= "prognoz1.txt";
}
myFile.open(name, O_READ);
delay (500);
byte nd=0;
//myGLCD.print("Prognoz na",40, 20);
byte pdat=0;
byte pmon=0;
char symbol=0;
byte today=0;
byte na=7;
int i = 0, j = 0;
//while( nd < 6)
// while (!myFile.eof())
while(myFile.peek()!=EOF)
{
symbol = myFile.read();
// Сравниваем его с маской
if (symbol == token[i] || token[i] == '?') {
// Если сравнение успешно, то проверяем, не дошли ли мы до
// цифр в названии файла
if ((token[i] == '?') && (j < 10)) {
imageId[j] = symbol;
if (j==5)
pmon=10*(symbol-48);//перевод символа в число мес*10+ед мес
if (j==6)
pmon=pmon+(symbol-48);
if (j==8)
pdat=10*(symbol-48);//перевод символа в число дата*10+ед даты
if (j==9)
pdat=pdat+(symbol-48);
++j;
}
++i;
} else {
// Если сравнение не удалось, то сбрасываем счетчик
i = 0;
j = 0;
}
/* if (symbol == endfile[st])//проверка на окончание файла
{st=st+1;
if (st==5)
{ st1++;
st=0;
if (st1==2){nd=7;}
//wifi=7;
// nd=7;
}
}
else
{st=0;
}
*/
if (j==10)
{
if(na==nd-1)
{ myGLCD.setFont( Ubuntubold);
myGLCD.setColor(255, 255, 255);
if (pdat<10)
{ myGLCD.print(".",480+14+38, 2);
myGLCD.print("0",480+14, 2);
myGLCD.printNumI(pdat,480+14+24,2);
}
else
{myGLCD.print(".",480+14+38, 2);
myGLCD.printNumI(pdat,480+14, 2);
}
if (pmon<10)
{ myGLCD.print("0",480+14+38+18, 2);
myGLCD.printNumI(pmon,480+14+38+18+24, 2);
}
else
{myGLCD.printNumI(pmon,480+14+38+18, 2);
}
}
if(pdat==t.date)
{today=nd;
na=nd;
}
nd = nd++;
}
}
nd=0;
myFile.close();
delay (200);
//*******************************чтение символа погоды и запись его в массив**********************************************************
sd.chdir("/");
delay (200);
sd.chdir("progn");
delay (200);
if (sd.exists("prognoz.txt"))
{name= "prognoz.txt";
}//установка раб директории
else
{name= "prognoz1.txt";
}
delay (200);
myFile.open(name, O_READ);
char token1[] = "var=\"???";
i = 0, j = 0;
byte pogread;
byte pog[2];
nd=0;
st1=0;
//while( nd < 6)
while(myFile.peek()!=EOF)
{
symbol = myFile.read();
// Сравниваем его с маской
if (symbol == token1[i] || token1[i] == '?') {
// Если сравнение успешно, то проверяем, не дошли ли мы до
// цифр в названии файла
if ((token1[i] == '?') && (j < 3)) {
imageId[j] = symbol;
if (j==0)
pogread=10*(symbol-48);//перевод символа в число мес*10+ед мес
if (j==1)
pogread=pogread+(symbol-48);
++j;
}
++i;
} else {
// Если сравнение не удалось, то сбрасываем счетчик
i = 0;
j = 0;
}
/* if (symbol == endfile[st])//проверка на окончание файла
{st=st+1;
if (st==5)
{ st1++;
st=0;
if (st1==2){nd=7;}
//wifi=7;
// nd=7;
}
}
else
{st=0;
}
*/
if (j==3)
{ if(nd==today)
{ pog[0]=pogread;//погода сегодня =0
if(pogread==1)//***************************************
ptoday=0;//*******************значек погоды в инфо
if(pogread==2)//***************************************
ptoday=1;//
if(pogread==11)//***************************************
ptoday=6;//
if(pogread==13)//***************************************
ptoday=4;//
if(pogread==50)//***************************************
ptoday=5;//
if((pogread==3)||(pogread==4))//***************************************
ptoday=2;//
if((pogread==9)||(pogread==10))//***************************************
ptoday=3;//
}
if(nd==today+1)
{pog[1]=pogread;//погода завтра =1
if(pogread==1)//***************************************
pzav=0;//*******************значек погоды в инфо
if(pogread==2)//***************************************
pzav=1;//
if(pogread==11)//***************************************
pzav=6;//
if(pogread==13)//***************************************
pzav=4;//
if(pogread==50)//***************************************
pzav=5;//
if((pogread==3)||(pogread==4))//***************************************
pzav=2;//
if((pogread==9)||(pogread==10))//***************************************
pzav=3;//
}
nd = nd++;
}
}
nd=0;
myFile.close();
delay (200);
//*********вывод иконок погоды на экран******************************************
byte q=0;
byte bait;
byte bait1;
int w;
int n=0;
int m=0;
nd=0;
char* p[]={"01.raw","02.raw","03.raw","04.raw","09.raw","10.raw","11.raw","13.raw","50.raw","01n.raw","02n.raw"};
while( nd < 2)// вывод иконок погоды на экран
{
sd.chdir("/");
delay (200);
sd.chdir("progn");
delay (200);
if (pog[nd]<5)
q=pog[nd]-1;
if(q==0)
{if (t.hour<6 || t.hour>19)//ночь
q=9;
}
if(q==1)
{if (t.hour<6 || t.hour>19)//ночь
q=10;
}
if(q==5)
{if (t.hour<6 || t.hour>19)//ночь
q=4;
}
if (pog[nd]>5 && pog[nd]<13)
q=pog[nd]-5;
if (pog[nd]==13)// снег
q=7;
if (pog[nd]==50)// туман
q=8;
myFile.open(p[q], O_READ);
int n=0;
int m=0;
for (int i =0 ; i < 4225; i = i++)
{
n=n+1;
bait = myFile.read();
bait1 =myFile.read();
// w1= (bait - 48) << 4 | (bait1 - 48);
// w2= (bait2 - 48) << 4 | (bait3 - 48);
w= bait<<8|bait1;
pic1[n]=w;
//3199
if (n>64)
{
n=0;
// myGLCD.drawBitmap (0, 20*m, 320, 10, pic1, 2);
myGLCD.drawBitmap (112+354*nd, m+(28+71-55-12*nd), 65, 1, pic1, 1);
m=m+1;
}
}
// close the file:
myFile.close();
delay (200);
nd = nd++;
}
nd=0;
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (112+354, 28+71-55-14, 112+354+65, 28+71-65+65);
myGLCD.drawRoundRect (112+354-1, 28+71-55-14-1, 112+354+66, 28+71-65+66);
//**********************************TIME*********************
int it=0;
myGLCD.setColor(220,220,220);
myGLCD.setBackColor( VGA_TRANSPARENT);
myGLCD.setFont( Ubuntubold);
if (time1[it]/100>9)
{myGLCD.printNumI(time1[it]/100,50,15);
}
else
{myGLCD.print("0",50, 15);
myGLCD.printNumI(time1[it]/100,50+24, 15);
}
myGLCD.print(":00",50+48, 15);
//*******************************************************************
//******************TERMUL****************
myGLCD.setColor(255,250,250);
if (temul[it]<999)
{ myGLCD.print("+" , 41-5 ,110-5);
myGLCD.print("." ,41+48+24-5, 110-5);
myGLCD.print("$" ,41+48+24+24+24-5, 110-5);
if ((temul[it]<100)&&(temul[it]>9))
{ myGLCD.print("0" , 41+24-5 ,110-5);
myGLCD.printNumI(temul[it]/10, 41+48-5, 110-5);
myGLCD.printNumI(temul[it]%10, 41+48+48-5, 110-5);
}
if (temul[it]<10)
{ myGLCD.print("00" ,41+24-5 ,110-5);
// myGLCD.printNumI(temul[index]/10, x+10+16, 30+index*18);
myGLCD.printNumI(temul[it]%10, 41+48+48-5, 110-5);
}
if (temul[it]>99)
{
myGLCD.printNumI(temul[it]/10, 41+24-5, 110-5);
myGLCD.printNumI(temul[it]%10, 41+48+48-5, 110-5);
}
}
else
{
myGLCD.print("-" ,41-5 ,110-5);
myGLCD.print("." ,41+48+24-5, 110-5);
myGLCD.print("$" ,41+48+24+24+24-5, 110-5);
//myGLCD.printNumI((temul[index]-1000)/10, x+10, 30+index*18);
if ((temul[it]-1000<100)&&(temul[it]-1000>9))
{ myGLCD.print("0" ,41+24-5 ,110-5);
myGLCD.printNumI((temul[it]-1000)/10, 41+48-5, 110-5);
myGLCD.printNumI((temul[it]-1000)%10, 41+48+48-5, 110-5);
}
if (temul[it]-1000<10)
{ myGLCD.print("00" ,41+24-5 ,110-5);
// myGLCD.printNumI(temul[index]/10, x+10+16, 30+index*18);
myGLCD.printNumI((temul[it]-1000)%10, 41+48+48-5, 110-5);
}
if (temul[it]-1000>99)
{
myGLCD.printNumI((temul[it]-1000)/10, 41+24-5, 110-5);
myGLCD.printNumI((temul[it]-1000)%10, 41+48+48-5, 110-5);
}
}
//**************************************************************************
// считывание и вывод температуры
sd.chdir("/");
delay (200);
sd.chdir("progn");
delay (200);
if (sd.exists("prognoz.txt"))
{name= "prognoz.txt";
}//установка раб директории
else
{name= "prognoz1.txt";
}
delay (200);
myFile.open(name, O_READ);
nd=0;
st1=0;
i = 0, j = 0;
char token2[] = "max=\"?????";
char imageId1[4] = "000";
//char zn[2] = "+";
int tmaxim=0;
int tmaximd=0;
// while( nd < 6)
while(myFile.peek()!=EOF)
{
symbol = myFile.read();
// Сравниваем его с маской
if (symbol == token2[i] || token2[i] == '?') {
// Если сравнение успешно, то проверяем, не дошли ли мы до
// цифр в названии файла
if ((token2[i] == '?') && (j < 5)) {
if(j==0)
{ tmaxim=tmaxim+100*(symbol-48);
}
if(j==1)
{ tmaxim=tmaxim+10*(symbol-48);
}
if(j==2)
{ tmaxim=tmaxim+(symbol-48);
}
if(j==4)
{ tmaximd=symbol-48;
if((tmaximd>9)||(tmaximd<1))tmaximd=0;
}
++j;
}
++i;
} else {
// Если сравнение не удалось, то сбрасываем счетчик
i = 0;
j = 0;
}
/* if (symbol == endfile[st])//проверка на окончание файла
{st=st+1;
if (st==5)
{ st1++;
st=0;
if (st1==2){nd=7;}
//wifi=7;
// nd=7;
}
}
else
{st=0;
}
*/
if (j==5)
{//282.62
if(nd==today+1)
{
myGLCD.setColor(251, 181, 168);
myGLCD.setFont( Ubuntubold);
if (tmaxim>=273)
{tmaxim=tmaxim-273;
znzav=1;//+
tuzav=tmaxim;
tudzav=tmaximd;
myGLCD.print("+",557-24, 36);
myGLCD.printNumI(tmaxim,557, 36);
if(tmaxim>9)
{myGLCD.print(".",557+38, 36);
myGLCD.printNumI(tmaximd,557+38+15, 36);
}
else
{myGLCD.print(".",557+24, 36);
myGLCD.printNumI(tmaximd,557+48, 36);
}
}
else
{tmaxim=273-tmaxim;
znzav=0;//-
tuzav=tmaxim;
tudzav=tmaximd;
myGLCD.print("-",557-24, 36);
myGLCD.printNumI(tmaxim,557, 36);
if(tmaxim>9)
{myGLCD.print(".",557+38, 36);
myGLCD.printNumI(tmaximd,557+38+15, 36);
}
else
{myGLCD.print(".",557+24, 36);
myGLCD.printNumI(tmaximd,557+48, 36);
}
}
}
nd = nd++;
tmaxim=0;
tmaximd=0;
}
}
myFile.close();
delay (200);
nd=0;
// считывание и вывод температуры
sd.chdir("/");
delay (200);
sd.chdir("progn");
delay (200);
if (sd.exists("prognoz.txt"))
{name= "prognoz.txt";
}//установка раб директории
else
{name= "prognoz1.txt";
}
delay (200);
myFile.open(name, O_READ);
nd=0;
st1=0;
char token3[] = "min=\"?????";
int tminim=0;
int tminimd=0;
i = 0, j = 0;
//while( nd < 6)
while(myFile.peek()!=EOF)
{
symbol = myFile.read();
// Сравниваем его с маской
if (symbol == token3[i] || token3[i] == '?') {
// Если сравнение успешно, то проверяем, не дошли ли мы до
// цифр в названии файла
if ((token3[i] == '?') && (j < 5)) {
if(j==0)
{ tminim=tminim+100*(symbol-48);
}
if(j==1)
{ tminim=tminim+10*(symbol-48);
}
if(j==2)
{ tminim=tminim+(symbol-48);
}
if(j==4)
{ tminimd=symbol-48;
if((tminimd>9)||(tminimd<1))tminimd=0;
}
++j;
}
++i;
} else {
// Если сравнение не удалось, то сбрасываем счетчик
i = 0;
j = 0;
}
/* if (symbol == endfile[st])//проверка на окончание файла
{st=st+1;
if (st==5)
{ st1++;
st=0;
if (st1==2){nd=7;}
//wifi=7;
// nd=7;
}
}
else
{st=0;
}
*/
if (j==5)
{
if(nd==today+1)
{ myGLCD.setColor(0, 181, 243);
myGLCD.setFont( Ubuntubold);
// myGLCD.print(zn,240-24+24, 60+70*nd);
// myGLCD.print(imageId1,240+24, 60+70*nd);
if (tminim>=273)
{tminim=tminim-273;
myGLCD.print("+",557-24, 71);
myGLCD.printNumI(tminim,557, 71);
if(tminim>9)
{myGLCD.print(".",557+38, 71);
myGLCD.printNumI(tminimd,557+38+15, 71);
}
else
{myGLCD.print(".",557+24, 71);
myGLCD.printNumI(tminimd,557+48, 71);
}
}
else
{tminim=273-tminim;
myGLCD.print("-",557-24, 71);
myGLCD.printNumI(tminim,557, 71);
if(tminim>9)
{myGLCD.print(".",557+38, 71);
myGLCD.printNumI(tminimd,557+38+15, 71);
}
else
{myGLCD.print(".",557+24, 71);
myGLCD.printNumI(tminimd,557+48, 71);
}
}
}
nd = nd++;
tminim=0;
tminimd=0;
}
}
myFile.close();
delay (200);
nd=0;
sd.chdir("/");
delay (2000);
}