Skip to content

Commit

Permalink
added adjustable polling rate
Browse files Browse the repository at this point in the history
  • Loading branch information
I5UCC committed Nov 24, 2022
1 parent 8651887 commit c0287d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ThumbParamsOSC.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def handle_input():

# debug output
if args.debug:
move(8, 0)
move(9, 0)

if config["SendInts"]:
print("------------------- Ints --------------------")
Expand All @@ -161,20 +161,21 @@ 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)
print("Port:\t\t", PORT)
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()
Expand Down
1 change: 1 addition & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"IP": "127.0.0.1",
"Port": 9000,
"SendInts": true,
"PollingRate": 25,
"ParametersInt":
{
"ControllerType": ["/avatar/parameters/ControllerType", true],
Expand Down

0 comments on commit c0287d8

Please sign in to comment.