Skip to content

Commit 6e330a3

Browse files
committed
reduced lag in joystick code
1 parent 4aa19e0 commit 6e330a3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • TRRS_Trinkey_Demos/XAC_Joystick

TRRS_Trinkey_Demos/XAC_Joystick/code.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def range_map(value, in_min, in_max, out_min, out_max):
8282
newY = int(yAvg.average())
8383

8484
#We only call move_joysticks if one of the values has changed from last time
85-
if (newX != lastXAvg or newY != lastYAvg):
86-
gp.move_joysticks(x=newX,y=newY)
87-
# print(hor.value, vert.value) # print debug raw values
88-
# print((newX, newY,)) # print debug remapped, averaged values
85+
#if (newX != lastXAvg or newY != lastYAvg):
86+
gp.move_joysticks(x=newX,y=newY)
87+
# print(hor.value, vert.value) # print debug raw values
88+
# print((newX, newY,)) # print debug remapped, averaged values
8989
#Sleep to avoid overwhelming the XAC
90-
time.sleep(0.05)
90+
time.sleep(0.008) # 125Hz polling rate is standard

0 commit comments

Comments
 (0)