/Designs/dum/SW/2patra/2np/main.c
53,13 → 53,12
#define OR106J PIN_F3 // t4 Roleta trucovna jih
#define OR201Z PIN_F4 // t5 Roleta chodba nahore
#define OR205N PIN_F5 // t6 Roleta puda
//??? #define OR105 PIN_F6 // t7 Roleta kuchyn
#define OR105J PIN_F6 // t7 Roleta kuchyn
#define OR106Z PIN_F7 // t8 Roleta trucovna zapad
 
 
#define OS103J PIN_B0 // t1 Svetla loznice
#define OS105Z PIN_B1 // t2 Svetlo kuchyn nad lavici
#define OS110N PIN_B2 // t3 Svetlo koupelna dole zachod a sprhca
#define OS110V PIN_B2 // t3 Svetlo koupelna dole zachod a zrcadlo
#define OS106A PIN_B3 // t4 Svetlo trucovna stred
#define OS107A PIN_B4 // t5 Svetlo satna
#define OS109A PIN_B5 // t6 Svetlo technologicka mistnost
83,7 → 82,7
#define RE PIN_E7 // t8 Rele pro rizeni smeru rolet
 
//#define O.... PIN_G0 // t8
//#define O.... PIN_G1 // t7
#define OS110J PIN_G1 // t7 Svetlo sprcha v dolni koupelne
#define OS108A PIN_G2 // t6 Svetlo spajz
#define OS208A PIN_G3 // t5 Svetlo Zizala stred
#define OS100A PIN_G4 // t4 Svetlo prujezd venku
158,6 → 157,7
#define R208J 8
#define R106J 9
#define R106Z 10
#define R105J 11
 
typedef enum {UP, DOWN, REVERS_UP, REVERS_DOWN, RUN_UP, RUN_DOWN, RUN_UP_WAITING} relay_state;
relay_state relay; // Stavy rele
203,6 → 203,7
if (rol[R208J]==RUN) ON(OR208J);
if (rol[R106J]==RUN) ON(OR106J);
if (rol[R106Z]==RUN) ON(OR106Z);
if (rol[R105J]==RUN) ON(OR105J);
}
 
void run(int8 roleta) // Spust konkretni roletu
220,6 → 221,7
case R208J: ON(OR208J); break;
case R106J: ON(OR106J); break;
case R106Z: ON(OR106Z); break;
case R105J: ON(OR105J); break;
}
}
 
238,6 → 240,7
case R208J: OFF(OR208J); break;
case R106J: OFF(OR106J); break;
case R106Z: OFF(OR106Z); break;
case R105J: OFF(OR105J); break;
}
}
 
409,6 → 412,9
{
switch(buf[2])
{
case '0':
output_toggle(OS100A);
break;
case '2':
output_toggle(OS102A);
break;
435,8 → 441,31
output_toggle(OS109A);
break;
case 'a':
// output_toggle(OS110J);
output_toggle(OS110N);
if(buf[3]=='A') {if(input(OS110V))
{ // Nesviti zrcadlo
output_low(OS110J); output_low(OS110V); // Vsechno rozsvit
}
else
{ // Sviti zrcadlo
output_high(OS110J); output_high(OS110V); // Vsechno zhasni
}
}
if(buf[3]=='B') {if(input(OS110J))
{ // Nesviti sprcha
if(input(OS110V))
{ // Nesviti zrcadlo
output_low(OS110J); // Rozsvit sprchu
}
else
{ // Sviti zrcadlo
output_low(OS110J); output_high(OS110V); // Rozsvit sprchu a zhasni zrcadlo
}
}
else
{ // Sviti sprcha
output_high(OS110J); // Zhasni sprchu
}
}
break;
}
}
455,6 → 484,9
if(buf[3]=='V') if((buf[4]=='U')) {up(R104V);} else {down(R104V);}
if(buf[3]=='J') if((buf[4]=='U')) {up(R104J);} else {down(R104J);}
break;
case '5':
if(buf[3]=='J') if((buf[4]=='U')) {up(R105J);} else {down(R105J);}
break;
case '6':
if(buf[3]=='J') if((buf[4]=='U')) {up(R106J);} else {down(R106J);}
if(buf[3]=='Z') if((buf[4]=='U')) {up(R106Z);} else {down(R106Z);}
526,7 → 558,7
if(r208JU!=IR208JU) {r208JU=IR208JU; up(R208J); zakmity=ZAKMIT;}
if(r208JD!=IR208JD) {r208JD=IR208JD; down(R208J); zakmity=ZAKMIT;}
 
if(ispec!=Ispec) {ispec=Ispec; output_toggle(OS100A); zakmity=ZAKMIT;}
//!!! if(ispec!=Ispec) {ispec=Ispec; output_toggle(OS100A); zakmity=ZAKMIT;}
}
else zakmity--;
/Designs/dum/SW/2patra/2np/main.pjt
49,6 → 49,6
1=main.c
2=main.h
3=..\..\..\..\..\..\..\..\..\Program Files\PICC\Devices\18F8310.h
4=
5=..\..\..\..\MRAKOMER4\SW\irmrak4.c
4=..\1np\main.c
5=
6=