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.
672 lines
16 KiB
672 lines
16 KiB
void lampset ()
|
|
{
|
|
boolean ret=0;
|
|
int cur=1;
|
|
int nlampold=nlamp;
|
|
int tu;
|
|
int td;
|
|
int tv;
|
|
int h1=0;
|
|
int m1=0;
|
|
int h2=0;
|
|
int m2=0;
|
|
int h3=0;
|
|
int m3=0;
|
|
int h4=0;
|
|
int m4=0;
|
|
int kan=1;
|
|
int lux1;
|
|
int time1=45;
|
|
int lux2=100;
|
|
int time2;
|
|
|
|
second1=0;
|
|
//data**************DATA*********************************************************************************
|
|
data:
|
|
tu=timer1amp[nlamp-1][0];
|
|
td=timer1amp[nlamp-1][1];
|
|
//tv=timer_1[nlamp-1][2];
|
|
kan=timer1amp[nlamp-1][2];
|
|
h1=timer1amp[nlamp-1][3];
|
|
m1=timer1amp[nlamp-1][4];
|
|
h2=timer1amp[nlamp-1][5];
|
|
m2=timer1amp[nlamp-1][6];
|
|
h3=timer1amp[nlamp-1][7];
|
|
m3=timer1amp[nlamp-1][8];
|
|
h4=timer1amp[nlamp-1][9];
|
|
m4=timer1amp[nlamp-1][10];
|
|
lux1=timer1amp[nlamp-1][11];
|
|
time1=timer1amp[nlamp-1][12];
|
|
lux2=timer1amp[nlamp-1][13];
|
|
time2=timer1amp[nlamp-1][14];
|
|
pn=timer1amp[nlamp-1][15];
|
|
vt=timer1amp[nlamp-1][16];
|
|
sr=timer1amp[nlamp-1][17];
|
|
cht=timer1amp[nlamp-1][18];
|
|
pt=timer1amp[nlamp-1][19];
|
|
sb=timer1amp[nlamp-1][20];
|
|
vs=timer1amp[nlamp-1][21];
|
|
//**************************DO***************************************************************************
|
|
|
|
do {
|
|
//irem();
|
|
// button();
|
|
delay (100);
|
|
|
|
second1++;
|
|
if (second1>1)
|
|
{ fl=!fl;
|
|
second1=0;
|
|
}
|
|
u8g.firstPage();
|
|
do {
|
|
u8g.setColorIndex(1);
|
|
u8g.drawXBMP(0, 0, 128, 64, lamps);
|
|
|
|
// u8g.setColorIndex(0);
|
|
//u8g.setFont(u8g_font_04b_03br);//5x5
|
|
u8g.setFont(u8g_font_courR08);//7x5
|
|
// u8g.setFont(u8g_font_unifont);
|
|
|
|
u8g.setPrintPos(50, 9);
|
|
u8g.print(nlamp,DEC); //nomer timer1ampa
|
|
// u8g.print(".");
|
|
u8g.setColorIndex(0);
|
|
u8g.setPrintPos(117, 9); //nomer kanala nagruzki
|
|
u8g.print(kan,DEC);
|
|
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(24, 31); //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, 31); //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, 39); //lux1
|
|
}
|
|
else
|
|
{u8g.setPrintPos(46, 39); //lux1
|
|
}
|
|
u8g.print(lux1,DEC);
|
|
l=lux1*26/100;
|
|
u8g.drawBox(16,35,l,3);
|
|
|
|
if (time1<10)
|
|
{u8g.setPrintPos(108, 39); //t1
|
|
}
|
|
else
|
|
{u8g.setPrintPos(103, 39); //t1
|
|
}
|
|
u8g.print(time1,DEC);
|
|
|
|
l=time1*26/60;
|
|
u8g.drawBox(74,35,l,3);
|
|
|
|
|
|
|
|
if (lux2<10)
|
|
{u8g.setPrintPos(52, 56); //lux2
|
|
}
|
|
else
|
|
{u8g.setPrintPos(46, 56); //lux2
|
|
}
|
|
u8g.print(lux2,DEC);
|
|
l=lux2*26/100;
|
|
u8g.drawBox(16,52,l,3);
|
|
|
|
if (time2<10)
|
|
{u8g.setPrintPos(108, 56); //t2
|
|
}
|
|
else
|
|
{u8g.setPrintPos(103, 56); //t2
|
|
}
|
|
u8g.print(time2,DEC);
|
|
l=time2*26/60;
|
|
u8g.drawBox(74,52,l,3);
|
|
|
|
|
|
u8g.setFont(u8g_font_courR08);//7x5
|
|
u8g.setPrintPos(24, 48); //vk2
|
|
if(h3<10){u8g.print("0");}
|
|
u8g.print(h3,DEC);
|
|
u8g.print(":");
|
|
if(m3<10){u8g.print("0");}
|
|
u8g.print(m3,DEC);
|
|
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(84, 48); //vik2
|
|
if(h4<10){u8g.print("0");}
|
|
u8g.print(h4,DEC);
|
|
u8g.print(":");
|
|
if(m4<10){u8g.print("0");}
|
|
u8g.print(m4,DEC);
|
|
|
|
|
|
|
|
if(pn==1){u8g.drawBox(10,20,11,1);}
|
|
if(vt==1){u8g.drawBox(26,20,11,1);}
|
|
if(sr==1){u8g.drawBox(42,20,11,1);}
|
|
if(cht==1){u8g.drawBox(57,20,12,1);}
|
|
if(pt==1){u8g.drawBox(73,20,12,1);}
|
|
if(sb==1){u8g.drawBox(89,20,12,1);}
|
|
if(vs==1){u8g.drawBox(105,20,12,1);}
|
|
|
|
if(tu==0)
|
|
{ //u8g.setPrintPos(2, 32);// t1.1
|
|
u8g.setColorIndex(0);
|
|
u8g.drawBox(2,22,124,19);
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(3, 31);// t1.1
|
|
u8g.print("OFF");
|
|
|
|
}
|
|
if(td==0)
|
|
{
|
|
u8g.setColorIndex(0);
|
|
u8g.drawBox(2,41,124,16);
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(3, 49);// t1.1
|
|
u8g.print("OFF");
|
|
}
|
|
|
|
if (cur==1)
|
|
{
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(50,1,6,9);
|
|
if(fl==1){u8g.setColorIndex(0);}
|
|
if(fl==0){u8g.setColorIndex(1);}
|
|
u8g.setPrintPos(50, 9);
|
|
u8g.print(nlamp,DEC); //nomer timer1ampa
|
|
}
|
|
if (cur==2)
|
|
{if(fl==1){u8g.setColorIndex(0);}
|
|
if(fl==0){u8g.setColorIndex(1);}
|
|
u8g.drawBox(117,1,6,9);
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.setPrintPos(117, 9); //nomer kanala nagruzki
|
|
u8g.print(kan,DEC);
|
|
}
|
|
|
|
if (cur==3){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(10,22,11,1);
|
|
}
|
|
if (cur==4){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(26,22,11,1);
|
|
}
|
|
if (cur==5){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(42,22,11,1);
|
|
}
|
|
if (cur==6){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(57,22,12,1);
|
|
}
|
|
if (cur==7){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(73,22,12,1);
|
|
}
|
|
if (cur==8){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(89,22,12,1);
|
|
}
|
|
if (cur==9){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(105,22,12,1);
|
|
}
|
|
//*************************************************
|
|
if (cur==10){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
if(tu==0)
|
|
{u8g.drawBox(3,32,18,1);
|
|
}
|
|
else
|
|
{u8g.drawBox(3,32,5,1);}
|
|
}
|
|
//*****************************vrem****************
|
|
|
|
if (cur==11){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(25,32,10,1);
|
|
}
|
|
if (cur==12){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(43,32,10,1);
|
|
}
|
|
if (cur==13){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(85,32,10,1);
|
|
}
|
|
if (cur==14){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(103,32,10,1);
|
|
}
|
|
//***********************************************
|
|
if (cur==15){//lux1
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
|
|
u8g.drawBox(2,39,10,1);
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==16){//t1
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(67,39,5,1);
|
|
}
|
|
//***********************************************
|
|
if (cur==17){//2
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
if(td==0)
|
|
{u8g.drawBox(3,50,18,1);;
|
|
}
|
|
else
|
|
{u8g.drawBox(3,49,5,1);}
|
|
|
|
|
|
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==18){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(25,49,10,1);
|
|
}
|
|
if (cur==19){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(43,49,10,1);
|
|
}
|
|
if (cur==20){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(85,49,10,1);
|
|
}
|
|
if (cur==21){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(103,49,10,1);
|
|
}
|
|
//***********************************************
|
|
if (cur==22){//lux2
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
|
|
u8g.drawBox(2,56,10,1);
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==23){//t2
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(67,56,5,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)
|
|
{ nlamp=nlamp-1;
|
|
if (nlamp<1){nlamp=1;}
|
|
}
|
|
if(cur==2)
|
|
{ kan=kan-1;
|
|
if (kan<1){kan=1;}
|
|
}
|
|
|
|
if(cur==3)//boolean pn,vt,sr,cht,pt,sb,vs,on,bod;// budilnik
|
|
{ if (pn==1)
|
|
{pn=0;
|
|
}
|
|
else{pn=1;
|
|
}
|
|
}
|
|
if(cur==4)
|
|
{ if (vt==1)
|
|
{vt=0;
|
|
}
|
|
else{vt=1;
|
|
}
|
|
}
|
|
if(cur==5)
|
|
{ if (sr==1)
|
|
{sr=0;
|
|
}
|
|
else{sr=1;
|
|
}
|
|
}
|
|
if(cur==6)
|
|
{ if (cht==1)
|
|
{cht=0;
|
|
}
|
|
else{cht=1;
|
|
}
|
|
}
|
|
if(cur==7)
|
|
{ if (pt==1)
|
|
{pt=0;
|
|
}
|
|
else{pt=1;
|
|
}
|
|
}
|
|
if(cur==8)
|
|
{ if (sb==1)
|
|
{sb=0;
|
|
}
|
|
else{sb=1;
|
|
}
|
|
}
|
|
if(cur==9)
|
|
{ if (vs==1)
|
|
{vs=0;
|
|
}
|
|
else{vs=1;
|
|
}
|
|
}
|
|
if(cur==10)
|
|
{tu=!tu;
|
|
}
|
|
if(cur==11)
|
|
{h1=h1-1;
|
|
if(h1<0){h1=23;}
|
|
}
|
|
if(cur==12)
|
|
{m1=m1-1;
|
|
if(m1<0){m1=59;}
|
|
}
|
|
if(cur==13)
|
|
{h2=h2-1;
|
|
if(h2<0){h2=23;}
|
|
}
|
|
if(cur==14)
|
|
{m2=m2-1;
|
|
if(m2<0){m2=59;}
|
|
}
|
|
if(cur==15)
|
|
{lux1=lux1-1;
|
|
if(lux1<0){lux1=0;}
|
|
}
|
|
if(cur==16)
|
|
{time1=time1-5;
|
|
if(time1<0){time1=0;}
|
|
}
|
|
if(cur==17)
|
|
{td=!td;
|
|
}
|
|
if(cur==18)
|
|
{h3=h3-1;
|
|
if(h3<0){h3=23;}
|
|
}
|
|
if(cur==19)
|
|
{m3=m3-1;
|
|
if(m3<0){m3=59;}
|
|
}
|
|
if(cur==20)
|
|
{h4=h4-1;
|
|
if(h4<0){h4=23;}
|
|
}
|
|
if(cur==21)
|
|
{m4=m4-1;
|
|
if(m4<0){m4=59;}
|
|
}
|
|
if(cur==22)
|
|
{lux2=lux2-1;
|
|
if(lux2<0){lux2=0;}
|
|
}
|
|
if(cur==23)
|
|
{time2=time2-5;
|
|
if(time2<0){time2=0;}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//*************************
|
|
|
|
|
|
if(results.value == 0xE900B95) //up E900B95
|
|
{ if(cur==1)
|
|
{ nlamp=nlamp+1;
|
|
if (nlamp>4){nlamp=4;}
|
|
}
|
|
if(cur==2)
|
|
{ kan=kan+1;
|
|
if (kan>4){kan=4;}
|
|
}
|
|
|
|
if(cur==3)//boolean pn,vt,sr,cht,pt,sb,vs,on,bod;// budilnik
|
|
{ if (pn==1)
|
|
{pn=0;
|
|
}
|
|
else{pn=1;
|
|
}
|
|
}
|
|
if(cur==4)
|
|
{ if (vt==1)
|
|
{vt=0;
|
|
}
|
|
else{vt=1;
|
|
}
|
|
}
|
|
if(cur==5)
|
|
{ if (sr==1)
|
|
{sr=0;
|
|
}
|
|
else{sr=1;
|
|
}
|
|
}
|
|
if(cur==6)
|
|
{ if (cht==1)
|
|
{cht=0;
|
|
}
|
|
else{cht=1;
|
|
}
|
|
}
|
|
if(cur==7)
|
|
{ if (pt==1)
|
|
{pt=0;
|
|
}
|
|
else{pt=1;
|
|
}
|
|
}
|
|
if(cur==8)
|
|
{ if (sb==1)
|
|
{sb=0;
|
|
}
|
|
else{sb=1;
|
|
}
|
|
}
|
|
if(cur==9)
|
|
{ if (vs==1)
|
|
{vs=0;
|
|
}
|
|
else{vs=1;
|
|
}
|
|
}
|
|
if(cur==10)
|
|
{tu=!tu;
|
|
}
|
|
if(cur==11)
|
|
{h1=h1+1;
|
|
if(h1>23){h1=0;}
|
|
}
|
|
if(cur==12)
|
|
{m1=m1+1;
|
|
if(m1>59){m1=0;}
|
|
}
|
|
if(cur==13)
|
|
{h2=h2+1;
|
|
if(h2>23){h2=0;}
|
|
}
|
|
if(cur==14)
|
|
{m2=m2+1;
|
|
if(m2>59){m2=0;}
|
|
}
|
|
if(cur==15)
|
|
{lux1=lux1+1;
|
|
if(lux1>100){lux1=100;}
|
|
}
|
|
if(cur==16)
|
|
{time1=time1+5;
|
|
if(time1>60){time1=60;}
|
|
}
|
|
if(cur==17)
|
|
{td=!td;
|
|
}
|
|
if(cur==18)
|
|
{h3=h3+1;
|
|
if(h3>23){h3=0;}
|
|
}
|
|
if(cur==19)
|
|
{m3=m3+1;
|
|
if(m3>59){m3=0;}
|
|
}
|
|
if(cur==20)
|
|
{h4=h4+1;
|
|
if(h4>23){h4=0;}
|
|
}
|
|
if(cur==21)
|
|
{m4=m4+1;
|
|
if(m4>59){m4=0;}
|
|
}
|
|
if(cur==22)
|
|
{lux2=lux2+1;
|
|
if(lux2>100){lux2=100;}
|
|
}
|
|
if(cur==23)
|
|
{time2=time2+5;
|
|
if(time2>60){time2=60;}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(results.value == 0xE904BD5) //right E904BD5
|
|
{
|
|
cur=cur+1;
|
|
if (cur==11)
|
|
{if (tu==0){cur=17;}
|
|
}
|
|
if (cur==18)
|
|
{if (td==0){cur=1;}
|
|
}
|
|
|
|
if (cur>23){cur=1;}
|
|
}
|
|
if(results.value == 0xE90CB55) //left E90CB55
|
|
{
|
|
cur=cur-1;
|
|
|
|
|
|
|
|
if (cur<1){cur=23;}
|
|
if (cur==23)
|
|
{if (td==0){cur=17;}
|
|
}
|
|
if (cur==16)
|
|
{if (tu==0){cur=10;}
|
|
}
|
|
}
|
|
if(results.value == 0xE101A04) //enter E101A04
|
|
{int a=tyes();
|
|
if(a==1)
|
|
{timer1amp[nlamp-1][0]=tu;
|
|
timer1amp[nlamp-1][1]=td;
|
|
timer1amp[nlamp-1][2]=kan;
|
|
timer1amp[nlamp-1][3]=h1;
|
|
timer1amp[nlamp-1][4]=m1;
|
|
timer1amp[nlamp-1][5]=h2;
|
|
timer1amp[nlamp-1][6]=m2;
|
|
timer1amp[nlamp-1][7]=h3;
|
|
timer1amp[nlamp-1][8]=m3;
|
|
timer1amp[nlamp-1][9]=h4;
|
|
timer1amp[nlamp-1][10]=m4;
|
|
timer1amp[nlamp-1][11]=lux1;
|
|
timer1amp[nlamp-1][12]=time1;
|
|
timer1amp[nlamp-1][13]=lux2;
|
|
timer1amp[nlamp-1][14]=time2;
|
|
timer1amp[nlamp-1][15]=pn;
|
|
timer1amp[nlamp-1][16]=vt;
|
|
timer1amp[nlamp-1][17]=sr;
|
|
timer1amp[nlamp-1][18]=cht;
|
|
timer1amp[nlamp-1][19]=pt;
|
|
timer1amp[nlamp-1][20]=sb;
|
|
timer1amp[nlamp-1][21]=vs;
|
|
savedatlamp();
|
|
nagruzlamp ();
|
|
}
|
|
settimer=0;
|
|
ret=1;
|
|
|
|
|
|
|
|
} //выход с сохранением
|
|
if(results.value == 0xE106A74) //menu E106A74
|
|
{
|
|
settimer=0;
|
|
ret=1;
|
|
} //выход без сохранения
|
|
|
|
delay (100);
|
|
irrecv.resume(); // Receive the next value
|
|
digitalWrite(13, LOW);
|
|
}//ir
|
|
|
|
//**********************PDY********************
|
|
but();
|
|
if((b == 1)|| (b == 11)) //menu E106A74
|
|
{
|
|
settimer=0;
|
|
ret=1;
|
|
} //выход без сохранения
|
|
if(nlamp!=nlampold)
|
|
{
|
|
nlampold=nlamp ;
|
|
goto data;
|
|
}
|
|
digitalWrite(13, LOW);
|
|
}while (ret<1);
|
|
lampse=0;
|
|
delay(300);
|
|
}
|
|
|