slotUI/SlotCli.py

changeset 106
11fabe1f7c40
parent 104
95b2c23cb973
child 107
efdf471642f5
equal deleted inserted replaced
105:1defce561e64 106:11fabe1f7c40
48 Popen(["/usr/bin/mpg123", "-q", SOUNDS[what]]) 48 Popen(["/usr/bin/mpg123", "-q", SOUNDS[what]])
49 #os.spawnlp(os.P_NOWAIT, "/usr/bin/mpg123", "mpg123", SOUNDS[what]) 49 #os.spawnlp(os.P_NOWAIT, "/usr/bin/mpg123", "mpg123", SOUNDS[what])
50 #Popen(["/usr/bin/mpg123", SOUNDS[what]]).pid 50 #Popen(["/usr/bin/mpg123", SOUNDS[what]]).pid
51 51
52 class SlotCli(): 52 class SlotCli():
53 def __init__(self, test = None): 53 def __init__(self, test = None, dev=""):
54 self.box = Blackbox() 54 self.box = Blackbox()
55 if not test: 55 if not test:
56 self.box.connect() 56 self.box.connect(dev)
57 self.slot_dummy = { 57 self.slot_dummy = {
58 "name": "Unnamed", 58 "name": "Unnamed",
59 "laps": 0, 59 "laps": 0,
60 "laps_last": 0, 60 "laps_last": 0,
61 "last": 0.00, 61 "last": 0.00,
562 help="Controlled SPEED LIMIT (15 = no limit)", metavar="[0-15]") 562 help="Controlled SPEED LIMIT (15 = no limit)", metavar="[0-15]")
563 parser.add_option("--drive", dest="drive", 563 parser.add_option("--drive", dest="drive",
564 help="Controlled SPEED MINIMUM (0 = disabled)", metavar="[0-15]") 564 help="Controlled SPEED MINIMUM (0 = disabled)", metavar="[0-15]")
565 parser.add_option("--test", dest="test", action="store_true", default=False, 565 parser.add_option("--test", dest="test", action="store_true", default=False,
566 help="", metavar="") 566 help="", metavar="")
567 parser.add_option("--dev", dest="dev", default="/dev/ttyUSB0",
568 help="Communication port", metavar="[/dev/ttyUSB0]")
567 569
568 (options, args) = parser.parse_args() 570 (options, args) = parser.parse_args()
569 cli = SlotCli(options.test) 571 #if not options.dev:
572 # options.dev = "/dev/ttyUSB0"
573 cli = SlotCli(options.test, options.dev)
570 # should a CLI function be started? 574 # should a CLI function be started?
571 575
572 if options.live: 576 if options.live:
573 # start the live monitor 577 # start the live monitor
574 cli.monitor() 578 cli.monitor()

mercurial