renamed --speed to --accel and added minimum value 6

Sun, 28 Oct 2012 10:41:39 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Sun, 28 Oct 2012 10:41:39 +0100
changeset 100
039ab094f79b
parent 99
434d60dc9b12
child 101
92d204c738e1

renamed --speed to --accel and added minimum value 6

slotUI/SlotCli.py file | annotate | diff | comparison | revisions
slotUI/freeslot.py file | annotate | diff | comparison | revisions
--- a/slotUI/SlotCli.py	Sat Dec 17 18:58:35 2011 +0100
+++ b/slotUI/SlotCli.py	Sun Oct 28 10:41:39 2012 +0100
@@ -452,8 +452,8 @@
         help="Set maximum CAR fuel level", metavar="[0-15]")
     parser.add_option("--brake", dest="brake",
         help="Set CAR brake strength", metavar="[0-15]")
-    parser.add_option("--speed", dest="speed",
-        help="Set maximum CAR speed", metavar="[0-15]")
+    parser.add_option("--accel", dest="accel",
+        help="Set CAR acceleration ", metavar="[6-15]")
     parser.add_option("--blink", dest="blink",
         help="Set car lights blinking state", metavar="[on|off]")
     parser.add_option("--limit", dest="limit",
@@ -480,8 +480,8 @@
     if options.fuel:
         print "setFuel: " + cli.box.progcar(int(options.carid), "fuel", int(options.fuel))
 
-    if options.speed:
-        print "setSpeed: " + cli.box.progcar(int(options.carid), "speed", int(options.speed))
+    if options.accel:
+        print "setAccel: " + cli.box.progcar(int(options.carid), "accel", int(options.accel))
 
     if options.brake:
         print "setBrake: " + cli.box.progcar(int(options.carid), "brake", int(options.brake))
--- a/slotUI/freeslot.py	Sat Dec 17 18:58:35 2011 +0100
+++ b/slotUI/freeslot.py	Sun Oct 28 10:41:39 2012 +0100
@@ -104,7 +104,7 @@
         if (carid < 0) or (carid > 5):
             return "ERR - invalid carid"
         cmd = -1
-        if command == "speed":
+        if command == "accel":
             cmd = 0
         if command == "brake":
             cmd = 1
@@ -114,6 +114,8 @@
             return "ERR - invalid command"
         if (value<0) or (value>15):
             return "ERR - invalid value"
+        if command == "accel" and value < 6:
+            return "ERR - value too low"
         # transform value 10..15 to A..F
         if (value>9):
             value = chr(ord("A") + (value-10))

mercurial