equal
deleted
inserted
replaced
266 if ((ret = command(console.cmd))) { |
266 if ((ret = command(console.cmd))) { |
267 |
267 |
268 } else { |
268 } else { |
269 ret = '\n'; |
269 ret = '\n'; |
270 } |
270 } |
271 |
271 |
272 // return to START with response |
272 // return to START with response |
273 console.state = START; |
273 console.state = START; |
274 return '\n'; // XXX: required to delimit command reponses.. |
274 return '\n'; // XXX: required to delimit command reponses.. |
275 |
275 |
276 } else if (c == ' ' || c == '\t' || c == ',') { |
276 } else if (c == ' ' || c == '\t' || c == ',') { |
277 // argument |
277 // argument |
278 if (console.state == CMD) { |
278 if (console.state == CMD) { |
279 console.state = ARG; |
279 console.state = ARG; |
280 console.argc = 0; |
280 console.argc = 0; |
288 |
288 |
289 return ','; |
289 return ','; |
290 } |
290 } |
291 } |
291 } |
292 |
292 |
293 // printable |
293 // printable |
294 } else if (32 < c && c < 128) { |
294 } else if (32 < c && c < 128) { |
295 // process input char |
295 // process input char |
296 if (console.state == START) { |
296 if (console.state == START) { |
297 console.cmd = c; |
297 console.cmd = c; |
298 console.state = CMD; |
298 console.state = CMD; |
309 } |
309 } |
310 } else { |
310 } else { |
311 // ignore |
311 // ignore |
312 return ' '; |
312 return ' '; |
313 } |
313 } |
314 |
314 |
315 // reject |
315 // reject |
316 console.state = ERROR; |
316 console.state = ERROR; |
317 return ERROR; |
317 return ERROR; |
318 } |
318 } |
319 |
319 |
333 dmx_init(); |
333 dmx_init(); |
334 |
334 |
335 // mainloop |
335 // mainloop |
336 char c = '>'; |
336 char c = '>'; |
337 unsigned timeout = 8000; // 2Hz |
337 unsigned timeout = 8000; // 2Hz |
338 |
338 |
339 // start |
339 // start |
340 sei(); |
340 sei(); |
341 serial_write(c); |
341 serial_write(c); |
342 |
342 |
343 while (true) { |
343 while (true) { |
351 while ((c = serial_read())) { |
351 while ((c = serial_read())) { |
352 serial_write(input(c)); |
352 serial_write(input(c)); |
353 } |
353 } |
354 |
354 |
355 //led_off(); |
355 //led_off(); |
356 |
356 |
357 // output |
357 // output |
358 update(); |
358 update(); |
359 } |
359 } |
360 } |
360 } |