mirror of
https://github.com/jonathanhogg/scopething
synced 2025-07-14 03:02:09 +01:00
Use array
objects for samples and timestamps (as two items in a DotDict
per trace); put +2 back into timeout calculation logic
This commit is contained in:
5
vm.py
5
vm.py
@ -13,6 +13,7 @@ document][VM01B].
|
||||
|
||||
"""
|
||||
|
||||
import array
|
||||
import asyncio
|
||||
from collections import namedtuple
|
||||
from enum import IntEnum
|
||||
@ -356,10 +357,10 @@ class VirtualMachine:
|
||||
if sample_width == 2:
|
||||
data = await self._reader.readexactly(2 * n)
|
||||
data = struct.unpack(f'>{n}h', data)
|
||||
return [(value+32768)/65535 for value in data]
|
||||
return array.array('d', ((value+32768)/65535 for value in data))
|
||||
elif sample_width == 1:
|
||||
data = await self._reader.readexactly(n)
|
||||
return [value/255 for value in data]
|
||||
return array.array('d', (value/255 for value in data))
|
||||
else:
|
||||
raise ValueError(f"Bad sample width: {sample_width}")
|
||||
|
||||
|
Reference in New Issue
Block a user