blackbox/main.c

changeset 143
cb514887cf17
parent 142
a933d44a6edc
child 144
8f07a8d15826
equal deleted inserted replaced
142:a933d44a6edc 143:cb514887cf17
13 #include "main.h" 13 #include "main.h"
14 #include "lowlevel.h" 14 #include "lowlevel.h"
15 15
16 const char ok[] PROGMEM="OK\n"; 16 const char ok[] PROGMEM="OK\n";
17 const char busy[] PROGMEM="BUSY\n"; 17 const char busy[] PROGMEM="BUSY\n";
18 const char error[] PROGMEM="ERROR\n";
18 19
19 const char prepare[] PROGMEM="!PRE\n"; 20 const char prepare[] PROGMEM="!PRE\n";
20 const char countdownstart[] PROGMEM="!SET\n"; 21 const char countdownstart[] PROGMEM="!SET\n";
21 const char racestart[] PROGMEM="!GO\n"; 22 const char racestart[] PROGMEM="!GO\n";
22 23
249 program_count = 0x02; // send commands twice (fuel, speed, brake) 250 program_count = 0x02; // send commands twice (fuel, speed, brake)
250 else 251 else
251 program_count = 0x01; 252 program_count = 0x01;
252 RS232_puts_p(ok); 253 RS232_puts_p(ok);
253 } else RS232_puts_p(busy); 254 } else RS232_puts_p(busy);
255 break;
256
257 case 'U': // Set unlimited fuel status for a car (id 4..5 default to unlimited fuel)
258 tmp = buffer[1]-'0';
259 if (tmp < 6) {
260 slot[tmp].unlimitedfuel = 0;
261 if ((buffer[2]-'0') != 0) slot[tmp].unlimitedfuel = 1;
262 RS232_puts_p(ok);
263 } RS232_puts_p(error);
254 break; 264 break;
255 265
256 case 'L': // Limit maximum speed for a car 266 case 'L': // Limit maximum speed for a car
257 tmp = buffer[2]-'0'; 267 tmp = buffer[2]-'0';
258 if (tmp > 9) 268 if (tmp > 9)

mercurial