From c0287d8a04c95da2dfd833412c8f93f4f6e0aa03 Mon Sep 17 00:00:00 2001 From: Isaak <43730681+I5UCC@users.noreply.github.com> Date: Thu, 24 Nov 2022 05:12:20 +0100 Subject: [PATCH] added adjustable polling rate --- src/ThumbParamsOSC.py | 7 ++++--- src/config.json | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ThumbParamsOSC.py b/src/ThumbParamsOSC.py index 22ce189..0838a2c 100644 --- a/src/ThumbParamsOSC.py +++ b/src/ThumbParamsOSC.py @@ -137,7 +137,7 @@ def handle_input(): # debug output if args.debug: - move(8, 0) + move(9, 0) if config["SendInts"]: print("------------------- Ints --------------------") @@ -161,7 +161,7 @@ def handle_input(): print("RightTrackPad:\t", bool(int(_strinputs[6])), " ", "\tEnabled:", config["ParametersBool"]["RightTrackPad"][1]) print("RightThumbStick:", bool(int(_strinputs[7])), " ", "\tEnabled:", config["ParametersBool"]["RightThumbStick"][1]) - +pollingrate = 1 / float(config['PollingRate']) cls() print("ThumbParamsOSC running...\n") print("IP:\t\t", IP) @@ -169,12 +169,13 @@ def handle_input(): print("SendInts:\t", config["SendInts"]) print("SendBools:\t", config["SendBools"]) print("SendFloats:\t", config["SendFloats"]) +print(f"PollingRate:\t {pollingrate}s ({config['PollingRate']} Hz)") # Main Loop while True: try: handle_input() - time.sleep(0.04) + time.sleep(pollingrate) except KeyboardInterrupt: cls() sys.exit() diff --git a/src/config.json b/src/config.json index 2b9796c..3681e4f 100644 --- a/src/config.json +++ b/src/config.json @@ -2,6 +2,7 @@ "IP": "127.0.0.1", "Port": 9000, "SendInts": true, + "PollingRate": 25, "ParametersInt": { "ControllerType": ["/avatar/parameters/ControllerType", true],