Skip to content

Commit dcf78cf

Browse files
Merge remote-tracking branch 'upstream/main'
2 parents 6f7f909 + 615bbbd commit dcf78cf

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

main-ui/controller/controller.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,11 @@ def get_input(timeout=-2, called_from_check_for_hotkey=False):
178178
# Reset hold delay and clear any lingering event
179179
Controller.hold_delay = PyUiConfig.get_turbo_delay_ms()
180180

181-
Controller.clear_last_input()
182-
183181
# Blocking wait for event until timeout
182+
elapsed = time.time() - start_time
183+
remaining_time = timeout - elapsed
184+
remaining_time = max(remaining_time, 0.001)
184185
while True:
185-
elapsed = time.time() - start_time
186-
remaining_time = timeout - elapsed
187-
if remaining_time <= 0:
188-
break
189186

190187
ms_remaining = int(remaining_time * 1000)
191188
input = Controller.controller_interface.get_input(ms_remaining)
@@ -203,6 +200,10 @@ def get_input(timeout=-2, called_from_check_for_hotkey=False):
203200
Controller.check_for_hotkey()
204201
else:
205202
break # Valid non-hotkey input
203+
elapsed = time.time() - start_time
204+
remaining_time = timeout - elapsed
205+
if remaining_time <= 0:
206+
break
206207

207208

208209
#TODO i think this loop is in the wrong place

main-ui/controller/key_watcher_controller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ def key_change(self, controller_input, direction):
155155
def get_input(self, timeoutInMilliseconds):
156156
start_time = time.time()
157157
timeout = timeoutInMilliseconds / 1000.0
158-
159-
while (time.time() - start_time) < timeout:
158+
do_get_input = True
159+
while do_get_input:
160160
with self.lock:
161161
# First, check the event queue
162162
if self.input_queue:
@@ -171,6 +171,7 @@ def get_input(self, timeoutInMilliseconds):
171171
return value
172172

173173
time.sleep(0.005)
174+
do_get_input = (time.time() - start_time) < timeout
174175

175176
self.last_held_input = None
176177
return None

miyoo_mini_flip/keyshm/readme.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
docker build -t pyui_miyoomini .
2+
3+
mkdir output
4+
docker run --rm -v ${PWD}/output:/output pyui_miyoomini cp set_monitor /output/
5+
docker run --rm -v ${PWD}/output:/output pyui_miyoomini cp send_event /output/
6+
docker run --rm -v ${PWD}/output:/output pyui_miyoomini cp getevent /output/

0 commit comments

Comments
 (0)