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.
688 lines
17 KiB
688 lines
17 KiB
void timerset ()
|
|
{
|
|
|
|
boolean ret=0;
|
|
int cur=1;
|
|
int ntimold=ntim;
|
|
int tu;
|
|
int td;
|
|
int tv;
|
|
int h1;
|
|
int m1;
|
|
int h2;
|
|
int m2;
|
|
int h3;
|
|
int m3;
|
|
int h4;
|
|
int m4;
|
|
int h5;
|
|
int m5;
|
|
int h6;
|
|
int m6;
|
|
int kan;
|
|
|
|
second1=0;
|
|
//secold=now.second();
|
|
//data**************DATA*********************************************************************************
|
|
data:
|
|
tu=timer_1[ntim-1][0];
|
|
td=timer_1[ntim-1][1];
|
|
tv=timer_1[ntim-1][2];
|
|
kan=timer_1[ntim-1][3];
|
|
h1=timer_1[ntim-1][4];
|
|
m1=timer_1[ntim-1][5];
|
|
h2=timer_1[ntim-1][6];
|
|
m2=timer_1[ntim-1][7];
|
|
h3=timer_1[ntim-1][8];
|
|
m3=timer_1[ntim-1][9];
|
|
h4=timer_1[ntim-1][10];
|
|
m4=timer_1[ntim-1][11];
|
|
h5=timer_1[ntim-1][12];
|
|
m5=timer_1[ntim-1][13];
|
|
h6=timer_1[ntim-1][14];
|
|
m6=timer_1[ntim-1][15];
|
|
pn=timer_1[ntim-1][16];
|
|
vt=timer_1[ntim-1][17];
|
|
sr=timer_1[ntim-1][18];
|
|
cht=timer_1[ntim-1][19];
|
|
pt=timer_1[ntim-1][20];
|
|
sb=timer_1[ntim-1][21];
|
|
vs=timer_1[ntim-1][22];
|
|
//**************************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, timer);
|
|
|
|
// 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(ntim,DEC); //nomer timera
|
|
// u8g.print(".");
|
|
u8g.setColorIndex(0);
|
|
u8g.setPrintPos(112, 9); //nomer kanala nagruzki
|
|
u8g.print(kan,DEC);
|
|
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(24, 32); //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, 32); //vikl
|
|
if(h2<10){u8g.print("0");}
|
|
u8g.print(h2,DEC);
|
|
u8g.print(":");
|
|
if(m2<10){u8g.print("0");}
|
|
u8g.print(m2,DEC);
|
|
|
|
u8g.setPrintPos(24, 43); //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, 43); //vik2
|
|
if(h4<10){u8g.print("0");}
|
|
u8g.print(h4,DEC);
|
|
u8g.print(":");
|
|
if(m4<10){u8g.print("0");}
|
|
u8g.print(m4,DEC);
|
|
|
|
u8g.setPrintPos(24, 54); //vk3
|
|
if(h5<10){u8g.print("0");}
|
|
u8g.print(h5,DEC);
|
|
u8g.print(":");
|
|
if(m5<10){u8g.print("0");}
|
|
u8g.print(m5,DEC);
|
|
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(84, 54); //vik3
|
|
if(h6<10){u8g.print("0");}
|
|
u8g.print(h6,DEC);
|
|
u8g.print(":");
|
|
if(m6<10){u8g.print("0");}
|
|
u8g.print(m6,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,23,124,9);
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(3, 32);// t1.1
|
|
u8g.print("OFF");
|
|
|
|
}
|
|
if(td==0)
|
|
{
|
|
u8g.setColorIndex(0);
|
|
u8g.drawBox(2,34,124,9);
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(3, 43);// t1.1
|
|
u8g.print("OFF");
|
|
}
|
|
if(tv==0)
|
|
{ //u8g.setPrintPos(2, 54);// t1.1
|
|
u8g.setColorIndex(0);
|
|
u8g.drawBox(2,45,124,9);
|
|
u8g.setColorIndex(1);
|
|
u8g.setPrintPos(3, 54);// 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(ntim,DEC); //nomer timera
|
|
}
|
|
if (cur==2)
|
|
{if(fl==1){u8g.setColorIndex(0);}
|
|
if(fl==0){u8g.setColorIndex(1);}
|
|
u8g.drawBox(112,1,6,9);
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.setPrintPos(112, 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,33,18,1);
|
|
}
|
|
else
|
|
{u8g.drawBox(3,33,5,1);}
|
|
}
|
|
//*****************************vrem****************
|
|
|
|
if (cur==11){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(25,33,10,1);
|
|
}
|
|
if (cur==12){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(43,33,10,1);
|
|
}
|
|
if (cur==13){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(85,33,10,1);
|
|
}
|
|
if (cur==14){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(103,33,10,1);
|
|
}
|
|
//***********************************************
|
|
if (cur==15){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
if(td==0)
|
|
{u8g.drawBox(3,44,18,1);;
|
|
}
|
|
else
|
|
{u8g.drawBox(3,44,5,1);}
|
|
|
|
|
|
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==16){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(25,44,10,1);
|
|
}
|
|
if (cur==17){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(43,44,10,1);
|
|
}
|
|
if (cur==18){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(85,44,10,1);
|
|
}
|
|
if (cur==19){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(103,44,10,1);
|
|
}
|
|
//***********************************************
|
|
if (cur==20){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
if(tv==0)
|
|
{u8g.drawBox(3,55,18,1);;
|
|
}
|
|
else
|
|
{u8g.drawBox(3,55,5,1);}
|
|
}
|
|
//*********************** **********************
|
|
|
|
if (cur==21){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(25,55,10,1);
|
|
}
|
|
if (cur==22){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(43,55,10,1);
|
|
}
|
|
if (cur==23){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(85,55,10,1);
|
|
}
|
|
if (cur==24){
|
|
if(fl==0){u8g.setColorIndex(0);}
|
|
if(fl==1){u8g.setColorIndex(1);}
|
|
u8g.drawBox(103,55,10,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)
|
|
{ ntim=ntim-1;
|
|
if (ntim<1){ntim=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)
|
|
{td=!td;
|
|
}
|
|
if(cur==16)
|
|
{h3=h3-1;
|
|
if(h3<0){h3=23;}
|
|
}
|
|
if(cur==17)
|
|
{m3=m3-1;
|
|
if(m3<0){m3=59;}
|
|
}
|
|
if(cur==18)
|
|
{h4=h4-1;
|
|
if(h4<0){h4=23;}
|
|
}
|
|
if(cur==19)
|
|
{m4=m4-1;
|
|
if(m4<0){m4=59;}
|
|
}
|
|
if(cur==20)
|
|
{tv=!tv;
|
|
}
|
|
if(cur==21)
|
|
{h5=h5-1;
|
|
if(h5<0){h5=23;}
|
|
}
|
|
if(cur==22)
|
|
{m5=m5-1;
|
|
if(m5<0){m5=59;}
|
|
}
|
|
if(cur==23)
|
|
{h6=h6-1;
|
|
if(h6<0){h6=23;}
|
|
}
|
|
if(cur==24)
|
|
{m6=m6-1;
|
|
if(m6<0){m6=59;}
|
|
}
|
|
|
|
}
|
|
|
|
//*************************
|
|
|
|
|
|
if(results.value == 0xE900B95) //up E900B95
|
|
{ if(cur==1)
|
|
{ ntim=ntim+1;
|
|
if (ntim>6){ntim=6;}
|
|
}
|
|
if(cur==2)
|
|
{ kan=kan+1;
|
|
if (kan>5){kan=5;}
|
|
}
|
|
|
|
if(cur==3)//boolean pn,vt,sr,cht,pt,sb,vs,on,bod;
|
|
{ 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)
|
|
{td=!td;
|
|
}
|
|
if(cur==16)
|
|
{h3=h3+1;
|
|
if(h3>23){h3=0;}
|
|
}
|
|
if(cur==17)
|
|
{m3=m3+1;
|
|
if(m3>59){m3=0;}
|
|
}
|
|
if(cur==18)
|
|
{h4=h4+1;
|
|
if(h4>23){h4=0;}
|
|
}
|
|
if(cur==19)
|
|
{m4=m4+1;
|
|
if(m4>59){m4=0;}
|
|
}
|
|
if(cur==20)
|
|
{tv=!tv;
|
|
}
|
|
if(cur==21)
|
|
{h5=h5+1;
|
|
if(h5>23){h5=0;}
|
|
}
|
|
if(cur==22)
|
|
{m5=m5+1;
|
|
if(m5>59){m5=0;}
|
|
}
|
|
if(cur==23)
|
|
{h6=h6+1;
|
|
if(h6>23){h6=0;}
|
|
}
|
|
if(cur==24)
|
|
{m6=m6+1;
|
|
if(m6>59){m6=0;}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(results.value == 0xE904BD5) //right E904BD5
|
|
{
|
|
cur=cur+1;
|
|
if (cur==11)
|
|
{if (tu==0){cur=15;}
|
|
}
|
|
if (cur==16)
|
|
{if (td==0){cur=20;}
|
|
}
|
|
if (cur==21)
|
|
{if (tv==0){cur=25;}
|
|
}
|
|
if (cur>24){cur=1;}
|
|
}
|
|
if(results.value == 0xE90CB55) //left E90CB55
|
|
{
|
|
cur=cur-1;
|
|
if (cur==14)
|
|
{if (tu==0){cur=10;}
|
|
}
|
|
if (cur==19)
|
|
{if (td==0){cur=15;}
|
|
}
|
|
|
|
if (cur<1){cur=24;}
|
|
if (cur==24)
|
|
{if (tv==0){cur=20;}
|
|
}
|
|
}
|
|
if(results.value == 0xE101A04) //enter E101A04
|
|
{int a=tyes();
|
|
if(a==1)
|
|
{timer_1[ntim-1][0]=tu;
|
|
timer_1[ntim-1][1]=td;
|
|
timer_1[ntim-1][2]=tv;
|
|
timer_1[ntim-1][3]=kan;
|
|
timer_1[ntim-1][4]=h1;
|
|
timer_1[ntim-1][5]=m1;
|
|
timer_1[ntim-1][6]=h2;
|
|
timer_1[ntim-1][7]=m2;
|
|
timer_1[ntim-1][8]=h3;
|
|
timer_1[ntim-1][9]=m3;
|
|
timer_1[ntim-1][10]=h4;
|
|
timer_1[ntim-1][11]=m4;
|
|
timer_1[ntim-1][12]=h5;
|
|
timer_1[ntim-1][13]=m5;
|
|
timer_1[ntim-1][14]=h6;
|
|
timer_1[ntim-1][15]=m6;
|
|
timer_1[ntim-1][16]=pn;
|
|
timer_1[ntim-1][17]=vt;
|
|
timer_1[ntim-1][18]=sr;
|
|
timer_1[ntim-1][19]=cht;
|
|
timer_1[ntim-1][20]=pt;
|
|
timer_1[ntim-1][21]=sb;
|
|
timer_1[ntim-1][22]=vs;
|
|
savedat();
|
|
nagruz ();
|
|
}
|
|
settimer=0;
|
|
ret=1;
|
|
|
|
|
|
|
|
} //выход с сохранением
|
|
if(results.value == 0xE106A74) //menu E106A74
|
|
{ /* int a=tyes();
|
|
if(a==1)
|
|
{
|
|
timer_1[ntim-1][0]=tu;
|
|
timer_1[ntim-1][1]=td;
|
|
timer_1[ntim-1][2]=tv;
|
|
timer_1[ntim-1][3]=kan;
|
|
timer_1[ntim-1][4]=h1;
|
|
timer_1[ntim-1][5]=m1;
|
|
timer_1[ntim-1][6]=h2;
|
|
timer_1[ntim-1][7]=m2;
|
|
timer_1[ntim-1][8]=h3;
|
|
timer_1[ntim-1][9]=m3;
|
|
timer_1[ntim-1][10]=h4;
|
|
timer_1[ntim-1][11]=m4;
|
|
timer_1[ntim-1][12]=h5;
|
|
timer_1[ntim-1][13]=m5;
|
|
timer_1[ntim-1][14]=h6;
|
|
timer_1[ntim-1][15]=m6;
|
|
timer_1[ntim-1][16]=pn;
|
|
timer_1[ntim-1][17]=vt;
|
|
timer_1[ntim-1][18]=sr;
|
|
timer_1[ntim-1][19]=cht;
|
|
timer_1[ntim-1][20]=pt;
|
|
timer_1[ntim-1][21]=sb;
|
|
timer_1[ntim-1][22]=vs;
|
|
//savedat();
|
|
}*/
|
|
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(ntim!=ntimold)
|
|
{
|
|
ntimold=ntim ;
|
|
goto data;
|
|
}
|
|
digitalWrite(13, LOW);
|
|
}while (ret<1);
|
|
|
|
delay(300);
|
|
|
|
}
|
|
|