console: Make baud an optional parameter
Make the baud rate an optional parameter to the console.py tool. When not present, it will default to 250000. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
9d3a3f3f30
commit
3c6eb376ac
|
@ -123,12 +123,15 @@ possible to manually send these MCU commands (functions marked with
|
||||||
the DECL_COMMAND() macro in the Klipper source code). To do so, run:
|
the DECL_COMMAND() macro in the Klipper source code). To do so, run:
|
||||||
|
|
||||||
```
|
```
|
||||||
~/klippy-env/bin/python ./klippy/console.py /tmp/pseudoserial 250000
|
~/klippy-env/bin/python ./klippy/console.py /tmp/pseudoserial
|
||||||
```
|
```
|
||||||
|
|
||||||
See the "HELP" command within the tool for more information on its
|
See the "HELP" command within the tool for more information on its
|
||||||
functionality.
|
functionality.
|
||||||
|
|
||||||
|
Some command-line options are available. For more information run:
|
||||||
|
`~/klippy-env/bin/python ./klippy/console.py --help`
|
||||||
|
|
||||||
Generating load graphs
|
Generating load graphs
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
|
|
@ -202,11 +202,18 @@ class KeyboardReader:
|
||||||
self.data = kbdlines[-1]
|
self.data = kbdlines[-1]
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
usage = "%prog [options] <serialdevice> <baud>"
|
usage = "%prog [options] <serialdevice>"
|
||||||
opts = optparse.OptionParser(usage)
|
opts = optparse.OptionParser(usage)
|
||||||
|
opts.add_option("-b", "--baud", type="int", dest="baud", help="baud rate")
|
||||||
options, args = opts.parse_args()
|
options, args = opts.parse_args()
|
||||||
serialport, baud = args
|
if len(args) != 1:
|
||||||
baud = int(baud)
|
opts.error("Incorrect number of arguments")
|
||||||
|
serialport = args[0]
|
||||||
|
|
||||||
|
baud = options.baud
|
||||||
|
if baud is None and not (serialport.startswith("/dev/rpmsg_")
|
||||||
|
or serialport.startswith("/tmp/")):
|
||||||
|
baud = 250000
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
r = reactor.Reactor()
|
r = reactor.Reactor()
|
||||||
|
|
Loading…
Reference in New Issue