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.
391 lines
9.8 KiB
391 lines
9.8 KiB
void nigtset ()
|
|
{
|
|
boolean ret=0;
|
|
boolean ohl=1;
|
|
int cur=1;
|
|
int lamp=1;
|
|
int h1=0;
|
|
int m1=0;
|
|
int h2=0;
|
|
int m2=0;
|
|
int lux1=30;
|
|
int lux2=50;
|
|
int tcon=26;
|
|
int tdon=3;
|
|
int tcoff=25;
|
|
int tdoff=1;
|
|
second1=0;
|
|
boolean nighton=1;
|
|
digitalWrite(13, LOW);
|
|
//data**************DATA*********************************************************************************
|
|
data:
|
|
nighton=timernight[0];
|
|
h1=timernight[1];
|
|
m1=timernight[2];
|
|
h2=timernight[3];
|
|
m2=timernight[4];
|
|
lux1=timernight[5];
|
|
lux2=timernight[6];
|
|
ohl=timernight[7];
|
|
tcon=timernight[8];
|
|
tdon=timernight[9];
|
|
tcoff=timernight[10];
|
|
tdoff=timernight[11];
|
|
|
|
|
|
|
|
do {
|
|
//irem();
|
|
// button();
|
|
// delay (100);
|
|
|
|
second1++;
|
|
if (second1>1)
|
|
{ fl=!fl;
|
|
second1=0;
|
|
}
|
|
|
|
do {
|
|
u8g.setColorIndex(1);
|
|
u8g.drawXBMP(0, 0, 128, 64, nightecr);
|
|
|
|
u8g.setColorIndex(0);
|
|
//u8g.setFont(u8g_font_04b_03br);//5x5
|
|
u8g.setFont(u8g_font_courR08);//7x5
|
|
// u8g.setFont(u8g_font_unifont);
|
|
|
|
u8g.setPrintPos(68, 9);
|
|
u8g.print(nighton,DEC); //вкл режима ночь
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(110, 40);
|
|
u8g.print(ohl,DEC); //вкл режима охлаждения
|
|
|
|
u8g.setPrintPos(24, 20); //vkl
|
|
if(h1<10){u8g.print("0");}
|
|
u8g.print(h1,DEC);
|
|
u8g.print(":");
|
|
if(m1<10){u8g.print("0");}
|
|
u8g.print(m1,DEC);
|
|
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(84, 20); //vikl
|
|
if(h2<10){u8g.print("0");}
|
|
u8g.print(h2,DEC);
|
|
u8g.print(":");
|
|
if(m2<10){u8g.print("0");}
|
|
u8g.print(m2,DEC);
|
|
|
|
u8g.setFont(u8g_font_04b_03br);//5x5
|
|
if (lux1<10)
|
|
{u8g.setPrintPos(52, 28); //lux1
|
|
}
|
|
else
|
|
{u8g.setPrintPos(48, 28); //lux1
|
|
}
|
|
u8g.print(lux1,DEC);
|
|
l=lux1*26/100;
|
|
u8g.drawBox(20,24,l,3);
|
|
|
|
if (lux2<10)
|
|
{u8g.setPrintPos(52+66, 28); //lux2
|
|
}
|
|
else
|
|
{u8g.setPrintPos(46+66, 28); //lux2
|
|
}
|
|
u8g.print(lux2,DEC);
|
|
l=lux2*26/100;
|
|
u8g.drawBox(16+68,24,l,3);
|
|
|
|
|
|
u8g.setFont(u8g_font_courR08);//7x5
|
|
u8g.setPrintPos(24,52);
|
|
u8g.print(tcon,DEC); //t целая часть вкл охлаждения
|
|
u8g.print(",");
|
|
u8g.print(tdon,DEC);//t дробная часть вкл охлаждения
|
|
u8g.print(" C");
|
|
|
|
u8g.setFont(u8g_font_courR08);//7x5
|
|
u8g.setPrintPos(84,52);
|
|
u8g.print(tcoff,DEC); //t целая часть выкл охлаждения
|
|
u8g.print(",");
|
|
u8g.print(tdoff,DEC);//t дробная часть выкл охлаждения
|
|
u8g.print(" C");
|
|
|
|
if (cur==1)
|
|
{
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(68,1,6,9);
|
|
if(fl==1){u8g.setColorIndex(0);}
|
|
if(fl==0){u8g.setColorIndex(1);}
|
|
u8g.setPrintPos(68, 9);
|
|
u8g.print(nighton,DEC); //вкл режима ночь
|
|
}
|
|
|
|
//*****************************vrem****************
|
|
|
|
if (cur==2){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(25,21,10,1);
|
|
}
|
|
if (cur==3){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(43,21,10,1);
|
|
}
|
|
if (cur==4){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(85,21,10,1);
|
|
}
|
|
if (cur==5){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(103,21,10,1);
|
|
}
|
|
//***********************************************
|
|
if (cur==6){//lux1
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
|
|
u8g.drawBox(2,29,15,1);
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==7){//lux2
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(65,29,15,1);
|
|
}
|
|
//***********************************************
|
|
if (cur==8)
|
|
{
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(110,32,6,9);
|
|
if(fl==1){u8g.setColorIndex(0);}
|
|
if(fl==0){u8g.setColorIndex(1);}
|
|
//u8g.setPrintPos(68, 9);
|
|
u8g.setPrintPos(110, 40);
|
|
u8g.print(ohl,DEC); //вкл режима охл
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==9){//tc on
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(25,53,10,1);
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==10){//td on
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(41,53,6,1);
|
|
}
|
|
|
|
//*********************** **********************
|
|
|
|
if (cur==11){//tc on
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(25+60,53,11,1);
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==12){//td on
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(41+60,53,6,1);
|
|
}
|
|
|
|
u8g.setColorIndex(1);
|
|
} while( u8g.nextPage() );
|
|
|
|
//**********************PDY********************
|
|
if (irrecv.decode(&results))
|
|
{
|
|
irrecv.resume(); // Receive the next value
|
|
digitalWrite(13, HIGH);
|
|
if(results.value == 0xE908B15) //down
|
|
{ if(cur==1)
|
|
{
|
|
nighton=!nighton;
|
|
}
|
|
if(cur==2)
|
|
{h1=h1-1;
|
|
if(h1<0){h1=23;}
|
|
}
|
|
if(cur==3)
|
|
{m1=m1-1;
|
|
if(m1<0){m1=59;}
|
|
}
|
|
if(cur==4)
|
|
{h2=h2-1;
|
|
if(h2<0){h2=23;}
|
|
}
|
|
if(cur==5)
|
|
{m2=m2-1;
|
|
if(m2<0){m2=59;}
|
|
}
|
|
if(cur==6)
|
|
{lux1=lux1-1;
|
|
if(lux1<0){lux1=0;}
|
|
lamp=lux1*255/100;
|
|
analogWrite(7,lamp);
|
|
}
|
|
if(cur==7)
|
|
{lux2=lux2-1;
|
|
if(lux2<0){lux2=0;}
|
|
lamp=lux2*255/100;
|
|
analogWrite(7,lamp);
|
|
}
|
|
if(cur==8)
|
|
{
|
|
ohl=!ohl;
|
|
}
|
|
if(cur==9)
|
|
{tcon=tcon-1;
|
|
if(tcon<tcoff+1){tcon=tcoff+1;}
|
|
}
|
|
if(cur==10)
|
|
{tdon=tdon-1;
|
|
if(tdon<0){tdon=9;}
|
|
}
|
|
if(cur==11)
|
|
{tcoff=tcoff-1;
|
|
if(tcoff<20){tcoff=20;}
|
|
}
|
|
if(cur==12)
|
|
{tdoff=tdoff-1;
|
|
if(tdoff<0){tdoff=9;}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//*************************
|
|
|
|
|
|
if(results.value == 0xE900B95) //up E900B95
|
|
{ if(cur==1)
|
|
{
|
|
nighton=!nighton;
|
|
}
|
|
if(cur==2)
|
|
{h1=h1+1;
|
|
if(h1>23){h1=0;}
|
|
}
|
|
|
|
if(cur==3)
|
|
{m1=m1+1;
|
|
if(m1>59){m1=0;}
|
|
}
|
|
|
|
if(cur==4)
|
|
{h2=h2+1;
|
|
if(h2>23){h2=0;}
|
|
}
|
|
if(cur==5)
|
|
{m2=m2+1;
|
|
if(m2>59){m2=0;}
|
|
}
|
|
if(cur==6)
|
|
{lux1=lux1+1;
|
|
if(lux1>100){lux1=100;}
|
|
lamp=lux1*255/100;
|
|
analogWrite(7,lamp);
|
|
}
|
|
if(cur==7)
|
|
{lux2=lux2+1;
|
|
if(lux2>100){lux2=100;}
|
|
lamp=lux2*255/100;
|
|
analogWrite(7,lamp);
|
|
}
|
|
if(cur==8)
|
|
{
|
|
ohl=!ohl;
|
|
}
|
|
if(cur==9)
|
|
{tcon=tcon+1;
|
|
if(tcon>35){tcon=35;}
|
|
}
|
|
if(cur==10)
|
|
{tdon=tdon+1;
|
|
if(tdon>9){tdon=0;}
|
|
}
|
|
if(cur==11)
|
|
{tcoff=tcoff+1;
|
|
if(tcoff>tcon-1){tcoff=tcon-1;}
|
|
}
|
|
if(cur==12)
|
|
{tdoff=tdoff+1;
|
|
if(tdoff>9){tdoff=0;}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(results.value == 0xE904BD5) //right E904BD5
|
|
{
|
|
cur=cur+1;
|
|
if (cur>12){cur=1;}
|
|
}
|
|
if(results.value == 0xE90CB55) //left E90CB55
|
|
{
|
|
cur=cur-1;
|
|
if (cur<1){cur=12;}
|
|
}
|
|
if(results.value == 0xE101A04) //enter E101A04
|
|
{int a=tyes();
|
|
if(a==1)
|
|
{timernight[0]=nighton;
|
|
timernight[1]=h1;
|
|
timernight[2]=m1;
|
|
timernight[3]=h2;
|
|
timernight[4]=m2;
|
|
timernight[5]=lux1;
|
|
timernight[6]=lux2;
|
|
timernight[7]=ohl;
|
|
timernight[8]=tcon;
|
|
timernight[9]=tdon;
|
|
timernight[10]=tcoff;
|
|
timernight[11]=tdoff;
|
|
savedatnight();
|
|
delay (500);
|
|
}
|
|
//lamp=l1*255/100;
|
|
//analogWrite(7,lamp);
|
|
nigts=0;
|
|
menu=0;
|
|
nagruz ();
|
|
|
|
|
|
ret=1;
|
|
} //выход с сохранением
|
|
if(results.value == 0xE106A74) //menu E106A74
|
|
{
|
|
nigts=0;
|
|
menu=0;
|
|
ret=1;
|
|
} //выход без сохранения
|
|
|
|
delay (100);
|
|
irrecv.resume(); // Receive the next value
|
|
digitalWrite(13, LOW);
|
|
}//ir
|
|
|
|
//**********************PDY********************
|
|
}while (ret<1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|