445 parser = OptionParser(version="%prog " + VERSION) |
445 parser = OptionParser(version="%prog " + VERSION) |
446 parser.add_option("--live", dest="live", action="store_true", default=False, |
446 parser.add_option("--live", dest="live", action="store_true", default=False, |
447 help="Run Live monitor on console", metavar="[0-5]") |
447 help="Run Live monitor on console", metavar="[0-5]") |
448 |
448 |
449 parser.add_option("--slot", dest="carid", |
449 parser.add_option("--slot", dest="carid", |
450 help="Required for programming a car directly", metavar="[0-5]") |
450 help="Required for programming a car directly", metavar="[1-6]") |
451 parser.add_option("--fuel", dest="fuel", |
451 parser.add_option("--fuel", dest="fuel", |
452 help="Set maximum CAR fuel level", metavar="[0-15]") |
452 help="Set maximum CAR fuel level", metavar="[0-15]") |
453 parser.add_option("--brake", dest="brake", |
453 parser.add_option("--brake", dest="brake", |
454 help="Set CAR brake strength", metavar="[0-15]") |
454 help="Set CAR brake strength", metavar="[0-15]") |
455 parser.add_option("--accel", dest="accel", |
455 parser.add_option("--accel", dest="accel", |
472 cli.monitor() |
472 cli.monitor() |
473 sys.exit(0) |
473 sys.exit(0) |
474 |
474 |
475 # check commandline if we have to program something |
475 # check commandline if we have to program something |
476 if not options.carid: |
476 if not options.carid: |
477 print "Option --carid is required for all car programming commands!\nUse --help to get a list of available commands" |
477 print "Option --slot is required for all car programming commands!\nUse --help to get a list of available commands" |
478 sys.exit(1) |
478 sys.exit(1) |
|
479 else: |
|
480 options.carid = int(options.carid) - 1 |
|
481 if (options.carid < 0) or (options.carid > 6): |
|
482 print "Error: Invalid slot selected" |
|
483 sys.exit(1) |
479 |
484 |
480 if options.fuel: |
485 if options.fuel: |
481 print "setFuel: " + cli.box.progcar(int(options.carid), "fuel", int(options.fuel)) |
486 print "setFuel: " + cli.box.progcar(int(options.carid), "fuel", int(options.fuel)) |
482 |
487 |
483 if options.accel: |
488 if options.accel: |