slotUI/freeslot.py

changeset 36
aea84f4f5a12
parent 35
00166228a419
child 50
84b8ab4cd79e
--- a/slotUI/freeslot.py	Sat Dec 03 13:53:44 2011 +0100
+++ b/slotUI/freeslot.py	Sat Dec 03 14:25:06 2011 +0100
@@ -120,6 +120,20 @@
         else:
             return self.com.query( "P40%i" % carid )
 
+    def speedlimit(self, carid, value):
+        """
+        Set the maximum controller speed for a car
+        Attention: this is software limited, this does not affect car acceleration!
+        """
+        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( "L%i%s" % (carid, value) )
+
     def setmode(self, mode):
         """
         Switch the Blackbox mode

mercurial