adds rate calculation for each channel
Some checks failed
Test And Build / Lint (push) Failing after 2s
Test And Build / Build (push) Failing after 2s

This commit is contained in:
2025-11-20 12:16:52 +01:00
parent 31aa9d246a
commit 8ae9cb0bd8
3 changed files with 91 additions and 12 deletions

View File

@@ -47,7 +47,7 @@ while True:
header[17] = t_high >> 8
num_events = random.randint(0, 243)
# num_events = 243
num_events = 243
# num_events = 1
# update buffer length
@@ -61,7 +61,7 @@ while True:
# reduce also the number of checks on the parsing side of things...
is_monitor = random.randint(0, 9)
# is_monitor = 4
is_monitor = 4
header[11] = 0 if is_monitor > 3 else random.randint(1,9)
@@ -71,7 +71,7 @@ while True:
header[7] = (header[7] + (header[6] == 0)) % (0xff + 1)
buffer_ids[header[11]] = header[6], header[7]
tosend = list(header)
tosend = []
if is_monitor > 3:
@@ -79,7 +79,7 @@ while True:
d = list(data)
monitor = random.randint(0,3)
# monitor = 0
monitor = 0
d[5] = (1 << 7) | monitor
@@ -89,7 +89,8 @@ while True:
d[1] = (event_timestamp >> 8) & 0xff
d[2] = (event_timestamp >> 16) & 0x07
tosend += d
# completely reversed sorting
tosend = d + tosend
else:
@@ -110,9 +111,10 @@ while True:
d[1] = (event_timestamp >> 8) & 0xff
d[2] |= (event_timestamp >> 16) & 0x07
tosend += d
# completely reversed sorting
tosend = d + tosend
sock.sendto(bytes(tosend), ('127.0.0.1', 54321))
sock.sendto(bytes(header + tosend), ('127.0.0.1', 54321))
mv = memoryview(bytes(header)).cast('H')
print(f'Sent packet {mv[3]} with {num_events} events {base_timestamp}')
# time.sleep(.01)
# time.sleep(.1)