pitlane/main.c

changeset 104
95b2c23cb973
parent 73
ec888cfa024e
equal deleted inserted replaced
103:52fd4283cd2c 104:95b2c23cb973
354 354
355 // TODO: At the moment, all "inside" cars gets exit response, but probably only the last response will be sent 355 // TODO: At the moment, all "inside" cars gets exit response, but probably only the last response will be sent
356 // we have to detect which car is passing sensor2 - but at the moment we are lack of external interrupt source 356 // we have to detect which car is passing sensor2 - but at the moment we are lack of external interrupt source
357 if ( (PIN(SENS2_PORT) & _BV(SENS2_PIN)) != 0 ) { 357 if ( (PIN(SENS2_PORT) & _BV(SENS2_PIN)) != 0 ) {
358 // set inside status 358 // set inside status
359 for (tmp=0; tmp<MAX_SLOTS; tmp++) 359 for (tmp=0; tmp<MAX_SLOTS; tmp++) {
360 if (slot[tmp].inside) { 360 // workaround: only reset tanking on cars which have speed>0, so parking cars will not get "outside"
361 slot[tmp].inside = 0; 361 if (slot[tmp].inside && (slot[tmp].speed > 0)) {
362 slot[tmp].inside = 0;
363 response = 7;
364 response_car = tmp;
365 }
362 } 366 }
363 response = 6; 367 //response = 6;
364 response_car = 0; 368 //response_car = 0;
365 RS232_puts_p(PSTR("PIT:EXIT\n")); 369 RS232_puts_p(PSTR("PIT:EXIT\n"));
366 } 370 }
367 371
368 if (sens[2].car != sens[2].state) { 372 if (sens[2].car != sens[2].state) {
369 sens[2].state = sens[2].car; 373 sens[2].state = sens[2].car;

mercurial