From aa8b99ac13893129f715ad025a165bb0e9c6cf37 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 15 Oct 2026 01:13:36 -0700 Subject: [PATCH] change ble test add cli arg --- api/ble.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/api/ble.py b/api/ble.py index 30b05e9..6e10d50 100644 --- a/api/ble.py +++ b/api/ble.py @@ -266,11 +266,23 @@ def test(test_count = 0) -> None: # --------------------------------------------------------------------------- # if __name__ == "__main__": import json + import sys + # 1. Grab the argument (string) + if len(sys.argv) < 2: + print("Usage: python3 test.py ") + sys.exit(1) + + try: + count = int(sys.argv[1]) # convert to integer + except ValueError: + print("The count must be an integer.") + sys.exit(1) + test_count = 0 - print("Welp, this will keep going forever. Have fun :)") - while True: + print(f"Starting BLE Test for {count} iterations") + while test_count <= count: test_count = test_count + 1 - print(f"Starting test run {test_count}") + print(f"Starting test run {test_count} of {count}") try: test(test_count) except Exception as e: