master
Bel LaPointe 2022-09-18 11:37:58 -06:00
parent 52e9df34d3
commit cbe790c90c
1 changed files with 5 additions and 2 deletions

View File

@ -38,6 +38,9 @@ class InputBuffer(threading.Thread):
def interval():
return .1
def sticky_duration():
return 1
def stop(self):
self.done = True
self.q.put(None)
@ -124,8 +127,8 @@ class InputBuffer(threading.Thread):
latest = b
oldest = a
if latest.v == None:
t_a_few_intervals_ago = InputBuffer.now() - InputBuffer.interval() * 10
if oldest.t > t_a_few_intervals_ago:
a_few_t_ago = InputBuffer.now() - InputBuffer.sticky_duration()
if oldest.t > a_few_t_ago:
return oldest
return latest