fix chan swap

This commit is contained in:
awe
2026-04-10 21:13:54 +03:00
parent 44a89b8da3
commit 93823b9798
2 changed files with 31 additions and 4 deletions

View File

@ -500,18 +500,27 @@ class SweepAssembler:
self._reset_current()
if event.ch is not None:
self._cur_channel = int(event.ch)
self._cur_channels.add(int(event.ch))
return packet
point_ch = int(event.ch)
packet: Optional[SweepPacket] = None
if self._cur_channel is None:
self._cur_channel = int(event.ch)
self._cur_channels.add(int(event.ch))
self._cur_channel = point_ch
elif point_ch != self._cur_channel:
if self._xs:
# Never mix channels in a single sweep packet: otherwise
# identical step indexes can overwrite each other.
packet = self.finalize_current()
self._reset_current()
self._cur_channel = point_ch
self._cur_channels.add(point_ch)
self._xs.append(int(event.x))
self._ys.append(float(event.y))
if event.aux is not None:
self._aux_1.append(float(event.aux[0]))
self._aux_2.append(float(event.aux[1]))
return None
return packet
def finalize_current(self) -> Optional[SweepPacket]:
if not self._xs: