--- a/pitlane/main.c Fri Dec 09 22:15:50 2011 +0100 +++ b/pitlane/main.c Fri Dec 09 22:30:55 2011 +0100 @@ -24,7 +24,9 @@ #define SOLENOID_A_PIN PB1 #define SOLENOID_B_PIN PB2 -#define TRACKSWITCH_TYPE 2 // 1=double, 2=single, 3=pitlane +#define TRACKSWITCH_TYPE 4 // 1=double, 2=single, 4=pitlane +#define TYPE_PITLANE 4 + #define MAX_SENSORS 3 #define PIT_PORT PORTC @@ -37,6 +39,7 @@ #define LED_PORT PORTB #define LED_PIN PB5 + // internal analog comparator doesnt work well //#define ANALOG_COMPARATOR 1 @@ -278,9 +281,11 @@ 2 = BB 3 = BA 4 = ZZ -> pitlane exit + 5 = BC */ if (sens[0].car != sens[0].state) { sens[0].state = sens[0].car; +#if TRACKSWITCH_TYPE != TYPE_PITLANE if ( (sens[0].state != 0) && (slot[sens[0].state-1].trackswitch == 0) && (slot[sens[0].state-1].speed>0) ) { response = (1 | ((sens[0].state-1)<<1) | (1 << 4)); @@ -298,6 +303,7 @@ SOLENOID_A_PORT &= ~_BV(SOLENOID_A_PIN); solenoid_delay(); } +#endif if (sens[0].state != 0) { response = (1 | ((sens[0].state-1)<<1)); RS232_putc('A'); @@ -311,14 +317,14 @@ if (sens[1].car != sens[1].state) { sens[1].state = sens[1].car; if ( (sens[1].state != 0) && (slot[sens[1].state-1].trackswitch == 0) && (slot[sens[1].state-1].speed>0) ) { - response = (1 | ((sens[1].state-1)<<1) | (3 << 4)); + response = (1 | ((sens[1].state-1)<<1) | (5 << 4)); // set inside status slot[sens[1].state-1].inside = 1; // trigger solenoid B RS232_putc('B'); - RS232_putc('A'); + RS232_putc('C'); RS232_putc('0'+sens[1].state); RS232_putc('\n');