Rev 1747 | Rev 1748 | ||
---|---|---|---|
1 | #include "main.h" |
1 | #include "main.h" |
2 | |
2 | |
3 | #case |
3 | #case |
4 | |
4 | |
5 | #define REVERS 2 // 2*256 ms = 0,5 s |
5 | #define REVERS 2 // 2*256 ms = 0,5 s |
6 | #define GO 117 // 117*256 ms = 30 s |
6 | #define GO 117 // 117*256 ms = 30 s |
7 | #define GO_ZALUZIE 5 // 5*256 ms = 1,25 s |
7 | #define GO_ZALUZIE 5 // 5*256 ms = 1,25 s |
- | 8 | #define RECEIVE 12 // 3 s |
|
8 | |
9 | |
9 | #define S105A PIN_A0 |
10 | #define S105A PIN_A0 |
10 | #define R110AU PIN_A1 |
11 | #define R110NU PIN_A1 |
11 | #define R110AD PIN_A2 |
12 | #define R110ND PIN_A2 |
12 | #define S104A PIN_A3 |
13 | #define S104A PIN_A3 |
13 | #define R104AU PIN_A4 |
14 | #define R104VU PIN_A4 |
14 | #define R104AD PIN_A5 |
15 | #define R104VD PIN_A5 |
15 | #define R104BU PIN_A6 |
16 | #define R104JU PIN_A6 |
16 | #define R104BD PIN_A7 |
17 | #define R104JD PIN_A7 |
17 | |
18 | |
18 | #define S103A PIN_B0 |
19 | #define S103J PIN_B0 |
19 | #define R103AU PIN_B1 |
20 | #define R103VU PIN_B1 |
20 | #define R103AD PIN_B2 |
21 | #define R103VD PIN_B2 |
21 | #define S106A PIN_B3 |
22 | #define S106A PIN_B3 |
22 | #define S107A PIN_B4 |
23 | #define S107A PIN_B4 |
23 | #define S109A PIN_B5 |
24 | #define S109A PIN_B5 |
24 | |
25 | |
25 | //#define OS101 PIN_C0 |
26 | //#define OS101 PIN_C0 |
26 | //#define OS105B PIN_C1 |
27 | //#define OS105B PIN_C1 |
27 | //#define OS105C PIN_C2 |
28 | //#define OS105C PIN_C2 |
28 | //#define PIN_C3 31763 |
29 | //#define PIN_C3 31763 |
29 | //#define PIN_C4 31764 |
30 | //#define PIN_C4 31764 |
30 | //#define PIN_C5 31765 |
31 | //#define PIN_C5 31765 |
31 | |
32 | |
32 | //#define PIN_C6 31766 //TX |
33 | //#define PIN_C6 31766 //TX |
33 | //#define PIN_C7 31767 //RX |
34 | //#define PIN_C7 31767 //RX |
34 | |
35 | |
35 | #define S101A PIN_D0 |
36 | //#define S101A PIN_F0 |
36 | #define S105D PIN_D1 |
37 | #define S105Z PIN_F1 |
37 | #define S102A PIN_D2 |
38 | #define S102A PIN_F2 |
38 | #define S110C PIN_D3 |
39 | #define S110N PIN_F3 |
39 | #define S108A PIN_D4 |
40 | #define S108A PIN_F4 |
40 | #define S201A PIN_D5 |
41 | #define S201A PIN_F5 |
41 | #define S110B PIN_D6 |
42 | #define S110J PIN_F6 |
42 | |
43 | |
43 | /* |
44 | /* |
44 | #define PIN_E0 31776 |
45 | #define PIN_E0 31776 |
45 | #define PIN_E1 31777 |
46 | #define PIN_E1 31777 |
46 | #define PIN_E2 31778 |
47 | #define PIN_E2 31778 |
47 | #define PIN_E3 31779 |
48 | #define PIN_E3 31779 |
48 | #define PIN_E4 31780 |
49 | #define PIN_E4 31780 |
49 | #define PIN_E5 31781 |
50 | #define PIN_E5 31781 |
50 | #define PIN_E6 31782 |
51 | #define PIN_E6 31782 |
51 | #define PIN_E7 31783 |
52 | #define PIN_E7 31783 |
52 | |
53 | |
53 | #define PIN_F0 31784 |
54 | #define PIN_F0 31784 |
54 | #define PIN_F1 31785 |
55 | #define PIN_F1 31785 |
55 | #define PIN_F2 31786 |
56 | #define PIN_F2 31786 |
56 | #define PIN_F3 31787 |
57 | #define PIN_F3 31787 |
57 | #define PIN_F4 31788 |
58 | #define PIN_F4 31788 |
58 | #define PIN_F5 31789 |
59 | #define PIN_F5 31789 |
59 | #define PIN_F6 31790 |
60 | #define PIN_F6 31790 |
60 | #define PIN_F7 31791 |
61 | #define PIN_F7 31791 |
61 | |
62 | |
62 | #define PIN_G0 31792 |
63 | #define PIN_G0 31792 |
63 | #define PIN_G1 31793 |
64 | #define PIN_G1 31793 |
64 | #define PIN_G2 31794 |
65 | #define PIN_G2 31794 |
65 | #define PIN_G3 31795 |
66 | #define PIN_G3 31795 |
66 | #define PIN_G4 31796 |
67 | #define PIN_G4 31796 |
67 | #define PIN_G5 31797 |
68 | #define PIN_G5 31797 |
68 | |
69 | |
69 | #define PIN_H0 31800 |
70 | #define PIN_H0 31800 |
70 | #define PIN_H1 31801 |
71 | #define PIN_H1 31801 |
71 | #define PIN_H2 31802 |
72 | #define PIN_H2 31802 |
72 | #define PIN_H3 31803 |
73 | #define PIN_H3 31803 |
73 | #define PIN_H4 31804 |
74 | #define PIN_H4 31804 |
74 | #define PIN_H5 31805 |
75 | #define PIN_H5 31805 |
75 | #define PIN_H6 31806 |
76 | #define PIN_H6 31806 |
76 | #define PIN_H7 31807 |
77 | #define PIN_H7 31807 |
77 | |
78 | |
78 | #define PIN_J0 31808 |
79 | #define PIN_J0 31808 |
79 | #define PIN_J1 31809 |
80 | #define PIN_J1 31809 |
80 | #define PIN_J2 31810 |
81 | #define PIN_J2 31810 |
81 | #define PIN_J3 31811 |
82 | #define PIN_J3 31811 |
82 | #define PIN_J4 31812 |
83 | #define PIN_J4 31812 |
83 | #define PIN_J5 31813 |
84 | #define PIN_J5 31813 |
84 | #define PIN_J6 31814 |
85 | #define PIN_J6 31814 |
85 | #define PIN_J7 31815 |
86 | #define PIN_J7 31815 |
86 | */ |
87 | */ |
87 | |
88 | |
88 | #bit CREN = 0xFAB.4 // USART enable register |
89 | #bit CREN = 0xFAB.4 // USART enable register |
89 | |
90 | |
90 | #define LED1 PIN_J7 |
91 | #define LED1 PIN_J7 |
91 | #define LED2 PIN_J6 |
92 | #define LED2 PIN_J6 |
92 | |
93 | |
93 | #define ON(port) output_low(port); |
94 | #define ON(port) output_low(port); |
94 | #define OFF(port) output_high(port); |
95 | #define OFF(port) output_high(port); |
95 | |
96 | |
96 | typedef enum {GO_UP, GO_DOWN, REVERS_UP, REVERS_DOWN, STOP} state; |
97 | typedef enum {GO_UP, GO_DOWN, REVERS_UP, REVERS_DOWN, STOP} state; |
97 | |
98 | |
98 | state r103A, r110A, r104A, r104B; // Stavy rolet |
99 | state r103V, r110N, r104V, r104J; // Stavy rolet |
99 | int8 tr103A, tr110A, tr104A, tr104B; // Casovace rolet |
100 | int8 tr103V, tr110N, tr104V, tr104J; // Casovace rolet |
- | 101 | int8 timer; // Casovac komunikace |
|
100 | |
102 | |
101 | #int_TIMER0 |
103 | #int_TIMER0 |
102 | void TIMER0_isr(void) |
104 | void TIMER0_isr(void) |
103 | { |
105 | { |
104 | if(tr103A>0) tr103A--; |
106 | if(tr103V>0) tr103V--; |
105 | if(tr110A>0) tr110A--; |
107 | if(tr110N>0) tr110N--; |
106 | if(tr104A>0) tr104A--; |
108 | if(tr104V>0) tr104V--; |
107 | if(tr104B>0) tr104B--; |
109 | if(tr104J>0) tr104J--; |
- | 110 | if(timer>0) timer--; |
|
108 | output_toggle(LED2); |
111 | output_toggle(LED2); |
109 | } |
112 | } |
110 | |
113 | |
111 | void up(state *status, int8 *timer) // Zmena stavu rolety smer nahoru |
114 | void up(state *status, int8 *timer) // Zmena stavu rolety smer nahoru |
112 | { |
115 | { |
113 | switch (*status) |
116 | switch (*status) |
114 | { |
117 | { |
115 | case STOP: |
118 | case STOP: |
116 | case GO_DOWN: |
119 | case GO_DOWN: |
117 | *status=REVERS_UP; |
120 | *status=REVERS_UP; |
118 | *timer=REVERS; |
121 | *timer=REVERS; |
119 | break; |
122 | break; |
120 | case REVERS_UP: |
123 | case REVERS_UP: |
121 | case GO_UP: |
124 | case GO_UP: |
122 | *status=STOP; |
125 | *status=STOP; |
123 | *timer=0; |
126 | *timer=0; |
124 | break; |
127 | break; |
125 | } |
128 | } |
126 | } |
129 | } |
127 | |
130 | |
128 | void down(state *status, int8 *timer) // Zmena stavu rolety smer dolu |
131 | void down(state *status, int8 *timer) // Zmena stavu rolety smer dolu |
129 | { |
132 | { |
130 | switch (*status) |
133 | switch (*status) |
131 | { |
134 | { |
132 | case STOP: |
135 | case STOP: |
133 | case GO_UP: |
136 | case GO_UP: |
134 | *status=REVERS_DOWN; |
137 | *status=REVERS_DOWN; |
135 | *timer=REVERS; |
138 | *timer=REVERS; |
136 | break; |
139 | break; |
137 | case REVERS_DOWN: |
140 | case REVERS_DOWN: |
138 | case GO_DOWN: |
141 | case GO_DOWN: |
139 | *status=STOP; |
142 | *status=STOP; |
140 | *timer=0; |
143 | *timer=0; |
141 | break; |
144 | break; |
142 | } |
145 | } |
143 | } |
146 | } |
144 | |
147 | |
145 | #define run(x) { \ |
148 | #define run(x) { \ |
146 | switch(r##x) \ |
149 | switch(r##x) \ |
147 | { \ |
150 | { \ |
148 | case STOP: \ |
151 | case STOP: \ |
149 | OFF(R##x##U); \ |
152 | OFF(R##x##U); \ |
150 | OFF(R##x##D); \ |
153 | OFF(R##x##D); \ |
151 | break; \ |
154 | break; \ |
152 | case GO_UP: \ |
155 | case GO_UP: \ |
153 | ON(R##x##U); \ |
156 | ON(R##x##U); \ |
154 | OFF(R##x##D); \ |
157 | OFF(R##x##D); \ |
155 | if(tr##x==0) {r##x=STOP;} \ |
158 | if(tr##x==0) {r##x=STOP;} \ |
156 | break; \ |
159 | break; \ |
157 | case GO_DOWN: \ |
160 | case GO_DOWN: \ |
158 | OFF(R##x##U); \ |
161 | OFF(R##x##U); \ |
159 | ON(R##x##D); \ |
162 | ON(R##x##D); \ |
160 | if(tr##x==0) {r##x=STOP;} \ |
163 | if(tr##x==0) {r##x=STOP;} \ |
161 | break; \ |
164 | break; \ |
162 | case REVERS_UP: \ |
165 | case REVERS_UP: \ |
163 | OFF(R##x##U); \ |
166 | OFF(R##x##U); \ |
164 | OFF(R##x##D); \ |
167 | OFF(R##x##D); \ |
165 | if(tr##x==0) {r##x=GO_UP; tr##x=GO;} \ |
168 | if(tr##x==0) {r##x=GO_UP; tr##x=GO;} \ |
166 | break; \ |
169 | break; \ |
167 | case REVERS_DOWN: \ |
170 | case REVERS_DOWN: \ |
168 | OFF(R##x##U); \ |
171 | OFF(R##x##U); \ |
169 | OFF(R##x##D); \ |
172 | OFF(R##x##D); \ |
170 | if(tr##x==0) {r##x=GO_DOWN; tr##x=GO;} \ |
173 | if(tr##x==0) {r##x=GO_DOWN; tr##x=GO;} \ |
171 | break; \ |
174 | break; \ |
172 | } \ |
175 | } \ |
173 | } |
176 | } |
174 | |
177 | |
175 | void main() |
178 | void main() |
176 | { |
179 | { |
177 | char c; |
180 | char buf[10]; |
178 | |
181 | |
179 | if(restart_cause()!= WDT_TIMEOUT) |
- | |
180 | { |
- | |
181 | setup_adc_ports(NO_ANALOGS|VSS_VDD); |
182 | setup_adc_ports(NO_ANALOGS|VSS_VDD); |
182 | setup_adc(ADC_CLOCK_DIV_2); |
183 | setup_adc(ADC_CLOCK_DIV_2); |
183 | setup_psp(PSP_DISABLED); |
184 | setup_psp(PSP_DISABLED); |
184 | setup_spi(SPI_SS_DISABLED); |
185 | setup_spi(SPI_SS_DISABLED); |
185 | setup_wdt(WDT_ON); |
186 | setup_wdt(WDT_OFF); |
186 | setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
187 | setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
187 | setup_timer_1(T1_DISABLED); |
188 | setup_timer_1(T1_DISABLED); |
188 | setup_timer_2(T2_DISABLED,0,1); |
189 | setup_timer_2(T2_DISABLED,0,1); |
189 | setup_timer_3(T3_DISABLED|T3_DIV_BY_1); |
190 | setup_timer_3(T3_DISABLED|T3_DIV_BY_1); |
190 | setup_ccp1(CCP_OFF); |
191 | setup_ccp1(CCP_OFF); |
191 | setup_comparator(NC_NC_NC_NC); |
192 | setup_comparator(NC_NC_NC_NC); |
192 | setup_vref(FALSE); |
193 | setup_vref(FALSE); |
- | 194 | |
|
- | 195 | OFF(S105A); // Vsechno zhasni a zastav |
|
- | 196 | OFF(R110NU); |
|
- | 197 | OFF(R110ND); |
|
- | 198 | OFF(S104A); |
|
- | 199 | OFF(R104VU); |
|
- | 200 | OFF(R104VD); |
|
- | 201 | OFF(R104JU); |
|
- | 202 | OFF(R104JD); |
|
- | 203 | OFF(S103J); |
|
- | 204 | OFF(R103VU); |
|
- | 205 | OFF(R103VD); |
|
- | 206 | OFF(S106A); |
|
- | 207 | OFF(S107A); |
|
- | 208 | OFF(S109A); |
|
- | 209 | OFF(S105Z); |
|
- | 210 | OFF(S102A); |
|
- | 211 | OFF(S110N); |
|
- | 212 | OFF(S108A); |
|
- | 213 | OFF(S201A); |
|
- | 214 | OFF(S110J); |
|
- | 215 | |
|
- | 216 | r103V=STOP; // Rolety jsou zastaveny |
|
- | 217 | r110N=STOP; |
|
- | 218 | r104V=STOP; |
|
- | 219 | r104J=STOP; |
|
- | 220 | |
|
- | 221 | output_high(LED1); // Indikace restartu |
|
- | 222 | delay_ms(100); |
|
- | 223 | output_low(LED1); |
|
- | 224 | delay_ms(30); |
|
- | 225 | output_high(LED1); |
|
- | 226 | restart_wdt(); |
|
- | 227 | delay_ms(100); |
|
- | 228 | output_low(LED1); |
|
- | 229 | delay_ms(30); |
|
- | 230 | output_high(LED1); |
|
- | 231 | restart_wdt(); |
|
193 | |
232 | |
194 | OFF(S105A); // Vsechno zhasni a zastav |
- | |
195 | OFF(R110AU); |
- | |
196 | OFF(R110AD); |
- | |
197 | OFF(S104A); |
- | |
198 | OFF(R104AU); |
- | |
199 | OFF(R104AD); |
- | |
200 | OFF(R104BU); |
- | |
201 | OFF(R104BD); |
- | |
202 | OFF(S103A); |
- | |
203 | OFF(R103AU); |
- | |
204 | OFF(R103AD); |
- | |
205 | OFF(S106A); |
- | |
206 | OFF(S107A); |
- | |
207 | OFF(S109A); |
- | |
208 | OFF(S101A); |
- | |
209 | OFF(S105D); |
- | |
210 | OFF(S102A); |
- | |
211 | OFF(S110C); |
- | |
212 | OFF(S108A); |
- | |
213 | OFF(S201A); |
- | |
214 | OFF(S110B); |
- | |
215 | |
- | |
216 | r103A=STOP; // Rolety jsou zastaveny |
- | |
217 | r110A=STOP; |
- | |
218 | r104A=STOP; |
- | |
219 | r104B=STOP; |
- | |
220 | |
- | |
221 | enable_interrupts(INT_TIMER0); |
233 | enable_interrupts(INT_TIMER0); |
222 | enable_interrupts(GLOBAL); |
234 | enable_interrupts(GLOBAL); |
223 | } |
- | |
224 | |
235 | |
225 | CREN=0; CREN=1; // Reinitialise USART |
236 | CREN=0; CREN=1; // Reinitialise USART |
226 | |
237 | |
227 | while(TRUE) |
238 | while(TRUE) |
228 | { |
239 | { |
- | 240 | |
|
229 | if(kbhit()) |
241 | if(kbhit()) // Chce po nas nekdo neco? |
230 | { |
242 | { |
231 | c=getc(); |
243 | buf[0]=getc(); |
232 | if(c=='S') |
244 | if((buf[0]=='S')||(buf[0]=='R')) // Jinym znakem nesmi zacinat prikaz |
233 | { |
245 | { |
- | 246 | int8 n=0; // Ukazatel do prijimaciho bufferu |
|
- | 247 | timer=RECEIVE; // Timeout pro prijem znaku |
|
- | 248 | |
|
234 | if(getc()=='1') |
249 | do |
235 | { |
250 | { |
236 | switch(getc()) |
251 | if(kbhit()) // Je dalsi znak? |
237 | { |
252 | { |
238 | case '1': |
- | |
239 | output_toggle(S101A); |
- | |
240 | break; |
253 | n++; |
241 | case '2': |
- | |
242 | output_toggle(S102A); |
- | |
243 | break; |
- | |
244 | case '3': |
- | |
245 | output_toggle(S103A); |
- | |
246 | break; |
- | |
247 | case '4': |
- | |
248 | output_toggle(S104A); |
- | |
249 | break; |
- | |
250 | case '5': |
- | |
251 | c=getc(); |
254 | buf[n]=getc(); |
252 | if(c=='A') {output_toggle(S105A);} |
- | |
253 | if(c=='D') {output_toggle(S105D);} |
- | |
254 | break; |
- | |
255 | case '6': |
- | |
256 | output_toggle(S106A); |
- | |
257 | break; |
- | |
258 | case '7': |
- | |
259 | output_toggle(S107A); |
- | |
260 | break; |
- | |
261 | case '8': |
- | |
262 | output_toggle(S108A); |
- | |
263 | break; |
- | |
264 | case '9': |
- | |
265 | output_toggle(S109A); |
- | |
266 | break; |
- | |
267 | case 'a': |
- | |
268 | output_toggle(S110B); |
- | |
269 | output_toggle(S110C); |
- | |
270 | break; |
- | |
271 | } |
255 | } |
272 | } |
256 | } while ((buf[n]!='\r')&&(timer>0)&&(n<7)); |
273 | } |
257 | |
- | 258 | if (timer==0) { CREN=0; CREN=1; } // Reinitialise USART |
|
274 | |
259 | |
275 | if(c=='R') |
260 | output_toggle(LED1); // Ukonceni prijimani prikazu |
276 | { |
261 | |
277 | if(getc()=='1') |
262 | if((timer>0)) |
278 | { |
263 | { |
- | 264 | |
|
- | 265 | if((buf[0]=='S')&&(n>=4)) // Zmena stavu svetla |
|
- | 266 | { |
|
- | 267 | if(buf[1]=='1') |
|
- | 268 | { |
|
279 | switch(getc()) |
269 | switch(buf[2]) |
- | 270 | { |
|
- | 271 | case '2': |
|
- | 272 | output_toggle(S102A); |
|
- | 273 | break; |
|
- | 274 | case '3': |
|
- | 275 | output_toggle(S103J); |
|
- | 276 | break; |
|
- | 277 | case '4': |
|
- | 278 | output_toggle(S104A); |
|
- | 279 | break; |
|
- | 280 | case '5': |
|
- | 281 | if(buf[3]=='A') {output_toggle(S105A);} |
|
- | 282 | if(buf[3]=='Z') {output_toggle(S105Z);} |
|
- | 283 | break; |
|
- | 284 | case '6': |
|
- | 285 | output_toggle(S106A); |
|
- | 286 | break; |
|
- | 287 | case '7': |
|
- | 288 | output_toggle(S107A); |
|
- | 289 | break; |
|
- | 290 | case '8': |
|
- | 291 | output_toggle(S108A); |
|
- | 292 | break; |
|
- | 293 | case '9': |
|
- | 294 | output_toggle(S109A); |
|
- | 295 | break; |
|
- | 296 | case 'a': |
|
- | 297 | output_toggle(S110J); |
|
- | 298 | output_toggle(S110N); |
|
- | 299 | break; |
|
- | 300 | } |
|
- | 301 | } |
|
- | 302 | } |
|
- | 303 | |
|
- | 304 | if((buf[0]=='R')&&(n>=5)) // Zmena stavu rolety |
|
280 | { |
305 | { |
281 | case '3': |
306 | if(buf[1]=='1') |
282 | getc(); // A |
307 | { |
283 | if((getc()=='U')) {up(&r103A,&tr103A);} else {down(&r103A,&tr103A);} |
308 | switch(buf[2]) |
284 | break; |
309 | { |
285 | case '4': |
310 | case '3': |
- | 311 | if(buf[4]=='U') {up(&r103V,&tr103V);} else {down(&r103V,&tr103V);} |
|
- | 312 | break; |
|
286 | c=getc(); |
313 | case '4': |
287 | if(c=='A') if((getc()=='U')) {up(&r104A,&tr104A);} else {down(&r104A,&tr104A);} |
314 | if(buf[3]=='V') if((buf[4]=='U')) {up(&r104V,&tr104V);} else {down(&r104V,&tr104V);} |
288 | if(c=='B') if((getc()=='U')) {up(&r104B,&tr104B);} else {down(&r104B,&tr104B);} |
315 | if(buf[3]=='J') if((buf[4]=='U')) {up(&r104J,&tr104J);} else {down(&r104J,&tr104J);} |
289 | break; |
316 | break; |
290 | case 'a': |
317 | case 'a': |
- | 318 | if((buf[4]=='U')) {up(&r110N,&tr110N);} else {down(&r110N,&tr110N);} |
|
291 | getc(); // A |
319 | break; |
292 | if((getc()=='U')) {up(&r110A,&tr110A);} else {down(&r110A,&tr110A);} |
320 | } |
293 | break; |
321 | } |
294 | } |
322 | } |
- | 323 | |
|
295 | } |
324 | } |
296 | } |
325 | } |
297 | |
- | |
298 | output_toggle(LED1); // Prijmuli jsme cely prikaz |
- | |
299 | } |
326 | } |
300 | else |
327 | |
301 | { |
- | |
302 | run(103A); |
328 | run(103V); // Rizeni rolet za behu |
303 | run(104A); |
329 | run(104V); |
304 | run(104B); |
330 | run(104J); |
305 | |
331 | |
306 | switch(r110A) |
332 | switch(r110N) // Zaluzie ma specielni rizeni |
307 | { |
333 | { |
308 | case STOP: |
334 | case STOP: |
309 | OFF(R110AU); |
335 | OFF(R110NU); |
310 | OFF(R110AD); |
336 | OFF(R110ND); |
311 | break; |
337 | break; |
312 | case GO_UP: |
338 | case GO_UP: |
313 | ON(R110AU); |
339 | ON(R110NU); |
314 | OFF(R110AD); |
340 | OFF(R110ND); |
315 | if(tr110A==0) {r110A=STOP;} |
341 | if(tr110N==0) {r110N=STOP;} |
316 | break; |
342 | break; |
317 | case GO_DOWN: |
343 | case GO_DOWN: |
318 | OFF(R110AU); |
344 | OFF(R110NU); |
319 | ON(R110AD); |
345 | ON(R110ND); |
320 | if(tr110A==0) {r110A=STOP;} |
346 | if(tr110N==0) {r110N=STOP;} |
321 | break; |
347 | break; |
322 | case REVERS_UP: |
348 | case REVERS_UP: |
323 | OFF(R110AU); |
349 | OFF(R110NU); |
324 | OFF(R110AD); |
350 | OFF(R110ND); |
325 | if(tr110A==0) {r110A=GO_UP; tr110A=GO_ZALUZIE;} |
351 | if(tr110N==0) {r110N=GO_UP; tr110N=GO_ZALUZIE;} |
326 | break; |
352 | break; |
327 | case REVERS_DOWN: |
353 | case REVERS_DOWN: |
328 | OFF(R110AU); |
354 | OFF(R110NU); |
329 | OFF(R110AD); |
355 | OFF(R110ND); |
330 | if(tr110A==0) {r110A=GO_DOWN; tr110A=GO_ZALUZIE;} |
356 | if(tr110N==0) {r110N=GO_DOWN; tr110N=GO_ZALUZIE;} |
331 | break; |
357 | break; |
332 | } |
358 | } |
333 | /* |
359 | /* |
334 | switch(r110A) |
360 | switch(r110A) |
335 | { |
361 | { |
336 | case GO_UP: |
362 | case GO_UP: |
337 | printf("U"); |
363 | printf("U"); |
338 | break; |
364 | break; |
339 | case GO_DOWN: |
365 | case GO_DOWN: |
340 | printf("D"); |
366 | printf("D"); |
341 | break; |
367 | break; |
342 | case REVERS_UP: |
368 | case REVERS_UP: |
343 | printf("R"); |
369 | printf("R"); |
344 | break; |
370 | break; |
345 | case REVERS_DOWN: |
371 | case REVERS_DOWN: |
346 | printf("E"); |
372 | printf("E"); |
347 | break; |
373 | break; |
348 | case STOP: |
374 | case STOP: |
349 | printf("S"); |
375 | printf("S"); |
350 | break; |
376 | break; |
351 | } |
377 | } |
352 | */ |
378 | */ |
353 | restart_wdt(); |
379 | restart_wdt(); |
354 | } |
- | |
355 | } |
380 | } |
356 | } |
381 | } |