# HG changeset patch # User Malte Bayer # Date 1351442470 -3600 # Node ID 95b2c23cb973c2ffbf95c8a321fd964b3d581292 # Parent 52fd4283cd2ce793f4cd3cb078f78859bbb22d88 pitlane checkout bug resolved, prepare for customized pitlane speedlimit diff -r 52fd4283cd2c -r 95b2c23cb973 blackbox/main.c --- a/blackbox/main.c Sun Oct 28 16:18:53 2012 +0100 +++ b/blackbox/main.c Sun Oct 28 17:41:10 2012 +0100 @@ -32,7 +32,7 @@ #define FUEL_FULL 10000 #define FUEL_JUMPSTART 5000 #define FUEL_DIV_DEFAULT 25 -#define PITLANE_SPEEDLIMIT 4 +#define PITLANE_SPEEDLIMIT 6 volatile uint8_t fuel_divisor = FUEL_DIV_DEFAULT; // default, can be set via serial command typedef struct { @@ -41,6 +41,7 @@ unsigned seccnt:4; // 4 bits tenth seconds counter unsigned accel:4; // 4 bits last configured acceleration unsigned speed:4; // 4 bits last speed + unsigned pitlane_limit:4; // 4bits speedlimit unsigned trackswitch:1; // 1bit bool unsigned canrefuel:1; // 1bit bool unsigned unlimitedfuel:1; // 1bit bool @@ -152,6 +153,7 @@ // pitlane response if (status == 5) slot[car].canrefuel = 1; if (status == 6) for (data=0; data slot[controller].speedlimit) tmp = slot[controller].speedlimit; - if (slot[controller].canrefuel && (tmp > PITLANE_SPEEDLIMIT)) tmp = PITLANE_SPEEDLIMIT; + if (slot[controller].canrefuel && (tmp > slot[controller].pitlane_limit)) tmp = slot[controller].pitlane_limit; } else { if ((mode == 0) && (tmp < slot[controller].speedminimum)) tmp = slot[controller].speedminimum; if (tmp > slot[controller].speedlimit) tmp = slot[controller].speedlimit; @@ -490,6 +492,7 @@ slot[i].seccnt = 0; slot[i].accel = 15; // full acceleration per default - TODO slot[i].canrefuel = 0; + slot[i].pitlane_limit = PITLANE_SPEEDLIMIT; if (i<4) slot[i].unlimitedfuel = 0; else slot[i].unlimitedfuel = 1; slot[i].lap_time_start.value = 0; slot[i].lap_time.value = 0; diff -r 52fd4283cd2c -r 95b2c23cb973 pitlane/Makefile --- a/pitlane/Makefile Sun Oct 28 16:18:53 2012 +0100 +++ b/pitlane/Makefile Sun Oct 28 17:41:10 2012 +0100 @@ -13,6 +13,11 @@ BAUD=38400 ISP_BAUD = 115200 +ifdef USB +PORT=/dev/ttyUSB$(USB) +else +PORT=/dev/ttyS0 +endif #SRC = main.c seriald.c driver/ADC.c driver/clock.c driver/timer.c #SRC = main.c driver/rs232.c driver/manchester.c @@ -74,7 +79,10 @@ rm $(PRG).map program: code - $(AVRDUDE) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i + $(AVRDUDE) -P $(PORT) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i + +backup: + $(AVRDUDE) -P $(PORT) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:r:$(PRG)_backup.hex:i fuse: $(AVRDUDE) -c stk500 -p $(MCU) -V $(FUSES) diff -r 52fd4283cd2c -r 95b2c23cb973 pitlane/main.c --- a/pitlane/main.c Sun Oct 28 16:18:53 2012 +0100 +++ b/pitlane/main.c Sun Oct 28 17:41:10 2012 +0100 @@ -356,12 +356,16 @@ // we have to detect which car is passing sensor2 - but at the moment we are lack of external interrupt source if ( (PIN(SENS2_PORT) & _BV(SENS2_PIN)) != 0 ) { // set inside status - for (tmp=0; tmp0, so parking cars will not get "outside" + if (slot[tmp].inside && (slot[tmp].speed > 0)) { + slot[tmp].inside = 0; + response = 7; + response_car = tmp; + } } - response = 6; - response_car = 0; + //response = 6; + //response_car = 0; RS232_puts_p(PSTR("PIT:EXIT\n")); } diff -r 52fd4283cd2c -r 95b2c23cb973 slotUI/SlotCli.py --- a/slotUI/SlotCli.py Sun Oct 28 16:18:53 2012 +0100 +++ b/slotUI/SlotCli.py Sun Oct 28 17:41:10 2012 +0100 @@ -462,7 +462,7 @@ if (status == 5): self.slot[slot]["status"] = "PITLANE" trigger_sound("pitlane_enter") - if (status == 6): + if (status == 7): self.slot[slot]["status"] = "IN-RACE" trigger_sound("pitlane_exit") diff -r 52fd4283cd2c -r 95b2c23cb973 trackswitch/Makefile --- a/trackswitch/Makefile Sun Oct 28 16:18:53 2012 +0100 +++ b/trackswitch/Makefile Sun Oct 28 17:41:10 2012 +0100 @@ -13,6 +13,11 @@ BAUD=38400 ISP_BAUD = 115200 +ifdef USB +PORT=/dev/ttyUSB$(USB) +else +PORT=/dev/ttyS0 +endif #SRC = main.c seriald.c driver/ADC.c driver/clock.c driver/timer.c #SRC = main.c driver/rs232.c driver/manchester.c @@ -74,7 +79,10 @@ rm $(PRG).map program: code - $(AVRDUDE) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i + $(AVRDUDE) -P $(PORT) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i + +backup: + $(AVRDUDE) -P $(PORT) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:r:$(PRG)_backup.hex:i fuse: $(AVRDUDE) -c stk500 -p $(MCU) -V $(FUSES)