# HG changeset patch # User Malte Bayer # Date 1387630186 -3600 # Node ID cb514887cf17d6f6c51433a56598d3e1a4bdcf6d # Parent a933d44a6edcb55a78a77f907e4c95e049a36ec1 added unlimited fuel for profile (set fuel=0 to enable) diff -r a933d44a6edc -r cb514887cf17 blackbox/main.c --- a/blackbox/main.c Sat Dec 21 13:08:43 2013 +0100 +++ b/blackbox/main.c Sat Dec 21 13:49:46 2013 +0100 @@ -15,6 +15,7 @@ const char ok[] PROGMEM="OK\n"; const char busy[] PROGMEM="BUSY\n"; +const char error[] PROGMEM="ERROR\n"; const char prepare[] PROGMEM="!PRE\n"; const char countdownstart[] PROGMEM="!SET\n"; @@ -253,6 +254,15 @@ } else RS232_puts_p(busy); break; + case 'U': // Set unlimited fuel status for a car (id 4..5 default to unlimited fuel) + tmp = buffer[1]-'0'; + if (tmp < 6) { + slot[tmp].unlimitedfuel = 0; + if ((buffer[2]-'0') != 0) slot[tmp].unlimitedfuel = 1; + RS232_puts_p(ok); + } RS232_puts_p(error); + break; + case 'L': // Limit maximum speed for a car tmp = buffer[2]-'0'; if (tmp > 9) diff -r a933d44a6edc -r cb514887cf17 slotUI/freeslot.py --- a/slotUI/freeslot.py Sat Dec 21 13:08:43 2013 +0100 +++ b/slotUI/freeslot.py Sat Dec 21 13:49:46 2013 +0100 @@ -191,6 +191,16 @@ else: return self.com.query( "P40%i" % carid ) + def unlimitedfuel(self, carid, boolval): + """ + Set unlimited fuel on/off for a car + """ + if (carid < 0) or (carid > 5): + return "ERR - invalid carid" + value = 0 + if boolval: value = 1 + return self.com.query( "U%i%i" % (carid, value) ) + def speedlimit(self, carid, value): """ Set the maximum controller speed for a car diff -r a933d44a6edc -r cb514887cf17 slotUI/slotCli.py --- a/slotUI/slotCli.py Sat Dec 21 13:08:43 2013 +0100 +++ b/slotUI/slotCli.py Sat Dec 21 13:49:46 2013 +0100 @@ -227,6 +227,8 @@ sleep(0.5) self.box.speedlimit(slot, self.slot[slot]["limit"]) sleep(0.5) + self.box.unlimitedfuel(slot, (self.slot[slot]["profile"].getint("Settings", "Fuel") == 0) ) + sleep(0.5) self.cleartop() self.box.setmode(1) @@ -249,6 +251,7 @@ self.slot[slot]["limit"] = self.slot[slot]["profile"].getint("Settings", "Limit") self.flash_car_settings(slot) except IOError, err: + # load default profile self.slot[slot]["profilename"] = "default" self.slot[slot]["profile"].read("profiles/default") self.slot[slot]["limit"] = self.slot[slot]["profile"].getint("Settings", "Limit")