Tweaks
This commit is contained in:
26
main.py
26
main.py
@ -11,13 +11,14 @@ from loguru import logger
|
||||
|
||||
# Import simulators
|
||||
from source.glory import GlorySimulator
|
||||
from source.jetsort import JetSortSimulator
|
||||
from source.pelican import PelicanSimulator
|
||||
from source.selex import SelexSimulator
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Device Simulator - Run Pelican, Glory MACH6, or Selex simulator",
|
||||
description="Device Simulator - Run Pelican, Glory MACH6, Selex, or JetSort simulator",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog="""
|
||||
Examples:
|
||||
@ -30,10 +31,14 @@ Examples:
|
||||
# Run Selex simulator
|
||||
python main.py selex --port /dev/ttyUSB2 --baudrate 9600
|
||||
|
||||
# Run JetSort simulator
|
||||
python main.py jetsort --port /dev/ttyUSB3 --baudrate 9600
|
||||
|
||||
# Get help for specific simulator
|
||||
python main.py pelican --help
|
||||
python main.py glory --help
|
||||
python main.py selex --help
|
||||
python main.py jetsort --help
|
||||
""",
|
||||
)
|
||||
|
||||
@ -81,7 +86,21 @@ Examples:
|
||||
help="Serial port (default: /dev/ttyUSB0)",
|
||||
)
|
||||
selex_parser.add_argument(
|
||||
"--baudrate", "-b", type=int, default=9600, help="Baud rate (default: 9600)"
|
||||
"--baudrate", "-b", type=int, default=115200, help="Baud rate (default: 115200)"
|
||||
)
|
||||
|
||||
# JetSort simulator subcommand
|
||||
jetsort_parser = subparsers.add_parser(
|
||||
"jetsort", help="Run JetSort coin/bill counter simulator"
|
||||
)
|
||||
jetsort_parser.add_argument(
|
||||
"--port",
|
||||
"-p",
|
||||
default="/dev/ttyUSB0",
|
||||
help="Serial port (default: /dev/ttyUSB0)",
|
||||
)
|
||||
jetsort_parser.add_argument(
|
||||
"--baudrate", "-b", type=int, default=115200, help="Baud rate (default: 115200)"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
@ -110,6 +129,9 @@ Examples:
|
||||
elif args.simulator == "selex":
|
||||
simulator = SelexSimulator(port=args.port, baudrate=args.baudrate)
|
||||
simulator.run()
|
||||
elif args.simulator == "jetsort":
|
||||
simulator = JetSortSimulator(port=args.port, baudrate=args.baudrate)
|
||||
simulator.run()
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Simulator stopped by user")
|
||||
sys.exit(0)
|
||||
|
||||
Reference in New Issue
Block a user