169 if (switches.pitlane_finishline) slot[car].laps++; |
169 if (switches.pitlane_finishline) slot[car].laps++; |
170 } |
170 } |
171 if (status == 6) for (data=0; data<MAX_SLOTS; data++) slot[data].canrefuel = 0; |
171 if (status == 6) for (data=0; data<MAX_SLOTS; data++) slot[data].canrefuel = 0; |
172 if (status == 7) slot[car].canrefuel = 0; |
172 if (status == 7) slot[car].canrefuel = 0; |
173 } |
173 } |
174 |
|
175 /* Old ASCII Format: |
|
176 RS232_puts("RW:"); |
|
177 RS232_putc(car + '0'); |
|
178 RS232_putc(':'); |
|
179 RS232_putc(type + '0'); |
|
180 RS232_putc(':'); |
|
181 itoa(sender, s, 16); |
|
182 RS232_puts(s); |
|
183 RS232_putc(':'); |
|
184 itoa(status, s, 16); |
|
185 RS232_puts(s); |
|
186 RS232_putc(':'); |
|
187 ultoa(sysclk.value, s, 16); |
|
188 RS232_puts(s); |
|
189 RS232_putc('\n'); |
|
190 */ |
|
191 |
174 |
192 // New binary protocol: TODO: compress sender & status, car & type |
175 // New binary protocol: TODO: compress sender & status, car & type |
193 RS232_puts("RW:\n"); |
176 RS232_puts("RW:\n"); |
194 RS232_putc(8); // 8 binary bytes following |
177 RS232_putc(8); // 8 binary bytes following |
195 RS232_putc(car); |
178 RS232_putc(car); |
576 if (slot[car0-1].lap_time_start.value != 0) { |
559 if (slot[car0-1].lap_time_start.value != 0) { |
577 slot[car0-1].lap_time.value = diff.value; |
560 slot[car0-1].lap_time.value = diff.value; |
578 slot[car0-1].laps++; |
561 slot[car0-1].laps++; |
579 laps.value = slot[car0-1].laps; |
562 laps.value = slot[car0-1].laps; |
580 // New binary protocol: |
563 // New binary protocol: |
581 RS232_puts("L:3:\n"); // 3 = BB |
564 RS232_puts("L:\n"); |
582 RS232_putc(11); // binary bytes following |
565 RS232_putc(12); // binary bytes following |
|
566 RS232_putc(3); // 3 = Track BB |
583 RS232_putc(laps.byte[1]); |
567 RS232_putc(laps.byte[1]); |
584 RS232_putc(laps.byte[0]); |
568 RS232_putc(laps.byte[0]); |
585 RS232_putc(car0_state); // slot number |
569 RS232_putc(car0_state); // slot number |
586 RS232_putc(diff.byte[3]); |
570 RS232_putc(diff.byte[3]); |
587 RS232_putc(diff.byte[2]); |
571 RS232_putc(diff.byte[2]); |
607 if (slot[car1-1].lap_time_start.value != 0) { |
591 if (slot[car1-1].lap_time_start.value != 0) { |
608 slot[car1-1].lap_time.value = diff.value; |
592 slot[car1-1].lap_time.value = diff.value; |
609 slot[car1-1].laps++; |
593 slot[car1-1].laps++; |
610 laps.value = slot[car1-1].laps; |
594 laps.value = slot[car1-1].laps; |
611 // New binary protocol: |
595 // New binary protocol: |
612 RS232_puts("L:1:\n"); // 1 = AA |
596 RS232_puts("L:\n"); |
613 RS232_putc(11); // binary bytes following |
597 RS232_putc(12); // binary bytes following |
|
598 RS232_putc(1); // 1 = Track AA |
614 RS232_putc(laps.byte[1]); |
599 RS232_putc(laps.byte[1]); |
615 RS232_putc(laps.byte[0]); |
600 RS232_putc(laps.byte[0]); |
616 RS232_putc(car1_state); // slot number |
601 RS232_putc(car1_state); // slot number |
617 RS232_putc(diff.byte[3]); |
602 RS232_putc(diff.byte[3]); |
618 RS232_putc(diff.byte[2]); |
603 RS232_putc(diff.byte[2]); |