Sat, 17 Dec 2011 14:37:55 +0100
fix: ghostcars unlimited fuel
blackbox/main.c | file | annotate | diff | comparison | revisions | |
blackbox/main.h | file | annotate | diff | comparison | revisions |
--- a/blackbox/main.c Sat Dec 17 14:11:16 2011 +0100 +++ b/blackbox/main.c Sat Dec 17 14:37:55 2011 +0100 @@ -42,6 +42,7 @@ unsigned accel:4; // 4 bits last configured acceleration unsigned trackswitch:1; // 1bit bool unsigned canrefuel:1; // 1bit bool + unsigned unlimitedfuel:1; // 1bit bool uint16_t jumpstart_time, laps, fuel; u32 lap_time_start, lap_time; } cardata; @@ -400,9 +401,9 @@ tmp |= (0b1000000000 | (controller << 6)); // FUEL BIT GETS SET WHEN FUEL == 0, // THIS REQUIRES PHYSICAL CAR FUEL LEVEL SET TO ZERO BEFORE! - if ( ((PIN(SW_FUEL_PORT) & _BV(SW_FUEL)) != 0) | (slot[controller].fuel == 0)) tmp |= 1; // benzinstand aktiv - tankmodusschalter + if ( ((PIN(SW_FUEL_PORT) & _BV(SW_FUEL)) != 0) | (slot[controller].fuel == 0)) tmp |= 1; if (insert_queue(tmp, 9)) { - if (fuel_enabled) { + if ((fuel_enabled) && (slot[controller].unlimitedfuel == 0)) { if (speed != 0) { // do the fuel calculation, regardless if fuel logic active or not tmp = (uint8_t)(((slot[controller].accel * speed) + 1) / fuel_divisor); @@ -485,6 +486,7 @@ slot[i].seccnt = 0; slot[i].accel = 15; // full acceleration per default - TODO slot[i].canrefuel = 0; + 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; } @@ -596,11 +598,8 @@ int main(void) { - uint8_t packet_index = 1; - - init_hardware(); reset_vars(); LED(3, 1); // enable middle led == idle mode