From 811e33277a9bb99fe273c8b176158740c6b2a1d5 Mon Sep 17 00:00:00 2001 From: ChanceCtrl Date: Sun, 25 Feb 2024 21:52:54 +0000 Subject: [PATCH] added env var Now runner.py looks for the D_SOURCE env var to tell what data source its looking for --- py_data_acq/runner.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/py_data_acq/runner.py b/py_data_acq/runner.py index 19516d7..e2888be 100644 --- a/py_data_acq/runner.py +++ b/py_data_acq/runner.py @@ -68,15 +68,16 @@ async def run(logger): mcap_writer = HTPBMcapWriter(path_to_mcap, list_of_msg_names, True) mcap_server = MCAPServer(mcap_writer=mcap_writer, path=path_to_mcap) - # Setup receiver_task to listen to CAN - # receiver_task = asyncio.create_task( - # can_receiver(db, msg_pb_classes, queue1, queue2) - # ) - - # Setup receiver_task to listen to SERIAL - receiver_task = asyncio.create_task( - serial_reciever(db, msg_pb_classes, queue1, queue2) - ) + # Get data source + match os.environ.get("D_SOURCE"): + case "SERIAL": + receiver_task = asyncio.create_task( + serial_reciever(db, msg_pb_classes, queue1, queue2) + ) + case _: + receiver_task = asyncio.create_task( + can_receiver(db, msg_pb_classes, queue1, queue2) + ) # Setup other guys to respective asyncio tasks fx_task = asyncio.create_task(fxglv_websocket_consume_data(queue1, fx_s))