Line 51... |
Line 51... |
51 |
#define OR208J PIN_F1 // t2 Roleta Zizala jih |
51 |
#define OR208J PIN_F1 // t2 Roleta Zizala jih |
52 |
//??? #define OR107 PIN_F2 // t3 Roleta satna |
52 |
//??? #define OR107 PIN_F2 // t3 Roleta satna |
53 |
#define OR106J PIN_F3 // t4 Roleta trucovna jih |
53 |
#define OR106J PIN_F3 // t4 Roleta trucovna jih |
54 |
#define OR201Z PIN_F4 // t5 Roleta chodba nahore |
54 |
#define OR201Z PIN_F4 // t5 Roleta chodba nahore |
55 |
#define OR205N PIN_F5 // t6 Roleta puda |
55 |
#define OR205N PIN_F5 // t6 Roleta puda |
56 |
//??? #define OR105 PIN_F6 // t7 Roleta kuchyn |
56 |
#define OR105J PIN_F6 // t7 Roleta kuchyn |
57 |
#define OR106Z PIN_F7 // t8 Roleta trucovna zapad |
57 |
#define OR106Z PIN_F7 // t8 Roleta trucovna zapad |
58 |
|
58 |
|
59 |
|
- |
|
60 |
#define OS103J PIN_B0 // t1 Svetla loznice |
59 |
#define OS103J PIN_B0 // t1 Svetla loznice |
61 |
#define OS105Z PIN_B1 // t2 Svetlo kuchyn nad lavici |
60 |
#define OS105Z PIN_B1 // t2 Svetlo kuchyn nad lavici |
62 |
#define OS110N PIN_B2 // t3 Svetlo koupelna dole zachod a sprhca |
61 |
#define OS110V PIN_B2 // t3 Svetlo koupelna dole zachod a zrcadlo |
63 |
#define OS106A PIN_B3 // t4 Svetlo trucovna stred |
62 |
#define OS106A PIN_B3 // t4 Svetlo trucovna stred |
64 |
#define OS107A PIN_B4 // t5 Svetlo satna |
63 |
#define OS107A PIN_B4 // t5 Svetlo satna |
65 |
#define OS109A PIN_B5 // t6 Svetlo technologicka mistnost |
64 |
#define OS109A PIN_B5 // t6 Svetlo technologicka mistnost |
66 |
#define OS205A PIN_B6 // t7 Svetlo puda |
65 |
#define OS205A PIN_B6 // t7 Svetlo puda |
67 |
#define OS204A PIN_B7 // t8 Svetlo radiomistnost |
66 |
#define OS204A PIN_B7 // t8 Svetlo radiomistnost |
Line 81... |
Line 80... |
81 |
#define OS209A PIN_E5 // t6 Svetlo Zizala koupelna |
80 |
#define OS209A PIN_E5 // t6 Svetlo Zizala koupelna |
82 |
#define OS203A PIN_E6 // t7 Svetlo Kaklik koupelna |
81 |
#define OS203A PIN_E6 // t7 Svetlo Kaklik koupelna |
83 |
#define RE PIN_E7 // t8 Rele pro rizeni smeru rolet |
82 |
#define RE PIN_E7 // t8 Rele pro rizeni smeru rolet |
84 |
|
83 |
|
85 |
//#define O.... PIN_G0 // t8 |
84 |
//#define O.... PIN_G0 // t8 |
86 |
//#define O.... PIN_G1 // t7 |
85 |
#define OS110J PIN_G1 // t7 Svetlo sprcha v dolni koupelne |
87 |
#define OS108A PIN_G2 // t6 Svetlo spajz |
86 |
#define OS108A PIN_G2 // t6 Svetlo spajz |
88 |
#define OS208A PIN_G3 // t5 Svetlo Zizala stred |
87 |
#define OS208A PIN_G3 // t5 Svetlo Zizala stred |
89 |
#define OS100A PIN_G4 // t4 Svetlo prujezd venku |
88 |
#define OS100A PIN_G4 // t4 Svetlo prujezd venku |
90 |
|
89 |
|
91 |
//#define I.... input(PIN_D0) // A |
90 |
//#define I.... input(PIN_D0) // A |
Line 156... |
Line 155... |
156 |
#define R204Z 6 |
155 |
#define R204Z 6 |
157 |
#define R208V 7 |
156 |
#define R208V 7 |
158 |
#define R208J 8 |
157 |
#define R208J 8 |
159 |
#define R106J 9 |
158 |
#define R106J 9 |
160 |
#define R106Z 10 |
159 |
#define R106Z 10 |
- |
|
160 |
#define R105J 11 |
161 |
|
161 |
|
162 |
typedef enum {UP, DOWN, REVERS_UP, REVERS_DOWN, RUN_UP, RUN_DOWN, RUN_UP_WAITING} relay_state; |
162 |
typedef enum {UP, DOWN, REVERS_UP, REVERS_DOWN, RUN_UP, RUN_DOWN, RUN_UP_WAITING} relay_state; |
163 |
relay_state relay; // Stavy rele |
163 |
relay_state relay; // Stavy rele |
164 |
|
164 |
|
165 |
int8 timer_run; // Bezpecnostni casovac behu rolety |
165 |
int8 timer_run; // Bezpecnostni casovac behu rolety |
Line 201... |
Line 201... |
201 |
if (rol[R204Z]==RUN) ON(OR204Z); |
201 |
if (rol[R204Z]==RUN) ON(OR204Z); |
202 |
if (rol[R208V]==RUN) ON(OR208V); |
202 |
if (rol[R208V]==RUN) ON(OR208V); |
203 |
if (rol[R208J]==RUN) ON(OR208J); |
203 |
if (rol[R208J]==RUN) ON(OR208J); |
204 |
if (rol[R106J]==RUN) ON(OR106J); |
204 |
if (rol[R106J]==RUN) ON(OR106J); |
205 |
if (rol[R106Z]==RUN) ON(OR106Z); |
205 |
if (rol[R106Z]==RUN) ON(OR106Z); |
- |
|
206 |
if (rol[R105J]==RUN) ON(OR105J); |
206 |
} |
207 |
} |
207 |
|
208 |
|
208 |
void run(int8 roleta) // Spust konkretni roletu |
209 |
void run(int8 roleta) // Spust konkretni roletu |
209 |
{ |
210 |
{ |
210 |
switch (roleta) |
211 |
switch (roleta) |
Line 218... |
Line 219... |
218 |
case R204Z: ON(OR204Z); break; |
219 |
case R204Z: ON(OR204Z); break; |
219 |
case R208V: ON(OR208V); break; |
220 |
case R208V: ON(OR208V); break; |
220 |
case R208J: ON(OR208J); break; |
221 |
case R208J: ON(OR208J); break; |
221 |
case R106J: ON(OR106J); break; |
222 |
case R106J: ON(OR106J); break; |
222 |
case R106Z: ON(OR106Z); break; |
223 |
case R106Z: ON(OR106Z); break; |
- |
|
224 |
case R105J: ON(OR105J); break; |
223 |
} |
225 |
} |
224 |
} |
226 |
} |
225 |
|
227 |
|
226 |
void stop(int8 roleta) // Spust konkretni roletu |
228 |
void stop(int8 roleta) // Spust konkretni roletu |
227 |
{ |
229 |
{ |
Line 236... |
Line 238... |
236 |
case R204Z: OFF(OR204Z); break; |
238 |
case R204Z: OFF(OR204Z); break; |
237 |
case R208V: OFF(OR208V); break; |
239 |
case R208V: OFF(OR208V); break; |
238 |
case R208J: OFF(OR208J); break; |
240 |
case R208J: OFF(OR208J); break; |
239 |
case R106J: OFF(OR106J); break; |
241 |
case R106J: OFF(OR106J); break; |
240 |
case R106Z: OFF(OR106Z); break; |
242 |
case R106Z: OFF(OR106Z); break; |
- |
|
243 |
case R105J: OFF(OR105J); break; |
241 |
} |
244 |
} |
242 |
} |
245 |
} |
243 |
|
246 |
|
244 |
void up(int8 roleta) // Pozadavek, aby roleta jela nahoru |
247 |
void up(int8 roleta) // Pozadavek, aby roleta jela nahoru |
245 |
{ |
248 |
{ |
Line 407... |
Line 410... |
407 |
{ |
410 |
{ |
408 |
if(buf[1]=='1') |
411 |
if(buf[1]=='1') |
409 |
{ |
412 |
{ |
410 |
switch(buf[2]) |
413 |
switch(buf[2]) |
411 |
{ |
414 |
{ |
- |
|
415 |
case '0': |
- |
|
416 |
output_toggle(OS100A); |
- |
|
417 |
break; |
412 |
case '2': |
418 |
case '2': |
413 |
output_toggle(OS102A); |
419 |
output_toggle(OS102A); |
414 |
break; |
420 |
break; |
415 |
case '3': |
421 |
case '3': |
416 |
output_toggle(OS103J); |
422 |
output_toggle(OS103J); |
Line 433... |
Line 439... |
433 |
break; |
439 |
break; |
434 |
case '9': |
440 |
case '9': |
435 |
output_toggle(OS109A); |
441 |
output_toggle(OS109A); |
436 |
break; |
442 |
break; |
437 |
case 'a': |
443 |
case 'a': |
- |
|
444 |
if(buf[3]=='A') {if(input(OS110V)) |
- |
|
445 |
{ // Nesviti zrcadlo |
- |
|
446 |
output_low(OS110J); output_low(OS110V); // Vsechno rozsvit |
438 |
// output_toggle(OS110J); |
447 |
} |
- |
|
448 |
else |
- |
|
449 |
{ // Sviti zrcadlo |
- |
|
450 |
output_high(OS110J); output_high(OS110V); // Vsechno zhasni |
- |
|
451 |
} |
- |
|
452 |
} |
- |
|
453 |
if(buf[3]=='B') {if(input(OS110J)) |
- |
|
454 |
{ // Nesviti sprcha |
- |
|
455 |
if(input(OS110V)) |
- |
|
456 |
{ // Nesviti zrcadlo |
- |
|
457 |
output_low(OS110J); // Rozsvit sprchu |
- |
|
458 |
} |
- |
|
459 |
else |
- |
|
460 |
{ // Sviti zrcadlo |
- |
|
461 |
output_low(OS110J); output_high(OS110V); // Rozsvit sprchu a zhasni zrcadlo |
- |
|
462 |
} |
- |
|
463 |
} |
- |
|
464 |
else |
- |
|
465 |
{ // Sviti sprcha |
- |
|
466 |
output_high(OS110J); // Zhasni sprchu |
439 |
output_toggle(OS110N); |
467 |
} |
- |
|
468 |
} |
440 |
break; |
469 |
break; |
441 |
} |
470 |
} |
442 |
} |
471 |
} |
443 |
} |
472 |
} |
444 |
|
473 |
|
Line 453... |
Line 482... |
453 |
break; |
482 |
break; |
454 |
case '4': |
483 |
case '4': |
455 |
if(buf[3]=='V') if((buf[4]=='U')) {up(R104V);} else {down(R104V);} |
484 |
if(buf[3]=='V') if((buf[4]=='U')) {up(R104V);} else {down(R104V);} |
456 |
if(buf[3]=='J') if((buf[4]=='U')) {up(R104J);} else {down(R104J);} |
485 |
if(buf[3]=='J') if((buf[4]=='U')) {up(R104J);} else {down(R104J);} |
457 |
break; |
486 |
break; |
- |
|
487 |
case '5': |
- |
|
488 |
if(buf[3]=='J') if((buf[4]=='U')) {up(R105J);} else {down(R105J);} |
- |
|
489 |
break; |
458 |
case '6': |
490 |
case '6': |
459 |
if(buf[3]=='J') if((buf[4]=='U')) {up(R106J);} else {down(R106J);} |
491 |
if(buf[3]=='J') if((buf[4]=='U')) {up(R106J);} else {down(R106J);} |
460 |
if(buf[3]=='Z') if((buf[4]=='U')) {up(R106Z);} else {down(R106Z);} |
492 |
if(buf[3]=='Z') if((buf[4]=='U')) {up(R106Z);} else {down(R106Z);} |
461 |
break; |
493 |
break; |
462 |
case 'a': |
494 |
case 'a': |
Line 524... |
Line 556... |
524 |
if(r208VU!=IR208VU) {r208VU=IR208VU; up(R208V); zakmity=ZAKMIT;} |
556 |
if(r208VU!=IR208VU) {r208VU=IR208VU; up(R208V); zakmity=ZAKMIT;} |
525 |
if(r208VD!=IR208VD) {r208VD=IR208VD; down(R208V); zakmity=ZAKMIT;} |
557 |
if(r208VD!=IR208VD) {r208VD=IR208VD; down(R208V); zakmity=ZAKMIT;} |
526 |
if(r208JU!=IR208JU) {r208JU=IR208JU; up(R208J); zakmity=ZAKMIT;} |
558 |
if(r208JU!=IR208JU) {r208JU=IR208JU; up(R208J); zakmity=ZAKMIT;} |
527 |
if(r208JD!=IR208JD) {r208JD=IR208JD; down(R208J); zakmity=ZAKMIT;} |
559 |
if(r208JD!=IR208JD) {r208JD=IR208JD; down(R208J); zakmity=ZAKMIT;} |
528 |
|
560 |
|
529 |
if(ispec!=Ispec) {ispec=Ispec; output_toggle(OS100A); zakmity=ZAKMIT;} |
561 |
//!!! if(ispec!=Ispec) {ispec=Ispec; output_toggle(OS100A); zakmity=ZAKMIT;} |
530 |
} |
562 |
} |
531 |
else zakmity--; |
563 |
else zakmity--; |
532 |
|
564 |
|
533 |
// Spajz mikrospinac i svetlo |
565 |
// Spajz mikrospinac i svetlo |
534 |
if(IS108A) {output_high(OS108A); tS108=TIMEOUT_SPAJZ;} |
566 |
if(IS108A) {output_high(OS108A); tS108=TIMEOUT_SPAJZ;} |