Wed, 07 Dec 2011 17:00:32 +0100
jumpstart time output via interface
blackbox/main.c | file | annotate | diff | comparison | revisions | |
blackbox/main.h | file | annotate | diff | comparison | revisions |
--- a/blackbox/main.c Wed Dec 07 16:50:51 2011 +0100 +++ b/blackbox/main.c Wed Dec 07 17:00:32 2011 +0100 @@ -20,6 +20,7 @@ char racestart[] PROGMEM="!RACE START\n"; +static unsigned char s[10]; static uint8_t countdown, countdown_loops; uint8_t mode = 0; // valid race modes: @@ -36,7 +37,7 @@ volatile uint8_t speedlimit[MAX_SLOTS]; volatile uint8_t fuel[MAX_SLOTS]; -volatile uint8_t jumpstart_time[MAX_SLOTS]; +volatile uint16_t jumpstart_time[MAX_SLOTS]; volatile uint16_t car0, car1; volatile uint16_t car0_new, car0_old; @@ -118,9 +119,17 @@ RS232_putc(':'); for (tmp=0;tmp<MAX_SLOTS;tmp++) RS232_putc(speedlimit[tmp]); // output speed limits RS232_putc(':'); - for (tmp=0;tmp<MAX_SLOTS;tmp++) RS232_putc(fuel[tmp]); // output fuel levels (0=empty, 100=full, 0xff=no fuel option) + for (tmp=0;tmp<MAX_SLOTS;tmp++) { + itoa(fuel[tmp], s, 16); + RS232_putc(s); // output fuel levels (0=empty, 100=full, 0xff=no fuel option) + RS232_putc(','); + } RS232_putc(':'); - for (tmp=0;tmp<MAX_SLOTS;tmp++) RS232_putc(jumpstart_time[tmp]); // output jumpstart times + for (tmp=0;tmp<MAX_SLOTS;tmp++) { + itoa(jumpstart_time[tmp], s, 16); + RS232_puts(s); // output jumpstart times + RS232_putc(','); + } RS232_putc(':'); RS232_putc('\n'); break; @@ -141,6 +150,9 @@ jumpstart_time[controller] = sysclk_ms_low; RS232_putc('~'); RS232_putc('0'-controller); + RS232_putc(','); + itoa(jumpstart_time[controller], s, 16); + RS232_puts(s); RS232_putc('\n'); } @@ -426,7 +438,6 @@ int main(void) { - unsigned char s[10]; uint8_t packet_index = 1; uint8_t btn_start = _BV(SW_START);