[dataio/buffer] fixing bug in time buffer
This commit is contained in:
parent
ff2d8ebb50
commit
0f09c948ec
@ -8,9 +8,9 @@ class CircBuffer:
|
||||
def __init__(
|
||||
self,
|
||||
size: int,
|
||||
mutex: QMutex,
|
||||
channels: int = 1,
|
||||
samplerate: int = 40_000,
|
||||
mutex: QMutex = QMutex(),
|
||||
):
|
||||
self.__size = size
|
||||
self.__channels = channels
|
||||
@ -123,7 +123,7 @@ class CircBuffer:
|
||||
# easy case first, we can spare the effort of further checking
|
||||
if index >= 0 and index <= self.write_index(channel):
|
||||
if self.has_value(index, channel):
|
||||
return (self.__buffer[channel, index], self.__time[index])
|
||||
return (self.__buffer[channel, index], self.__time[channel, index])
|
||||
else:
|
||||
raise IndexError(
|
||||
f"Invalid index {index} on ring buffer for channel{channel}"
|
||||
@ -132,7 +132,7 @@ class CircBuffer:
|
||||
if index < 0:
|
||||
index = self.write_index() - 1
|
||||
if self.has_value(index, channel):
|
||||
return (self.__buffer[channel, index], self.__time[index])
|
||||
return (self.__buffer[channel, index], self.__time[channel, index])
|
||||
else:
|
||||
raise IndexError(
|
||||
f"Invalid index {index} on ring buffer for channel{channel}"
|
||||
|
Loading…
Reference in New Issue
Block a user