340 RS232_putc('0'+sens[1].state); |
340 RS232_putc('0'+sens[1].state); |
341 RS232_putc('\n'); |
341 RS232_putc('\n'); |
342 } |
342 } |
343 } sens[1].car = 0; |
343 } sens[1].car = 0; |
344 |
344 |
|
345 // TODO: At the moment, all "inside" cars gets exit response, but probably only the last response will be sent |
|
346 // we have to detect which car is passing sensor2 - but at the moment we are lack of external interrupt source |
345 if ( (PIN(SENS2_PORT) & _BV(SENS2_PIN)) != 0 ) { |
347 if ( (PIN(SENS2_PORT) & _BV(SENS2_PIN)) != 0 ) { |
346 // set inside status |
348 // set inside status |
347 for (tmp=0; tmp<MAX_SLOTS; tmp++) |
349 for (tmp=0; tmp<MAX_SLOTS; tmp++) |
|
350 if (slot[tmp].inside) { |
|
351 response = (1 | ((tmp)<<1) | (4 << 4)); |
348 slot[tmp].inside = 0; |
352 slot[tmp].inside = 0; |
|
353 } |
349 RS232_puts_p(PSTR("PIT:EXIT\n")); |
354 RS232_puts_p(PSTR("PIT:EXIT\n")); |
350 } |
355 } |
351 |
356 |
352 if (sens[2].car != sens[2].state) { |
357 if (sens[2].car != sens[2].state) { |
353 sens[2].state = sens[2].car; |
358 sens[2].state = sens[2].car; |