Skip to content

Commit 8313af1

Browse files
committed
make left stick not lift up arrow key
when turn to most left or right, I think its called full overlap but this is better, there is not lifting up or down arrow key unless you go back to dead zone, from dead zone there is normal overlap, not round like a box threashold, -x x -y y, so from y to x (up/down to left/right) y threashold go to 0 or 1 not sure (middle, 127)
1 parent 63c8d30 commit 8313af1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fixes/raw_ps4/controller.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,14 @@ def __init__(self, ui, threshold, output_key):
129129
self.ui = ui
130130
self.last_state = 0
131131
self.threshold = threshold
132+
self.threshold_comp = 0
132133
self.output_key = output_key
133134

134135
def handle(self, value):
135136
"""Handle axis values."""
136137
tr1, tr2 = self.threshold
138+
tr1 += self.threshold_comp
139+
tr2 -= self.threshold_comp
137140
neg_key, pos_key = self.output_key
138141

139142
if value < tr1:
@@ -158,10 +161,12 @@ def handle(self, value):
158161
if self.last_state == -1:
159162
self.ui.write(e.EV_KEY, neg_key, 0)
160163
self.last_state = 0
164+
self.threshold_comp = 0
161165
self.ui.syn()
162166
elif self.last_state == 1:
163167
self.ui.write(e.EV_KEY, pos_key, 0)
164168
self.last_state = 0
169+
self.threshold_comp = 0
165170
self.ui.syn()
166171

167172

@@ -193,6 +198,8 @@ def handle_event(self, event):
193198
"""Handle the events."""
194199
if event.code == self.event_x:
195200
self.x_axis.handle(event.value)
201+
if self.y_axis.last_state != 0:
202+
self.y_axis.threshold_comp = abs(event.value-127)
196203
elif event.code == self.event_y:
197204
self.y_axis.handle(event.value)
198205

0 commit comments

Comments
 (0)