30,14 → 30,15 |
#use fast_io(H) |
#use fast_io(G) |
|
#define T_REVERS 2 // 2*256 ms = 0,5 s; pred prepnutim rele (zastaveni motoru a vybiti kondenzatoru) |
#define T_START 1 // 1*256 ms = 0,3 s; po prepnuti rele do sepnuti triaku |
#define T_GO 117 // 117*256 ms = 30 s; max. beh rolety |
#define T_GO_ZALUZIE 6 // cca 1,5 s; beh zaluzie (pouze na preklopeni lamel) |
#define T_RECEIVE 10 // cca 2,6 s |
#define ZAKMIT 2000 // pocet pruchodu hlavni smyckou pred opetovnou detekci prepnuti vypinace |
#define T_REVERS 2 // 2*256 ms = 0,5 s; pred prepnutim rele (zastaveni motoru a vybiti kondenzatoru) |
#define T_START 1 // 1*256 ms = 0,3 s; po prepnuti rele do sepnuti triaku |
#define T_GO 117 // 117*256 ms = 30 s; max. beh rolety |
#define T_GO_ZALUZIE 2500/256 // cca 2 s; beh zaluzie (pouze na preklopeni lamel) |
#define T_RECEIVE 10 // cca 2,6 s |
#define TIMEOUT_SPAJZ 255 // Timeout svetlo spajz cca minuta |
#define ZAKMIT 2000 // pocet pruchodu hlavni smyckou pred opetovnou detekci prepnuti vypinace |
|
#define OR106Z PIN_A0 // t1 Roleta trucovna zapad |
//!!! STUDENAK na triaku spolecny vyvod !!! #define O PIN_A0 // t1 |
#define OR110N PIN_A1 // t2 Zaluzie koupelna dole sever |
#define OR104V PIN_A2 // t3 Roleta lab vychod |
#define OR104J PIN_A3 // t4 Roleta lab jih |
48,12 → 49,12 |
|
#define OR208V PIN_F0 // t1 Roleta Zizala vychod |
#define OR208J PIN_F1 // t2 Roleta Zizala jih |
//??? #define OR107 PIN_F2 // t3 |
//??? #define OR107 PIN_F3 // t4 |
//??? #define OR107 PIN_F2 // t3 Roleta satna |
#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 O... PIN_F7 // t8 |
#define OR106Z PIN_F7 // t8 Roleta trucovna zapad |
|
|
#define OS103J PIN_B0 // t1 Svetla loznice |
83,7 → 84,7 |
|
//#define O.... PIN_G0 // t8 |
//#define O.... PIN_G1 // t7 |
//#define O.... PIN_G2 // t6 |
#define OS108A PIN_G2 // t6 Svetlo spajz |
#define OS208A PIN_G3 // t5 Svetlo Zizala stred |
#define OS100A PIN_G4 // t4 Svetlo prujezd venku |
|
103,7 → 104,7 |
#define IS204AJ input(PIN_J4) // E Vypinac svetlo radiomistnost u dveri na chodbu |
#define IR204ZD input(PIN_J5) // F Vypinac roleta radiomistnost dolu |
#define IR204ZU input(PIN_J6) // G Vypinac roleta radiomistnost nahoru |
//#define I.... input(PIN_J7) // H |
#define IS108A input(PIN_J7) // H Mikrospinac spajz |
|
#define IS208AN input(PIN_H0) // A Vypinac svetlo stred Zizala u dveri na chodbu //POZOR! Jsou prohozeny rolety J a V a smery U a D |
#define IR208JD input(PIN_H1) // B Vypinac roleta vychod Zizala nahoru u dveri |
155,6 → 156,8 |
#define R204Z 6 |
#define R208V 7 |
#define R208J 8 |
#define R106J 9 |
#define R106Z 10 |
|
typedef enum {UP, DOWN, REVERS_UP, REVERS_DOWN, RUN_UP, RUN_DOWN, RUN_UP_WAITING} relay_state; |
relay_state relay; // Stavy rele |
164,11 → 167,13 |
int8 timer_revers; // Prodleva na vybiti kondenzatoru pa zastaveni rolety pred prepnutim rele |
int8 timer_start; // Prodleva na prepnuti rele pred startem rolety |
int8 timer; // Casovac komunikace |
int8 tS108; // Casovac svetlo spajz |
|
#int_TIMER0 |
void TIMER0_isr(void) |
{ |
if(timer>0) timer--; |
if(tS108>0) tS108--; |
if(timer_run>0) timer_run--; |
if(timer_revers>0) timer_revers--; |
if(timer_start>0) timer_start--; |
196,6 → 201,8 |
if (rol[R204Z]==RUN) ON(OR204Z); |
if (rol[R208V]==RUN) ON(OR208V); |
if (rol[R208J]==RUN) ON(OR208J); |
if (rol[R106J]==RUN) ON(OR106J); |
if (rol[R106Z]==RUN) ON(OR106Z); |
} |
|
void run(int8 roleta) // Spust konkretni roletu |
211,6 → 218,8 |
case R204Z: ON(OR204Z); break; |
case R208V: ON(OR208V); break; |
case R208J: ON(OR208J); break; |
case R106J: ON(OR106J); break; |
case R106Z: ON(OR106Z); break; |
} |
} |
|
227,6 → 236,8 |
case R204Z: OFF(OR204Z); break; |
case R208V: OFF(OR208V); break; |
case R208J: OFF(OR208J); break; |
case R106J: OFF(OR106J); break; |
case R106Z: OFF(OR106Z); break; |
} |
} |
|
444,6 → 455,10 |
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 '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);} |
break; |
case 'a': |
if((buf[4]=='U')) |
{//up(R110N); |
515,6 → 530,10 |
} |
else zakmity--; |
|
// Spajz mikrospinac i svetlo |
if(IS108A) {output_high(OS108A); tS108=TIMEOUT_SPAJZ;} |
if((!IS108A)&&(tS108>0)) {output_low(OS108A);} else {output_high(OS108A);} |
|
switch (relay) |
{ |
case UP: |