bugfix: ghostcar assignment to slots 5 and 6

Sat, 17 Dec 2011 14:11:16 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Sat, 17 Dec 2011 14:11:16 +0100
changeset 91
e0738355b517
parent 90
7ed95dbadf1f
child 92
c57f43f25a5c

bugfix: ghostcar assignment to slots 5 and 6

blackbox/lowlevel.c file | annotate | diff | comparison | revisions
blackbox/main.c file | annotate | diff | comparison | revisions
--- 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);
--- 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;

mercurial