diff --git a/motmot/fview_ext_trig/ttrigger.py b/motmot/fview_ext_trig/ttrigger.py index 6531e0b..a2de555 100644 --- a/motmot/fview_ext_trig/ttrigger.py +++ b/motmot/fview_ext_trig/ttrigger.py @@ -429,6 +429,10 @@ def get_analog_input_buffer_rawLE(self): bufs = [] got_bytes = False timeout = 50 # msec + + cnt = 0 # Count number of times endpoint has been read + min_cnt = 2 # Minimum number of times end point should be read + while 1: # keep pumping until no more data try: @@ -436,12 +440,14 @@ def get_analog_input_buffer_rawLE(self): n_bytes = usb.bulk_read(self._libusb_handle, (ENDPOINT_DIR_IN|ANALOG_EPNUM), INPUT_BUFFER, timeout) except usb.USBNoDataAvailableError: break + cnt += 1 n_elements = n_bytes//2 buf = np.fromstring(INPUT_BUFFER.raw,dtype='= min_cnt): break # don't bother waiting for data to dribble in + if len(bufs): outbuf = np.hstack(bufs) else: