# HG changeset patch # User Malte Bayer # Date 1324127476 -3600 # Node ID e0738355b517fb70cc7ce4df31646134c1bf7140 # Parent 7ed95dbadf1f123475f2ba3323ffa2f28d20afba bugfix: ghostcar assignment to slots 5 and 6 diff -r 7ed95dbadf1f -r e0738355b517 blackbox/lowlevel.c --- a/blackbox/lowlevel.c Sat Dec 17 13:35:40 2011 +0100 +++ b/blackbox/lowlevel.c Sat Dec 17 14:11:16 2011 +0100 @@ -78,7 +78,7 @@ // switch pull-ups SW_FUEL_PORT |= _BV(SW_FUEL); SW_START_PORT |= _BV(SW_START); - SW_PACECAR_PORT |= _BV(SW_PACECAR); + //SW_PACECAR_PORT |= _BV(SW_PACECAR); // control outputs DDR(LAP_COUNTER_PORT) |= _BV(LAP_COUNTER); diff -r 7ed95dbadf1f -r e0738355b517 blackbox/main.c --- a/blackbox/main.c Sat Dec 17 13:35:40 2011 +0100 +++ b/blackbox/main.c Sat Dec 17 14:11:16 2011 +0100 @@ -347,7 +347,6 @@ if (controller == 5) tmp = ((getADC(CONTROLLER2_SPEED) / CONTROLLER_DIVISOR) & 0x0F); if (controller == 4) trackchange = (PIN(CONTROLLER_PORT) & _BV(CONTROLLER1_SW)); if (controller == 5) trackchange = (PIN(CONTROLLER_PORT) & _BV(CONTROLLER2_SW)); - speed = tmp; } else { // read speeds if ((controller == 0) && (mode!=1)) tmp = ((getADC(CONTROLLER1_SPEED) / CONTROLLER_DIVISOR) & 0x0F); @@ -364,41 +363,35 @@ if ((mode == 2) && (tmp != 0)) { jumpstart(controller); tmp = 0; } if (tmp > slot[controller].speedlimit) tmp = slot[controller].speedlimit; if (slot[controller].canrefuel && (tmp > PITLANE_SPEEDLIMIT)) tmp = PITLANE_SPEEDLIMIT; - speed = tmp; - tmp = tmp << 1; } else { if ((mode == 0) && (tmp < slot[controller].speedminimum)) tmp = slot[controller].speedminimum; if (tmp > slot[controller].speedlimit) tmp = slot[controller].speedlimit; - speed = tmp; - tmp = tmp << 1; - //if ( (trackchange!=0) || (slot[controller].trackswitch)) tmp |= (1<<5); - if (trackchange!=0) tmp |= (1<<5); + // //if ( (trackchange!=0) || (slot[controller].trackswitch)) tmp |= (1<<5); } + } + speed = tmp; + tmp = tmp << 1; + if (trackchange != 0) tmp |= (1<<5); - } switch (controller) { case 0: if (trackchange != 0) { - tmp |= (1<<5); if (mode == 0) LED(1,0); } else if (mode == 0) LED(1,1); break; case 1: if (trackchange != 0) { - tmp |= (1<<5); if (mode == 0) LED(2,0); } else if (mode == 0) LED(2,1); break; case 2: if (trackchange != 0) { - tmp |= (1<<5); if (mode == 0) LED(4,0); } else if (mode == 0) LED(4,1); break; case 3: if (trackchange != 0) { - tmp |= (1<<5); if (mode == 0) LED(5,0); } else if (mode == 0) LED(5,1); break;