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.
288 lines
6.5 KiB
288 lines
6.5 KiB
void timer1 ()
|
|
{boolean ret=0;
|
|
byte cur=1;
|
|
|
|
|
|
|
|
//boolean pn,vt,sr,cht,pt,sb,vs,on,bod;// budilnik
|
|
|
|
//****************************************
|
|
|
|
|
|
do {
|
|
//irem();
|
|
// button();
|
|
delay (200);
|
|
|
|
|
|
u8g.firstPage();
|
|
do {
|
|
|
|
u8g.setColorIndex(1);
|
|
u8g.drawXBMP(0, 0, 128, 64, bud1);
|
|
u8g.setFont(u8g_font_unifont);
|
|
u8g.setPrintPos(13, 23);
|
|
u8g.print(hourt1/10,DEC);
|
|
u8g.print(hourt1%10,DEC);
|
|
u8g.print(":");
|
|
u8g.print(mint1/10,DEC);
|
|
u8g.print(mint1%10,DEC);
|
|
|
|
|
|
if (on==0)
|
|
{u8g.drawXBMP(58, 12, 16, 12, budoff);
|
|
}
|
|
else
|
|
{u8g.drawXBMP(58, 12, 16, 12, budon);
|
|
}
|
|
|
|
if (bod==0)
|
|
{u8g.drawXBMP(76, 12, 16, 12, sev);
|
|
}
|
|
else
|
|
{u8g.drawXBMP(76, 12, 16, 12, od);
|
|
}
|
|
|
|
|
|
int vol1=38-((90-52)*note/255);
|
|
// int vol1=((90-52)*note/255);
|
|
u8g.drawFrame(52,46,38,4);
|
|
u8g.drawBox(52,46,vol1,4);
|
|
|
|
if (pn==1){u8g.drawBox(6,37,10,1);}
|
|
if (vt==1){u8g.drawBox(19,37,8,1);}
|
|
if (sr==1){u8g.drawBox(30,37,10,1);}
|
|
if (cht==1){u8g.drawBox(43,37,8,1);}
|
|
if (pt==1){u8g.drawBox(54,37,8,1);}
|
|
if (sb==1){u8g.drawBox(65,37,10,1);}
|
|
if (vs==1){u8g.drawBox(78,37,10,1);}
|
|
|
|
|
|
if (cur==1){u8g.drawBox(13,24,16,1);}
|
|
if (cur==2){u8g.drawBox(37,24,16,1);}
|
|
if (cur==3){u8g.drawBox(58,24,14,1);}
|
|
if (cur==4){u8g.drawBox(78,24,12,1);}
|
|
|
|
|
|
if (cur==5){u8g.drawBox(6,39,10,1);}
|
|
if (cur==6){u8g.drawBox(19,39,8,1);}
|
|
if (cur==7){u8g.drawBox(30,39,10,1);}
|
|
if (cur==8){u8g.drawBox(43,39,8,1);}
|
|
if (cur==9){u8g.drawBox(54,39,8,1);}
|
|
if (cur==10){u8g.drawBox(65,39,10,1);}
|
|
if (cur==11){u8g.drawBox(78,39,10,1);}
|
|
if (cur==12){u8g.drawBox(2,52,47,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)
|
|
{ hourt1=hourt1-1;
|
|
if (hourt1<0){hourt1=23;}
|
|
}
|
|
if(cur==2)
|
|
{ mint1=mint1-1;
|
|
if (mint1<0){mint1=59;}
|
|
}
|
|
if(cur==3)
|
|
{
|
|
if (on==1)
|
|
{on=0;
|
|
}
|
|
else{on=1;
|
|
}
|
|
}
|
|
if(cur==4)
|
|
{
|
|
if (bod==1)
|
|
{bod=0;
|
|
}
|
|
else{bod=1;
|
|
}
|
|
}
|
|
|
|
if(cur==5)//boolean pn,vt,sr,cht,pt,sb,vs,on,bod;// budilnik
|
|
{ if (pn==1)
|
|
{pn=0;
|
|
}
|
|
else{pn=1;
|
|
}
|
|
}
|
|
if(cur==6)
|
|
{ if (vt==1)
|
|
{vt=0;
|
|
}
|
|
else{vt=1;
|
|
}
|
|
}
|
|
if(cur==7)
|
|
{ if (sr==1)
|
|
{sr=0;
|
|
}
|
|
else{sr=1;
|
|
}
|
|
}
|
|
if(cur==8)
|
|
{ if (cht==1)
|
|
{cht=0;
|
|
}
|
|
else{cht=1;
|
|
}
|
|
}
|
|
if(cur==9)
|
|
{ if (pt==1)
|
|
{pt=0;
|
|
}
|
|
else{pt=1;
|
|
}
|
|
}
|
|
if(cur==10)
|
|
{ if (sb==1)
|
|
{sb=0;
|
|
}
|
|
else{sb=1;
|
|
}
|
|
}
|
|
if(cur==11)
|
|
{ if (vs==1)
|
|
{vs=0;
|
|
}
|
|
else{vs=1;
|
|
}
|
|
}
|
|
|
|
if(cur==12)
|
|
{note=note+10;
|
|
if(note>254){note=254;}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(results.value == 0xE900B95) //up E900B95
|
|
{ if(cur==1)
|
|
{ hourt1=hourt1+1;
|
|
if (hourt1>23){hourt1=0;}
|
|
}
|
|
if(cur==2)
|
|
{ mint1=mint1+1;
|
|
if (mint1>59){mint1=0;}
|
|
}
|
|
if(cur==3)
|
|
{
|
|
if (on==1)
|
|
{on=0;
|
|
}
|
|
else{on=1;
|
|
}
|
|
}
|
|
if(cur==4)
|
|
{
|
|
if (bod==1)
|
|
{bod=0;
|
|
}
|
|
else{bod=1;
|
|
}
|
|
}
|
|
|
|
if(cur==5)//boolean pn,vt,sr,cht,pt,sb,vs,on,bod;// budilnik
|
|
{ if (pn==1)
|
|
{pn=0;
|
|
}
|
|
else{pn=1;
|
|
}
|
|
}
|
|
if(cur==6)
|
|
{ if (vt==1)
|
|
{vt=0;
|
|
}
|
|
else{vt=1;
|
|
}
|
|
}
|
|
if(cur==7)
|
|
{ if (sr==1)
|
|
{sr=0;
|
|
}
|
|
else{sr=1;
|
|
}
|
|
}
|
|
if(cur==8)
|
|
{ if (cht==1)
|
|
{cht=0;
|
|
}
|
|
else{cht=1;
|
|
}
|
|
}
|
|
if(cur==9)
|
|
{ if (pt==1)
|
|
{pt=0;
|
|
}
|
|
else{pt=1;
|
|
}
|
|
}
|
|
if(cur==10)
|
|
{ if (sb==1)
|
|
{sb=0;
|
|
}
|
|
else{sb=1;
|
|
}
|
|
}
|
|
if(cur==11)
|
|
{ if (vs==1)
|
|
{vs=0;
|
|
}
|
|
else{vs=1;
|
|
}
|
|
}
|
|
if(cur==12)
|
|
{note=note-10;
|
|
if(note<5){note=5;}
|
|
}
|
|
|
|
}
|
|
|
|
if(results.value == 0xE101A04) //enter E101A04
|
|
{ustt1=0;
|
|
ret=1;
|
|
|
|
|
|
|
|
} //выход с сохранением
|
|
if(results.value == 0xE106A74) //menu E106A74
|
|
{ ustt1=0;
|
|
ret=1;
|
|
} //выход без сохранения
|
|
|
|
|
|
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;}
|
|
}
|
|
|
|
|
|
|
|
delay (100);
|
|
irrecv.resume(); // Receive the next value
|
|
digitalWrite(13, LOW);
|
|
}//ir
|
|
|
|
|
|
|
|
}while (ret<1);
|
|
|
|
delay(300);
|
|
|
|
}
|
|
|