# HG changeset patch # User Malte Bayer # Date 1323361334 -3600 # Node ID 84b8ab4cd79ef215b6d96f076ba3ec6a5b8d6846 # Parent 3957ff8e86c6127b8953dd9e0f24f3c01616cc65 implemented new --drive command to CLI diff -r 3957ff8e86c6 -r 84b8ab4cd79e slotUI/SlotCli.py --- a/slotUI/SlotCli.py Thu Dec 08 17:16:06 2011 +0100 +++ b/slotUI/SlotCli.py Thu Dec 08 17:22:14 2011 +0100 @@ -35,6 +35,8 @@ help="Set car lights blinking state", metavar="[on|off]") parser.add_option("--limit", dest="limit", help="Controlled SPEED LIMIT (15 = no limit)", metavar="[0-15]") + parser.add_option("--drive", dest="drive", + help="Controlled SPEED MINIMUM (0 = disabled)", metavar="[0-15]") (options, args) = parser.parse_args() cli = SlotCli() @@ -64,3 +66,6 @@ if options.limit != None: print "Change Speed Limit: " + cli.box.speedlimit(int(options.carid), int(options.limit)) + if options.drive != None: + print "Change minimum Speed drive: " + cli.box.speedminimum(int(options.carid), int(options.drive)) + diff -r 3957ff8e86c6 -r 84b8ab4cd79e slotUI/freeslot.py --- a/slotUI/freeslot.py Thu Dec 08 17:16:06 2011 +0100 +++ b/slotUI/freeslot.py Thu Dec 08 17:22:14 2011 +0100 @@ -134,6 +134,20 @@ value = chr(ord("A") + (value-10)) return self.com.query( "L%i%s" % (carid, value) ) + def speedminimum(self, carid, value): + """ + Set the minimzm controller speed for a car + """ + if (carid < 0) or (carid > 5): + return "ERR - invalid carid" + if (value<0) or (value>15): + return "ERR - invalid value" + # transform value 10..15 to A..F + if (value>9): + value = chr(ord("A") + (value-10)) + return self.com.query( "S%i%s" % (carid, value) ) + + def setmode(self, mode): """ Switch the Blackbox mode